[Scip] Define parameters in ZIMPL
Thorsten Koch
koch at zib.de
Sat May 15 15:35:42 MEST 2010
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
______________________________________________________________________
More information about the Scip
mailing list