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
-
43658 Solvers
-
255 Solvers
-
466 Solvers
-
5369 Solvers
-
Check if a matrix is a palindrome in all directions
106 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!