I am writing a problem to solve Job schedules but I am having a hard time understanding how.
The Wood Shop has a backlog of orders for its world famous rocking chair (1 chair per order). There are several
steps involved in making a handmade Baber Rocking chair (eg. cutting wood pieces, assembly, sanding, applying a stain,
and applying varnish).
The total time required to make a chair is 1 week. However, since the chairs are sold in different
regions and various markets, the amount of profit for each order may differ. In addition, there is a deadline associated
with each order. The company will only earn a profit if they meet the deadline; otherwise, the profit is 0.
Write a program that will determine an optimal schedule for the orders that will maximize profit. The input file will
contain one or more test cases. The first line in a test case will contain an integer, n (0 n 1000), that represents the
number of orders that are pending.
A value of 0 for n indicates the end of the input file.
The next n lines contain 3 positive integers each. The first integer, i, is an order number.
All order numbers for a given
test case are unique. The second integer represents the number of weeks from now until the deadline for i
th
order. The
third integer represents the amount of profit that the company will earn if the deadline is met for the i
th
order.
What I am asking for is an algorithm of how I should go about solving this problem.
For each test case in the input file, the output file should output a line that reports the amount of profit that results from
completing the orders in an optimal order.
Example Input File (sched.in)
7
1 3 40
2 1 35
3 1 30
4 3 25
5 1 20
6 3 15
7 2 10
4
3054 2 30
4099 1 35
3059 2 25
2098 1 40
0
Example Output File (sched.out)
100
70
The postulate of your problem is incomplete. It is required to know ho many chairs can you make per week. Maybe you can make all at once. But let’s assume you can make only one. The solution is like this.
based on the very smart comments of Cameron Skinner I change my answer to this: