Reputation: 11
I am using SCIP Optimization Suite 3.0.2 to in my c++ code to implement a scheduler and I would like to ask you what is the best way to implement constraint such as:
t_i*p + d*p + t_i <=0
where t_i
is a continous variable, p
is a binary variable, d
is a constant. I found the overview of all supported type of constraints: scip constraints and I somehow implemented my problem as a hierarchy of more linear constraints and conjunctions and disjunctions between them, but I have a suspicious that makes the search for a solution hard. Thus, I am interested if there is some more straightforward way, especially for multiplying of two variables.
Upvotes: 1
Views: 584
Reputation: 1375
Considering the constraint that you mentioned, there even is a linear formulation, at least if t_i
is bounded to be nonnegative:
Since p
is supposed to be binary, it breaks down to either
p = 0
=> t_i
<= 0, forcing t_i
to 0 because of nonnegativity assumed abovep = 1
=> 2 * t_i
<= -d
You can fold this into a single linear constraint, in which p
is basically imposing an upper bound on t_i
:
t_i + d / 2 * p <= 0
Using SCIP's callable library, you can directly create this constraint as a varbound constraint.
Upvotes: 2
Reputation: 21
You can formulate this as a quadratic constraint. See the "Callable library" example,
http://scip.zib.de/doc/examples/CallableLibrary/
in particalur the file string.c, for an example of how to implement this using the callable library, and the general documentation
http://scip.zib.de/doc/html/cons__quadratic_8h.php#ad3707e7f7166bea83b7713cf2e52b0db
Have fun, ambros
Upvotes: 2