Hello Ivkai, You should use integer statement on variables declaration
The solution is 14. But if you have not integers parameters in your objective function, you can't say that's z will be integer. In this case, add an integer variable and a constraint witch tells the new variable is equals to you objective function definition. #problem.mod #variables var x1 >= 0, integer; var x2 >= 0, integer; # var x3 >= 0, integer; #objective maximize z: 3*x1 + 2*x2; #constraints s.t. firstCondition: 2*x1 + 3*x2 <= 14; s.t. secondCondition: 2*x1 + x2 <= 9; # s.t. thirdCondition: x3 = 3*x1 + 2*x2; end; On 6/2/07, lvkai <[EMAIL PROTECTED]> wrote:
hello, how are you? I want to know how to solve the IP (not normal LP problem,but the problem whose result is Integer)? I have made the model as follow: #problem.mod #variables var x1 >= 0; var x2 >= 0; #objective maximize z: 3*x1 + 2*x2; #constraints s.t. firstCondition: 2*x1 + 3*x2 <= 14; s.t. secondCondition: 2*x1 + x2 <= 9; end; but when I type :glpsol -m problem.mod -o result the final result is 14.75 but not a interger can you help me? thank you! °Ù Íò Íæ ŒÒ ͬ Íæ µÄ ÀÖ Ô°£¬ÈË Æø ±¬ ·¢ µÄ ÃÎ »Ã Î÷ ÓÎ _______________________________________________ Help-glpk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-glpk
-- Leandro B. Barcelos
_______________________________________________ Help-glpk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-glpk
