help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] glpsol string parameters


From: Andrew Makhorin
Subject: Re: [Help-glpk] glpsol string parameters
Date: Tue, 27 Mar 2007 10:18:31 +0400

> Hello, I am working on a Dial a ride problem (DARP), and would be very
> grateful if somebody could give a hint to, what I am doing wrong.
> 
> 
> a little sample of my model looks like this:
> 
> ------------------------------------------------------------------
> set I;
> set J;
> 
> param matrice {I, J} integer, >= 0;
> param kunder {1..1, 1..2};
> 
> var x1 integer, >=0;
> 
> maximize objekt: x1;
> 
> s.t. test: x1 <= matrice[kunder[1,1], kunder[1,2]];
> 
> data;
> 
> set I := aab tirstrup;
> set J := herning silkeborg aarhus skjern kolding;
> 
> param matrice (tr):
>                                  aab    tirstrup:=
>         herning  150    100
>         silkeborg   120    60
>         aarhus   110    25
>         skjern   200    150
>         kolding  220    125;
>         
> param kunder:
>                 1:=
> 1               aab
> 2               skjern;
> 
> 
> end;
> ---------------------------------------------------------
> 
> This little test worked great with matrice["aab", "skjern"] when
> plotted in directly. The problem arose when I tried to implement the
> parameter "kunder", which should contain all the customers and their
> origin with the value 1 and destination with the value 2. What I
> thought would happen is when i call kunder[1,1] I would get origin of
> customer 1 = "aab", and kunder[1,2] would get me the destination of
> customer 2 = "skjern".
> 
> I have tried to fix this with param kunder symbolic in "a set", but I
> did not seem to work. I also tried to set " and ' around the string
> parameters, but it didn't work either.

Since values assigned to `kunder' are non-numeric quantities, it
should be declared as symbolic, i.e.

param kunder {1..1, 1..2}, symbolic;

Besides, in the data section you specified kunder[1,1] and kunder[2,1]
(rather than kunder[1,2]) that causes an error on generating the model.

> 
> While I am at this, is there any explanation for the (tr) I found it
> in an online model somewhere, but documentation is pretty sparse on
> this area.

You need to read the GNU MathProg language reference included in the
glpk distribution (in dvi and ps format).







reply via email to

[Prev in Thread] Current Thread [Next in Thread]