[SCIP] Can't use "max" in a constraint where "sum" works
Göran Uddeborg
goeran at uddeborg.se
Fri Mar 21 22:41:27 CET 2025
Oh, it's a problem of that kind! Then I was fooled by it being called
a "syntax" error. It would not be called that in languages I'm
otherwise used to.
I've been able to rewrite my original problem, taking some inspiration
from your suggestion. It was fairly easy when I understood what I
needed to change.
Thanks a lot for your explanation!
Marc Pfetsch:
>
>
> This means that what you want cannot currently be expressed using ZIMPL.
> The reason is that this is not a linear expression anymore (in contrast
> to sums).
>
> If your x-variables have upper bounds M, you could reformulate this by
> using additional variables something like this:
>
> var z;
> var y[S] binary;
> subto M1: forall <s> in S: z >= x[s];
> subto M2: forall <s> in S: z <= x[s] + M * (1 - y[s]);
> subto C: sum <s> in S: y[s] == 1;
> ...
>
> I am not saying that this is the best way in your case - the example
> should rather show that you need to work a bit in order be applicable.
>
>
>
> On 17/03/2025 15:57, Göran Uddeborg wrote:
> > Hello!
> >
> > I'm doing my first attempts in using scip (version 9.1.1 on Fedora
> > 41). Some simple test cases for learning the tool went fine, but when
> > I got to my real problem, I don't seem to be able to get the zimpl
> > syntax correct. If I use the "sum" function, scip accepts the code,
> > but if I use "max" in the same place it doesn't. I don't find any
> > explanation in the documentation or FAQs.
> >
> > To illustrate the problem, I've cut down my example to this:
> >
> > set S := { 1..3 };
> > var x[S];
> > subto c:
> > sum <f> in S : x[f] >= 10;
> > minimize m:
> > sum <f> in S : x[f];
> >
> > That above code works, I do get a solution. However if I replace one
> > of the "sum" with "max" it doesn't work any more.
> >
> > set S := { 1..3 };
> > var x[S];
> > subto c:
> > max <f> in S : x[f] >= 10;
> > minimize m:
> > sum <f> in S : x[f];
> >
> > That gives a syntax error.
> >
> > What am I doing wrong? What is it I miss?
> > _______________________________________________
> > Scip mailing list
> > Scip at zib.de
> > https://listserv.zib.de/mailman/listinfo/scip
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> https://listserv.zib.de/mailman/listinfo/scip
More information about the Scip
mailing list