# Integer Programming

 0 How does one solve this kind of problem? Maximize z = x1^2 + x2^2 + x3^2 x1.x2.x3 = 6 x1,x2,x3 all positive integers. In the above, it looks like one can look and find that the answer is 1,1,6(probably) - but how does one solve more complicated problems of this nature? asked 16 May '12, 22:00 Gen 17●2●3●10 accept rate: 0%

 1 One possibility is to use Constraint Programming: http://kti.ms.mff.cuni.cz/~bartak/constraints/ answered 16 May '12, 23:13 Tallys Yunes ♦ 2.1k●5●20 accept rate: 11%
 3 The following approach introduces binary variables as Paul suggested, but you can avoid factoring by taking the log of both sides of your product constraint. And both the objective and constraints are linear here. proc optmodel; num n = 3; num p = 6; set VARS = 1..n; set VALUES = 1..p; var Assign {VARS, VALUES} binary; max Objective = sum {var in VARS, value in VALUES} value^2 * Assign[var,value]; con Assign_var {var in VARS}: sum {value in VALUES} Assign[var,value] = 1; con Product: sum {var in VARS, value in VALUES} log(value) * Assign[var,value] = log(p); impvar Solution {var in VARS} = sum {value in VALUES} value * Assign[var,value]; con Symmetry {var in VARS diff {n}}: Solution[var] >= Solution[var+1]; solve; print solution; quit;  answered 17 May '12, 20:55 Rob Pratt 1.2k●2●6 accept rate: 28%
 2 I don't know that I would recommend it in general, but you could formulate it as a 0-1 integer linear program by factoring the RHS value (I'm assuming just the one constraint) and using binary variables to decide in which original variable (x1, x2, ...) each factor lives. The objective ends up a quadratic function of the binary variables, which can be linearized by introducing more variables. answered 17 May '12, 18:35 Paul Rubin ♦♦ 14.6k●5●13 accept rate: 19%
 toggle preview community wiki

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Tags:

×28
×11
×7