Please check my code. I have no idea what's wrong with it

Problems with syntax of GAMS
Post Reply
Seoms
User
User
Posts: 2
Joined: 3 years ago

Please check my code. I have no idea what's wrong with it

Post by Seoms » 3 years ago

Hi I'm a newbe of GAMS and I want to figure out optimal solution X1 and X2 (both of them must be integer)
I think it is quite simple problem but I'm struggling with it.
Please find out wrong sentence and give me help.

$TITLE Test Problem
$OFFSYMXREF
$OFFSYMLIST

VARIABLES X1, X2, Z
POSITIVE VARIABLES X1, X2;

EQUATIONS CON1, CON2, CON3, OBJ;
CON1.. 1*(X1) =L= 48;
CON2.. X2 =L= 48;
CON3.. (1-((0.2)**(X1))) + ((0.2)**(X1))*(1-((0.3)**(X2))) =G= 0.99;
OBJ.. Z =E= 1*60*(X1) + ((0.2)**(X1))*(X2)*(20);

X1.L = 0;
X2.L = 0;

MODEL ENGAGEMENT / ALL /;

SOLVE ENGAGEMENT USING RMINLP MINIMIZING Z;

petros.p
User
User
Posts: 10
Joined: 3 years ago

Re: Please check my code. I have no idea what's wrong with it

Post by petros.p » 3 years ago

Hi,

Your problem is a mixed integer non linear program (MINLP). I used Baron to solve it and I think it is free for for a limited number of variables. Run the code below and tell me if it works:

Code: Select all

$TITLE Test Problem
$OFFSYMXREF
$OFFSYMLIST

integer VARIABLES X1, X2   ;
variable Z;


EQUATIONS CON1, CON2, CON3, OBJ;
CON1.. 1*(X1) =L= 48;
CON2.. X2 =L= 48;
CON3.. (1-((0.2)**(X1))) + ((0.2)**(X1))*(1-((0.3)**(X2))) =G= 0.99;
OBJ.. Z =E= 1*60*(X1) + ((0.2)**(X1))*(X2)*(20);

X1.lo = 0;
X2.lo = 0;

MODEL ENGAGEMENT / ALL /;

options MINLP = Baron

SOLVE ENGAGEMENT USING MINLP MINIMIZING Z;
Best,
Petros

Seoms
User
User
Posts: 2
Joined: 3 years ago

Re: Please check my code. I have no idea what's wrong with it

Post by Seoms » 3 years ago

petros.p wrote:
3 years ago
Hi,

Your problem is a mixed integer non linear program (MINLP). I used Baron to solve it and I think it is free for for a limited number of variables. Run the code below and tell me if it works:

Code: Select all

$TITLE Test Problem
$OFFSYMXREF
$OFFSYMLIST

integer VARIABLES X1, X2   ;
variable Z;


EQUATIONS CON1, CON2, CON3, OBJ;
CON1.. 1*(X1) =L= 48;
CON2.. X2 =L= 48;
CON3.. (1-((0.2)**(X1))) + ((0.2)**(X1))*(1-((0.3)**(X2))) =G= 0.99;
OBJ.. Z =E= 1*60*(X1) + ((0.2)**(X1))*(X2)*(20);

X1.lo = 0;
X2.lo = 0;

MODEL ENGAGEMENT / ALL /;

options MINLP = Baron

SOLVE ENGAGEMENT USING MINLP MINIMIZING Z;
Best,
Petros
Thanks petros.p I tried your code but I got same error message.
Exec Error at line 22 : Problem extracting Short path, result contains extended ASCII codes

Aminz
User
User
Posts: 5
Joined: 4 years ago

Re: Please check my code. I have no idea what's wrong with it

Post by Aminz » 1 month ago

Hi Seoms
I have the same problem as well. did you find the solution????

abhosekar
Moderator
Moderator
Posts: 288
Joined: 2 years ago

Re: Please check my code. I have no idea what's wrong with it

Post by abhosekar » 1 month ago

Can you at least show the "full" error message? Provide more useful details (where you are running the model from, version of GAMS, etc.. ).

- Atharv

Post Reply