One way or the other two sets of identical types can come out ahead of the other by idea of Pareto equality. Pareto equality between two sets, or a group of sets, requires that atleast one element of each set is ranked higher than its corresponding element of the other set. Please see: http://en.wikipedia.org/wiki/Pareto_optimal for more information.
Build a function to take two cell-args, and return a boolean value true/false, to indicate their pareto equality.
Ex. >> ispareto( {1,'foo',40}, {0,'bar',30}) = true
>> ispareto( {2,-10,'z'},{0,-9,'t'}) = false
Cell-array can have only numbers and strings. Use natural comparison functions for numbers (a>b), while strings have 'a' > 'z' kind of comparison.
Next, generalize this function to work with varargs, and see if the entire set is pareto optimal.
Two or more arguments will always be supplied.
Solution Stats
Problem Comments
7 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers11
Suggested Problems
-
Number of 1s in the Binary Representation of a Number
476 Solvers
-
140 Solvers
-
The Hitchhiker's Guide to MATLAB
3401 Solvers
-
252 Solvers
-
Generate a random matrix A of (1,-1)
400 Solvers
More from this Author10
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
I don't really understand the mechanics of this. could you link to an article or something where I could read more about it?
I may have poorly written the problem statement; the general idea is to find optimal candidates for the problem
arg max F(x,y,z)
where many {x,y,z} pairs maximize F.
Please see http://en.wikipedia.org/wiki/Pareto_optimal. HTH.
test suit is broken plz fix
The author included a reference solution, and it still passes the test suite.
I've solved it, but I am not sure it is right. Solutions to this problem seem to be case-oriented and probably not what the author expected. I believe the last case is wrong, for instance, but it depends on the criteria used (what is the preference of each set? is it to be ordered?). Moreover, the Wikipedia article displays a weighted sum. Still, the author doesn't mention weights or how they should be added, anyway...good luck to future challengers.
Could someone (Dyuman?) please fix the test suite so that y_correct is set for the first assertion and not commented out?
To whoever did it: thanks!