Cody

Problem 46660. List all of the integer points in a bounded feasble region

Solution 3054160

Submitted on 4 Oct 2020 by Rafael S.T. Vieira
  • Size: 97
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
inequalities = ["y <= -3/4x + 6";"y <= x + 4"]; y_correct = [0,0;0,1;0,2;0,3;0,4;1,0;1,1;1,2;1,3;1,4;1,5;2,0;2,1;2,2;2,3;2,4;3,0;3,1;3,2;3,3;4,0;4,1;4,2;4,3;5,0;5,1;5,2;6,0;6,1;7,0;8,0]; assert(isequal(listIntegerPoints(inequalities),y_correct))

2   Pass
inequalities = ["y <= -x + 5"]; y_correct = [0,0;0,1;0,2;0,3;0,4;0,5;1,0;1,1;1,2;1,3;1,4;2,0;2,1;2,2;2,3;3,0;3,1;3,2;4,0;4,1;5,0]; assert(isequal(listIntegerPoints(inequalities),y_correct))

3   Pass
inequalities = ["x + 3*y <= 9"; "x + 7*y <= 14"; "x + y >= 5"]; y_correct = [4,1;5,0;5,1;6,0;6,1;7,0;8,0;9,0]; assert(isequal(listIntegerPoints(inequalities),y_correct))

4   Pass
inequalities = ["x - 3*y <= 6"; "2*x + y <= 14"; "x + y >= 5"]; y_correct = [0,5;0,6;0,7;0,8;0,9;0,10;0,11;0,12;0,13;0,14;1,4;1,5;1,6;1,7;1,8;1,9;1,10;1,11;1,12;2,3;2,4;2,5;2,6;2,7;2,8;2,9;2,10;3,2;3,3;3,4;3,5;3,6;3,7;3,8;4,1;4,2;4,3;4,4;4,5;4,6;5,0;5,1;5,2;5,3;5,4;6,0;6,1;6,2]; assert(isequal(listIntegerPoints(inequalities),y_correct))

Suggested Problems

More from this Author68

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!