Error 63 y Error 256

Problems with syntax of GAMS
Post Reply
danielm2193
User
User
Posts: 1
Joined: 1 month ago

Error 63 y Error 256

Post by danielm2193 » 1 month ago

Hola, estoy tratando de correr este código pero se me presentan lo errores 63 y 256, agradezco su ayuda!

*Modelo Practica ING V
Sets
i Rutas posibles del punto A al punto B /1*7/
j Obstaculos presentes en la ruta i /1*12/
p Conjunto de funciones objetivas /1,2/ ;

Parameters
Cost(j) Costo de eliminar el obstaculo j
/

1 17680
2 45480
3 45480
4 58110
5 10100
6 17680
7 17680
8 10100
9 5050
10 5050
11 5000
12 10000
/
Areaob(j) Area de cada tipo de obstaculo j
/
1 2.54
2 15.38
3 0.34
4 0.17
5 0.3
6 2
7 0.78
8 1.39
9 2.78
10 1
11 3.2
12 0.41
/
Areato(i) Area total caminable de la ruta i
/
1 4355.585
2 1586.155
3 3442.455
4 4594.005
5 4423.215
6 5496.6746
7 2813.43
/

Costpre Costo presupuestado para obra de remocion
/
50000000
/

Areaper(i) Area permitida para el peaton
/
1 2351.549333
2 966.7833333
3 2609.618333
4 3665.581667
5 4103.780667
6 4280.356467
7 2316.142667
/

Table CantOb(i,j) Area de obstaculos j en la ruta posible i

1 2 3 4 5 6 7 8 9 10 11 12
1 0 5 1 0 2 0 2 1 1 1 1 15
2 2 5 0 1 2 0 1 1 0 1 0 7
3 10 5 1 0 2 3 18 1 2 1 0 2
4 10 8 1 0 1 3 17 0 1 0 0 2
5 10 5 2 1 0 9 27 0 4 0 1 3
6 1 5 2 0 2 0 0 0 0 3 2 3
7 4 5 0 1 1 0 1 1 0 1 0 0


;
parameter fun(p);
loop(p,
fun(p) = uniform(0,1);
);

Variable
zfinal Funcion Objetivo


binary variable
y(i,j) 1 si se elimina el obstaculo j en la ruta i y 0 si no se elimina el obstaculo j en la ruta i
x(i) 1 si habilita la ruta i y 0 si no habilita la ruta i
;
free variable
z1
z2
zfinal
;

equations
*Obj funcion objetivo1
*Obj2 funcion objetivo2
ObjFinal funcion objetivo final
R2 sumatoria de costos por obstaculos a quitar no puede superar el presupuesto
R3(i) sumatoria del area total de la ruta debe ser mayor al area permitida para el peaton
R4 selecciona la ruta
R5(i,j) selecciona la ruta
;

*Obj.. z1=e= sum(i,x(i)*Areaper(i))+sum((i,j),y(i,j)*Areaob(j)*CantOb(i,j));
*Obj2.. z2=e= sum((i,j),y(i,j)*Cost(j));
ObjFinal.. zfinal=e=((0.0002936*(uniform(0,1)-967))+(0.00000404*(uniform(0,1)-0)))*((sum(i,x(i)*Areaper(i))+sum((i,j),y(i,j)*Areaob(j)*CantOb(i,j)))+(sum((i,j),y(i,j)*Cost(j))));

R2..sum((i,j),Cost(j)*y(i,j))=l=Costpre;
R3(i).. x(i)*Areaper(i)+sum(j,y(i,j)*Areaob(j)*CantOb(i,j))=l=Areato(i);
R4.. sum(i,x(i))=e=1;
R5(i,j).. y(i,j)=l=x(i);

model Practica/all/;
solve Practica using MIP maximizing zfinal;

User avatar
Renger
Posts: 378
Joined: 3 years ago

Re: Error 63 y Error 256

Post by Renger » 1 month ago

Hi
A few remarks:
  • The chance getting an answer is higher if you post your question in English.
  • If you submit your model, please attach it (or enter it as code), so the formatting remains as it is. If you don't, people willing to answer your question may lose a lot of time reformatting your code.
Now your question: Gams states in the explanation that you can't use uniform in an equation. Here you can find more information on what is allowed in equations.
The way to solve this in your case is to define a parameter and assign it a uniform value and replace the uniform in your objective values by this parameter:

Code: Select all

parameter puni 'Uniform value';

puni = uniform(0,1);
...

ObjFinal.. zfinal=e=((0.0002936*(puni-967))
CHeers
Renger
____________________________________
Enjoy modeling even more: The lazy economist

Post Reply