Problem 45450. Don't be Too Greedy!
Refer to the prev problem https://www.mathworks.com/matlabcentral/cody/problems/45416dontbegreedy
A list of assignments is given to the students. For this problem, assume  each of the assignment carries equal marks.
Different assignments take different amounts of time to complete  which is also given.
But for each day of delay before starting an assignment, a penalty is added.
for example,
Assignment = [ a1, a2, a3, a4, a5, a6] Marks = [100,100,100,100,100,100] Time Req. = [ 2, 4, 3, 8, 1, 10] Penalty = [ 10, 4, 1, 2, 5, 2]
Now, say if he starts with the 1st assignment  then a penalty will be added to all the other assignments for two days since it takes 2 days to complete the 1st assignment.
Then say he starts the 2nd assignment which takes 4 days to complete. So penalty will be added for the other assignments that he hasn't started yet (not the 1st onesince it's been finished)
In which order should he finish his assignments so that he has to suffer the minimum penalty.
Solution Stats
Problem Comments

6 Comments
Can you give more explain about the example?
say i start 1st assign. today  now it'll take me 2 days to complete. once I start with one assign, I've to finish it first  then jump to the next assign.
Now for these 2 days, I couldn't 'start' the other assign. so i've to suffer given penalty for each assign. each day. that is = 4*2 + 1*2 + 2*2 + 5*2 + 2*2 .= Σt(1)*p
After 2 days, say I start the last assign. which will take 10 days to finish. so for each of these 10 days  the penalty will keep adding for those assigns. that I've not yet started.
this way I'll continue.
at the end, a particular amount of penalty will be accumulated.
I want that total penalty to be minimum.
there'll be many combinations  among all those, which one will give me minimum penalty?
hope it is clear
OK, I see now
It seems that these problems have multiple degenerate solutions. For example, problem 1 is solved by [1 5 2 3 4 6] or [5 1 2 3 4 6]. Problem 2 has 4 solutions.
william,
if there exists more than one possible scenario, then the assignments are to be assigned based on their priority  meaning, 1st task should get preference over 5th.
similar is in the case of test suite 2  a3 should come before a6.
I think it should be ok then.
Please, Asif, add the example that you gave in the comments to the problem description. It will make the problem clearer.
Solution Comments
Show commentsProblem Recent Solvers6
Suggested Problems

3278 Solvers

Calculate the Levenshtein distance between two strings
1421 Solvers

Convert from Base 10 to base 5
258 Solvers

Determine the number of odd integers in a vector
715 Solvers

Did you say please?  Find one string within another without strfind or regexp/regexpi
52 Solvers
More from this Author165
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!