Hi,

I=B4m Braulio Lara. I=B4m a brazilian =
Computer Cientist=20
student and I=B4m working in a Scientific Initiation Research to study=20
possibilities to integrate models, solvers and database in a Model =
Managment=20
System or in portuguese - SGM (Sistema Gerenciador de =
Modelos).

This system can manipulate data and =
models whithout=20
interdependence whith the parts. So I=B4m trying to develop this using =
the GLPK/L=20
as the modeling language and the glpsol as the solver in background. The =
main=20
objective is to extract information of the combination of data, models =
and=20
solvers in an easy way. It=B4s a good tool to Decision Suport=20
Systems.

The problem is that I have to populate =
the data by=20
an Oracle database, fill the model structure and solve it in glpsol. But =
the=20
GLPK/L do not allow to write a model whithout especifying the data to =
instance=20
it. And it=B4s necessary to get model and data independent.

That=B4s why I=B4m writing to you. =
I=B4m thinking about a=20
way to solve this problem: we can indicate the sets and parameters in a =
tag and=20
then in another file we can have all data about the model.

Note that if we do like this, we are =
able to have a=20
lot of instances of the same model with different sorts of data. And the =
model=20
doesn=B4t care about witch amount o data is going to be used to solve =
the=20
problem.

I can implement this in a higher level =
and then a=20
parser can converts the input in glpk/l script. But if I do this I will =
have=20
another script to describe a Model whitout data that isn=B4t glpk/l. And =
it=B4s not=20
interesting to me to develop another modeling language like GLPK/LX =
(GLPK=20
Language Extension).

What do you think about this? Do you =
think it=B4s=20
viable to develop another version of GLPK/L that implements the data =
separated=20
of the model?

See the example below:

/* ----------------- The new GLPK/L = Script=20 ------------------------*/

model transp;

sets I =3D=20
(<<fabricas>>),

J =3D=20 (<<distribuidores>>),

K =3D=20 (<<portos>>);

J =3D=20 (<<distribuidores>>),

K =3D=20 (<<portos>>);

parameters a[I], b[K], c[I,J], =
d[J,K];

variables x[I,J], y[J,K];

constraints supply[I], dem[K], =
trans[J],=20
z;

a[i] :=3D data (i in I:);

b[k] :=3D data (k in K:);

c[i,j] :=3D table (i in I, j in =
J:);

d[j,k] :=3D table (j in J, k in =
K:);

supply[i] :=3D sum (j, x[i,j]) <=3D=20
a[i];

dem[k] :=3D sum (j, y[j,k]) >=3D =
b[k];

trans[j] :=3D sum (i, x[i,j]) =3D sum =
(k,=20
y[j,k]);

z :=3D sum ((i,j), c[i,j] * x[i,j]) + =
sum ((j,k),=20
d[j,k] * y[j,k]);

minimize z;

end;

/* ----------------- The data file = that=20 populate the parameters ----------*/

fabricas =3D (op, ip, ac, =
cf);

distribuidores =3D=20 (co, be, bh);

portos =3D (tu, sa, ga, rj, fl);

distribuidores =3D=20 (co, be, bh);

portos =3D (tu, sa, ga, rj, fl);

a[fabricas] :=3D=20 data:

op 250

ip 350

&nbs= p;ac 100

cf 50);

b[portos] :=3D=20
data:

tu 150

sa 150

&nbs= p;ga 100

rj 200

fl 100);

tu 150

sa 150

&nbs= p;ga 100

rj 200

fl 100);

c[fabricas,distribuidores] :=3D=20
table:

co be bh:

op 3&= nbsp;2 3

ip 4 5 6

ac&nb= sp;7 6 8

cf 4 1 2);

co be bh:

op 3&= nbsp;2 3

ip 4 5 6

ac&nb= sp;7 6 8

cf 4 1 2);

d[distribuidores,portos] :=3D=20
table:

tu sa ga rj fl:

= co 10 12 11 12 10

be 1= 1 10 09 08 12

bh 13 10 = 11 09 13);

tu sa ga rj fl:

= co 10 12 11 12 10

be 1= 1 10 09 08 12

bh 13 10 = 11 09 13);

/* ---------------------- end of data =
file=20
-------------------------------- */

Then after parsing the input, whe = can generate=20 the GLPK/L script:

/* ---------- Original model script=20
--------------------------------------- */

model transp;

sets I =3D (op, ip, ac, =
cf),

J =3D (co,=20 be, bh),

K =3D (tu, sa, ga, rj, fl);

J =3D (co,=20 be, bh),

K =3D (tu, sa, ga, rj, fl);

parameters a[I], b[K], c[I,J], =
d[J,K];

variables x[I,J], y[J,K];

constraints supply[I], dem[K], =
trans[J],=20
z;

a[i] :=3D data (i in=20
I:

op 250

ip 350

a= c 100

cf 50);

op 250

ip 350

a= c 100

cf 50);

b[k] :=3D data (k in=20
K:

tu 150

sa 150

g= a 100

rj 200

fl 100);=

tu 150

sa 150

g= a 100

rj 200

fl 100);=

c[i,j] :=3D table (i in I, j in=20
J:

co be bh:

op 3 = ;2 3

ip 4 5 6

ac 7= 6 8

cf 4 1 2);

co be bh:

op 3 = ;2 3

ip 4 5 6

ac 7= 6 8

cf 4 1 2);

d[j,k] :=3D table (j in J, k in=20
K:

tu sa ga rj fl:

&nbs= p;co 10 12 11 12 10

be 11&nb= sp;10 09 08 12

bh 13 10 11&n= bsp;09 13);

tu sa ga rj fl:

&nbs= p;co 10 12 11 12 10

be 11&nb= sp;10 09 08 12

bh 13 10 11&n= bsp;09 13);

supply[i] :=3D sum (j, x[i,j]) <=3D=20
a[i];

dem[k] :=3D sum (j, y[j,k]) >=3D =
b[k];

trans[j] :=3D sum (i, x[i,j]) =3D sum =
(k,=20
y[j,k]);

z :=3D sum ((i,j), c[i,j] * x[i,j]) + =
sum ((j,k),=20
d[j,k] * y[j,k]);

minimize z;

end;

/*=20 -------------------------------------------------------------------------= --------=20 */

The AMPL language implements things = like this=20 but I prefer to work whith free-software.

Please write me back an sugestion, what =
do you=20
think about this and what can we do to sofisticate the =
GLPK/L.

Thank=B4s for reading my e-mail and =
I=B4m waiting for=20
your reply.

Good Bye,

Braulio Alves Silva Lara

Centro Universit=E1rio Uni-BH

Curso = de Ci=EAncia da=20 Computa=E7=E3o

Programa de Inicia=E7=E3o Cient=EDfica - GPTEX

Belo = Horizonte - Minas=20 Gerais - Brazil

Curso = de Ci=EAncia da=20 Computa=E7=E3o

Programa de Inicia=E7=E3o Cient=EDfica - GPTEX

Belo = Horizonte - Minas=20 Gerais - Brazil