[Scip] Constraints which involve two variables

Ambros Gleixner gleixner at zib.de
Thu Apr 22 15:36:26 MEST 2010


Hi Marty,

to have

> z[i][l][j][h] <= w[i][j]
> z[i][l][j][h] <= w[l][h]
> z[i][l][j][h] >= w[i][j] + w[l][h] -1

in form of a linear constraint, you need to rewrite it as

> -SCIPinfinity(scip) <= z[i][l][j][h] - w[i][j] <= 0
> -SCIPinfinity(scip) <= z[i][l][j][h] - w[l][h] <= 0
> -1 <= z[i][l][j][h] - w[i][j] - w[l][h] <= SCIPinfinity(scip)

Then you can use SCIPcreateConsLinear.

For the first two constraints you could alternatively create a so called
"variable bound constraint" with SCIPcreateConsVarbound.  See the
documentation for more details.  (Since SCIP will detect this structure
automatically, it is perfectly ok to use SCIPcreateConsLinear, though.)

ambros



Am 22.04.2010 15:21, schrieb Martina Astegno:
> Hi all!
> 
> I'm modelling a clustering problem and it requires to use a binary
> variable for each element and for each cluster. w[i][j] = 1 if
> element i is in cluster j; 0 otherwise.
> 
> I have to define another binary variable, z[i][l][j][h], that is
> equal to 1 if (w[i][j] and w[l][h]) = 1; 0 otherwise.
> 
> AND logic operator is implemented introducing 3 new constraints in
> the problem: z[i][l][j][h] <= w[i][j] z[i][l][j][h] <= w[l][h] 
> z[i][l][j][h] >= w[i][j] + w[l][h] -1
> 
> So, when I have to create the solver, to define the constraint on z
> variable, in function SCIPcreateConsLinear(), I don't know how to fix
> the lb/ub equal to the value of the w variable, because it's
> SCIP_VAR* type. It's possible to know the value associated to a
> variable with the function SCIPgetSolVal() only after solve method
> and not during the solver  construction.
> 
> Any idea what's going on?
> 
> 
> Thanks!
> 
> Marty
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> http://listserv.zib.de/mailman/listinfo/scip

-- 
____________________________________________________________
Ambros M. Gleixner
Zuse Institute Berlin - Matheon - Berlin Mathematical School
http://www.zib.de/gleixner


More information about the Scip mailing list