Find Jobs
Hire Freelancers

Greedy algorithm

€8-30 EUR

Completed
Posted almost 5 years ago

€8-30 EUR

Paid on delivery
A research laboratory has an expensive scanning probe microscope, shared between different work groups. Every day, groups interested in using the microscope on the next day sive communicate their requests, indicating the time intervals for which they want to book the resource. The head of the laboratory must select a set of compatible requests from each other, and wants to do it in order to satisfy the maximum number of requests. Two requests are among them compatible if the respective time intervals do not overlap. More formally, let us suppose that there are n requests, identified by the numbers 1, · · ·, n. Every request and a couple (si , fi ), where si indicates the instant of beginning and fi the instant of the end of the request the. Obviously, suppose si <fi . We will say that the requests i and j are compatible if fi ≤ sj o fj ≤ si . A subset of requests is compatible if its elements are two-by-two compatible. We ask you to write a program that, given a set of requests, calculates a subset compatible with maximum cardinality. Each request includes four data: (1) a letter, which is identifies the research group; (2) the initial instant of the request; (3) the final instant of the request; (4) a real number, which represents the cost of the operation to be performed. The initial moments and final are integers (we will assume that the time frame in which we can use the microscope be divided into 1440 minutes). The program acquires data from standard input. The first line contains the number n of requests. Each subsequent line contains the four data related to a single request, in the order in which they are described above, and separated by spaces. Suppose the data is correct; in particular, that for each request they are worth (1) si < fi and (2) fi <1440. After calculating the solution, the program must print the selected request data, sorted according to the starting point, and the total cost of the solution. The exercise consists of a form of interval scheduling (or allocation of intervals). In the simple variant proposed here, the solution can be calculated by applying a greedy type algorithm, which at each step chooses, among the residual requests, the one with the minor end instant (excluding, of course, those not compatible with the requests already selected ). Example of input data format: 6 B 120 280 12.34 B 1100 1187 6.34 C 260 480 9.761 A 180 512 11.34 C 360 900 14.2 D 280 512 9.2 For these data, the suggested algorithm provides the solution (B 120 280 12.34) (D 280 512 9.2) (B 1100 1187 6.34) with a total value of 27.88. There is another acceptable solution of cardinality 3, formed by (B 120 280 12.34) (C 360 900 14.2) (B 1100 1187 6.34), with a value of 32.88. It is emphasized that the exercise does not require the determination of a maximum value solution.
Project ID: 20340906

About the project

6 proposals
Remote project
Active 5 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hello. I read your proposal and the most import important thing of greedy algorithm is greedy strategy. According to the greedy strategy you can speed up the search and accuracy. Keep in touch. Regards
€25 EUR in 1 day
4.9 (6 reviews)
3.8
3.8
6 freelancers are bidding on average €81 EUR for this job
User Avatar
Hey there, I am expert in Algorithms and C++. Feel free to inbox me any time. Thank you........................
€60 EUR in 2 days
4.9 (63 reviews)
5.3
5.3
User Avatar
Dear,Client. I am checking your requirements carefully. In fact, I have a good experience and skills in algorithm. Dynamic programmin, greedy, graphics algorithms are my major ones. In fact, I have passed many algorithm contests. So I can give you good result. Thank you. Best regards. From Xiuna
€50 EUR in 1 day
5.0 (8 reviews)
5.1
5.1
User Avatar
I have a team of 8 people who are extremely good with CSS. HTML, JAVA, PHP and Python. if you provide me the opportunity, i'll finish the work at my earliest without compromising on Quality and will ensure your complete satisfaction. I have done more than 140 works where majority of the work i got 5 star.
€49 EUR in 7 days
5.0 (7 reviews)
4.6
4.6
User Avatar
hi wintergreen develops more projects in optimization in matlab. it's need basically 1. encoding variable - scheduling 2. fitness function. - cost 3. constraints based on we have minimize the cost and get the optimized output. if you need any clarification kindly contact through chat...thank you...
€288 EUR in 15 days
5.0 (3 reviews)
3.3
3.3
User Avatar
Hello It's rather easy task and I can do it fast because I have a lot of experience in algorithms. Feel free to choose me
€15 EUR in 1 day
5.0 (1 review)
0.0
0.0

About the client

Flag of ITALY
Sedriano, Italy
5.0
1
Payment method verified
Member since Jul 15, 2019

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.