Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes this is an integer programming problem. You can write it as:</p> <pre><code> minimize |x1 - x2| + |x2 - x3| + ... + |xn-1 - xn| subject to x1 + x2 + x3 + ... + xn == c, xi == Ai1*yi1 + Ai2*yi2 + ... + Aip*yip, i=1,...,n, yi1 + yi2 + ... + yip == 1, i=1,...,n, yij binary for i=1,...,n j=1,...,p, xi integer for i=1,...,n, </code></pre> <p>here the Aij are known input data that describe what integers a particular value of xi may take on. Below is a concrete example with 3 variables (n=3), where each xi can take on one of two integer values (p=2). That is x1 can be 1 or 3, x2 can be 3 or 4, x3 can be 2 or 3.</p> <pre><code> minimize |x1 - x2| + |x2 - x3| subject to x1 + x2 + x3 == 8, x1 == 1*y11 + 3*y12, x2 == 3*y21 + 4*y22, x3 == 2*y31 + 3*y32, y11 + y12 == 1, y21 + y22 == 1, y31 + y32 == 1, yij binary i=1,2,3 j=1,2 xi integer i=1,2,3 </code></pre> <p>You can reformulate the above problem as a MIP (a mixed integer program) by creating a new set of variables u to represent the objective function.</p> <pre><code> minimize u1 + u2 + ... + un subject to ui &gt;= xi - xi+1, i=1,...,n-1, ui &gt;= xi+1 - xi, i=1,...,n-1, x1 + x2 + x3 + ... + xn == c, xi == Ai1*yi1 + Ai2*yi2 + ... + Aip*yip, i=1,...,n, yi1 + yi2 + ... + yip == 1, i=1,...,n, yij binary for i=1,...,n j=1,...,p, xi integer for i=1,...,n, ui real for i=1,...,n-1, </code></pre> <p>You can use any standard <a href="http://en.wikipedia.org/wiki/Mixed_integer_programming#Solvers_and_scripting_.28programming.29_languages" rel="nofollow">MIP solver</a> to solve the above problem.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload