[Scip] Elements of a subset
Ambros Gleixner
gleixner at zib.de
Mon Sep 26 20:56:51 MEST 2011
Dear Julio.
First, you need to use the "with" keyword as described in Section 4.7 of
the Zimpl manual. Something like
forall <f,c> in FC with P[f,c]==1 do
ax[f] >= max(xf[f]) - min_j(xf[f]);
should do.
Second, examples on how to get maximum and minimum values can be found
on page 10 of the Zimpl manual.
Hope that helps,
ambros
Am 26.09.2011 17:53, schrieb Julio Rojas:
> 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
> _______________________________________________
> 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