[Scip] Elements of a subset

Julio Rojas jcredberry at gmail.com
Mon Sep 26 17:53:00 MEST 2011


Dear all. Stefan Vigerske helped me with the reformulation of a
constraint I had, but latter on I saw that I originally exposed it
badly. I had:

   ax[f] >= max(xf[f]*P[f,c]) - min(xf[f]*P[f.c])

when I reality I need:

forall <c> in C and forall P[f,c]==1:  ax[f] >= max(xf[f]) - min_j(xf[f])

How can I write these constraints in ZIMPL? Until now, I have this:

set F :={1..4};
set C :={1..2};
set FC := F*C;
param xf[F]:= <1> 1.5, <2> 4, <3> 4.5, <4> 1.5;
param yf[F]:= <1> 4,<2> 4,<3> 1.5,<4> 2;
param xc[C]:= <1> 3,<2> 3;
param yc[C]:= <1> 4,<c> 2;
param d[FC] :=
  |    1,    2|
|1| 1.50, 2.50|
|2| 1.00, 2.24|
|3| 2.92, 1.58|
|4| 2.50, 1.50|;
var X[C] binary;
var P[FC] binary;
minimize bs: sum <c> in C: X[c];
subto maxdist:
  forall <f,c> in FC do d[f,c]*P[f,c] <= 2;
subto onlyone:
  forall <f> in F do sum <c> in C: P[f,c]==1;

Thanks.

-------------------------------------------------
Julio Rojas
jcredberry at gmail.com


More information about the Scip mailing list