[Scip] Define parameters in ZIMPL

Julio Rojas jcredberry at gmail.com
Sat May 15 16:38:32 MEST 2010


Dear Thorsten, I have followed your advice and changed my code to:

param s[<i,j> in e2] := ord(p,j in {1..card(p)},1) default 0;

Now, the error changed to:

Reading problem.zpl
*** Error 800: File problem.zpl Line 7 : syntax error, unexpected IN,
expecting
',' or '+' or '-'
*** aram s[<i,j> in e2] := ord(p,k in {1..card(p)},1) default 0;
***                                 ^^^

Any other idea? Am I forcing things and should stick to define the
parameters by hand from my program (two loops)?

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


On Sat, May 15, 2010 at 3:35 PM, Thorsten Koch <koch at zib.de> wrote:

> Dear Julio,
>
> you can not access a member of a set (p) by use of [].
> if you do p[] you try to access an array of sets (which is not defined
> in this case)
> You can access a member of a set using the ord() function.
>
> Furthermore, a parameter is always only a single value.
>
> Here
> > param s[<i,j> in e2] := p[i in {1..card(p)}] default 0;
>                             ^
>                       This i
> is equal to the i from <i,j>.
> The expression on the right hand side is not depending on j.
> In any case it should read p[<i> in ...  but this won't work either.
>
> But I believe ord() will do what you need.
>
> Best regards,
> Thorsten
>
>
> param s[<i,j> in e2] := ord(p([i in {1..card(p)}] default 0;
>
> Am 14.05.2010 20:18, schrieb Julio Rojas:
> > Dear Armin and Ambros, not really. I'll like to put the k-th element of
> the
> > set p in the <i,j>-th position of the parameter matrix s. I have already
> > defined e2 (but didn't put it in my previous email) and I wouldn't like
> to
> > create the matrix of parameters one by one as it is stated in the manual.
> > The matrix s is a triangular matrix with zeros in the diagonal (in
> reality
> > is a distance matrix). I would like to fill each element of the matrix
> from
> > a set. This way I will not have to make a double loop in my code to
> define
> > each element <i,j> with i<j. This is the code I already have:
> >
> > set nodes := {"1","2","3"};
> > set e2 := {<i,j> in nodes*nodes with i<j};
> > set p := {.1,.2,.3};
> > var y[<i,j> in e2] binary;
> > var x[<i> in nodes] binary;
> > param s[<i,j> in e2] := p[i in {1..card(p)}] default 0;
> > maximize sim: sum<i,j> in e2: s[i,j]*y[i,j];
> >
> > Best regards.
> > -------------------------------------------------
> > Julio Rojas
> > jcredberry at gmail.com
> >
> >
> > 2010/5/14 Armin Fügenschuh <fuegenschuh at zib.de>
> >
> >> Dear Julio,
> >>
> >> is this the thing you're trying to do?
> >>
> >> set p := {.1,.2,.3};
> >> set e2 := p*p;
> >> param s[<i,j> in e2] := j;
> >> var y[e2] real;
> >> maximize sim: sum<i,j> in e2: s[i,j]*y[i,j];
> >>
> >>
> >> Regards,
> >> Armin
> >>
> >>
> >> 2010/5/14 Julio Rojas <jcredberry at gmail.com>
> >>
> >>> Dear all, I would like to define the matrix of parameters from a set. I
> >>> have tried with the following:
> >>>
> >>> set p := {.1,.2,.3};
> >>> param s[<i,j> in e2] := p[i in {1..card(p)}] default 0;
> >>> maximize sim: sum<i,j> in e2: s[i,j]*y[i,j];
> >>>
> >>> The following message appears:
> >>>
> >>> *** Error 800: File problem.zpl Line 7 : syntax error, unexpected
> SETSYM
> >>> *** param s[<i,j> in e2] := p[<i> in {1..card(p)}] default 0;
> >>> ***                         ^^^
> >>>
> >>> Is there a way to do this? Thanks in advance.
> >>> -------------------------------------------------
> >>> Julio Rojas
> >>> jcredberry at gmail.com
> >>>
> >>>
> >>> _______________________________________________
> >>> Scip mailing list
> >>> Scip at zib.de
> >>> http://listserv.zib.de/mailman/listinfo/scip
> >>>
> >>>
> >>
> >>
> >> --
> >>
> >> Dr. Armin Fügenschuh
> >>
> >> Konrad-Zuse-Zentrum für
> >> Informationstechnik Berlin (ZIB)
> >>
> >> Division Scientific Computing
> >> Department Optimization
> >>
> >> Takustrasse 7
> >> 14195 Berlin
> >>
> >> Tel. : +49 (0)30 84185-205
> >> Fax: +49 (0)30 84185-269
> >> email: fuegenschuh at zib.de
> >>
> >>
> >
> >
> >
> > _______________________________________________
> > Scip mailing list
> > Scip at zib.de
> > http://listserv.zib.de/mailman/listinfo/scip
>
> --
> The important thing is not to stop questioning.
> Curiosity has its own reason for existing.          -- Albert Einstein
> ______________________________________________________________________
> Dr. Thorsten Koch / Konrad-Zuse-Zentrum für Informationstechnik Berlin
> www.zib.de/koch  /          Takustraße 7, 14195 Berlin-Dahlem, Germany
> koch at zib.de     /                     Phone +49-30-84185-213, Fax -269
> _______________/  DFG Research Center "Matheon"  http://www.matheon.de
>
> Kooperativer Bibliotheksverbund Berlin Brandenburg  http://www.kobv.de
> ______________________________________________________________________
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.zib.de/mailman/private/scip/attachments/20100515/2496ee3c/attachment.html


More information about the Scip mailing list