[Scip] Elements of a subset

Ambros Gleixner gleixner at zib.de
Tue Sep 27 14:52:25 MEST 2011


Dear Julio.

The "with" construct needs a boolean expression which is known at
"compile" time, i.e., may not contain variables.

Have you seen the "vif" keyword which can be used to automatically
generate Big-M formulations, Zimpl manual 4.12?

ambros


Am 27.09.2011 09:53, schrieb Julio Rojas:
> Thx Ambros. One question, would this give me all<f,c>  for which
> P[f,c]==1? P[f,c] is a decision variable, so the number of constraints
> will be constantly changing. I guess this is not possible, is it?
>
> Regards.
> -------------------------------------------------
> Julio Rojas
> jcredberry at gmail.com
>
>
>
> On Mon, Sep 26, 2011 at 8:56 PM, Ambros Gleixner<gleixner at zib.de>  wrote:
>> 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
>> _______________________________________________
>> Scip mailing list
>> Scip at zib.de
>> http://listserv.zib.de/mailman/listinfo/scip
>>


More information about the Scip mailing list