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;

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

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

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:

Best,

Petros

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;
```

Petros

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

Thanks petros.p I tried your code but I got same error message.petros.p wrote: ↑3 years agoHi,

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:

Best,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;`

Petros

Exec Error at line 22 : Problem extracting Short path, result contains extended ASCII codes

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

Hi Seoms

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

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

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

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

- Atharv