Bincont2lin: Difference between revisions

From TomWiki
Jump to navigationJump to search
(Created page with "==Purpose== Adds constraints when modeling with binary variables which are multiplied by integer or continuous variables. This is the most efficient way to get rid off quadra...")
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Utility Functions]]
==Purpose==
==Purpose==


Line 7: Line 8:
==Calling  Syntax==
==Calling  Syntax==


<syntaxhighlight lang="matlab">
<source lang="matlab">
Prob = bincont2lin(Prob, idx_prod, idx bin, idx cont)
Prob = bincont2lin(Prob, idx_prod, idx_bin, idx_cont)
</syntaxhighlight>
</source>


==Inputs==
==Inputs==

Latest revision as of 08:14, 10 January 2012

Purpose

Adds constraints when modeling with binary variables which are multiplied by integer or continuous variables.

This is the most efficient way to get rid off quadratic objectives or constraints.

Calling Syntax

Prob = bincont2lin(Prob, idx_prod, idx_bin, idx_cont)

Inputs

Prob Problem structure to be converted.
idx_prod Indices for product variables.
idx_bin Indices for binary variables.
idx_cont Indices for continuous/integer variables.

Outputs

Output Description
Prob Problem structure with added constraints.

Description

prod = bin * cont. The problem should be built with the extra variables prod in place of the bin * cont products.

The indices of the unique product variables are needed to convert the problem properly.

Three inequalities are added to the problem:

prod <= cont

prod >= cont - xU * (1 - bin)

prod <= xU * bin

By adding this prod will always equal bin * cont.