Problem 44718. Optimize the Tollbooths
Solution Stats
Problem Comments
-
5 Comments
@Alfonso, I tested your suggestion against the reference solution provided by Aamod Garg (problem author). His solution worked for test cases 2 and 3, but failed 1, 4, and 5 due to that modification (therefore, I reverted to its original state). Do you have a further suggestion to fix this?
@goc3, I would suggest "y=toll_pricing_strategy(option,budget); revenue=@(x)sum((option*x(:)).*((option*x(:))<=budget)); assert(revenue(y)>=revenue(y_correct))". That should allow equivalent or better alternatives to the author's reference solutions (if I am not mistaken this is necessary because in problems 4 and 5 the reference solution does not appear to be optimal; e.g. in problem 5, tolls [18 33 9 14 13 11 12 10] result in 330 revenue, while the reference solution results in 280 revenue)
@Alfonso, the test suite has been updated per your suggestion. It does work against the author's reference solution.
Solution Comments
Show commentsProblem Recent Solvers2
Suggested Problems
-
Remove the small words from a list of words.
1526 Solvers
-
2493 Solvers
-
Maintain shape of logical-index mask
70 Solvers
-
Back to basics - mean of corner elements of a matrix
427 Solvers
-
Write c^3 as sum of two squares a^2+b^2
319 Solvers
More from this Author2
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!