Please add more than one test case. Otherwise, the problem can be obviated by simply hard-coding solutions. You mention that with some data sets there could be more than one solution. Well, please put in the time and effort to develop a suitable test suite with such test cases included. Three or four test cases should be a minimum.
A good problem, but it desperately needs more test cases. Sadly, intlinprog is not an acceptable solution method.
This is a nice problem, I encourage you to extend it with additional test cases. Also it is unclear what format you would expect the output to be when there are multiple solutions: multiple outputs? a cell array?
with given test cases it is too tempting to cheat
It doesn't generate correct results but passed test suites. Why?
Very similar to what I was trying to do, but in about a third of the size...
Determine whether a vector is monotonically increasing
Back to basics 7 - Equal NaNs
Energy of a photon
Rounding off numbers to n decimals
Find the index of n in magic(n)
Basic commands - Least common multiple
Which coins to give
Basic commands - Greatest common divisor
Basic commands - rounding
What's size of TV?
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office