Binbin2lin: Difference between revisions
From TomWiki
Jump to navigationJump to search
(Created page with "==Purpose== Adds constraints when modeling with binary variables which is the product of two other variables. ==Calling Syntax== <syntaxhighlight lang="matlab"> Prob = binbin2...") |
|||
Line 23: | Line 23: | ||
|} | |} | ||
== | ==Outputs== | ||
{| class="wikitable" | {| class="wikitable" | ||
!Output||Description | !Output||Description |
Revision as of 06:22, 22 July 2011
Purpose
Adds constraints when modeling with binary variables which is the product of two other variables.
Calling Syntax
Prob = binbin2lin(Prob, idx4, idx1, idx2, idx3)
Inputs
Prob | Problem structure to be converted. |
---|---|
idx4 | Indices for b4 variables. |
idx1 | Indices for b1 variables. |
idx2 | Indices for b2 variables. |
idx3 | Indices for b3 variables. |
Outputs
Output | Description |
---|---|
Prob | Problem structure with added constraints. |
Description
b4 = b1 * b2. The problem should be built with the extra variable b4 in place of the b1*b2 products.
The indices of the unique product variables are needed to convert the problem properly.
Three inequalities are added to the problem:
b4 <= b1
b4 <= b2
b4 >= b1 + b2 - 1
By adding this b4 will always be the product of b1 and b2.
The routine also handles products of three binary variables. b4 = b1 * b2 * b3. The following
constraints are then added:
b4 <= b1
b4 <= b2
b4 <= b3
b4 >= b1 + b2 + b3 - 1