[Scip] Define parameters in ZIMPL

Julio Rojas jcredberry at gmail.com
Fri May 14 20:18:24 MEST 2010


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.zib.de/mailman/private/scip/attachments/20100514/91c6b8c6/attachment.html


More information about the Scip mailing list