Using Funtion Variable in abs()

SETS
g gemiler /0003414521/
i iskele /0201,0202,0203,0204,0205,0206,0207,0208/;
PARAMETERS
Eta(g) /
0003414521 623 /
Tbj(g) /
0003414521 343 /
Pri(g) /
0003414521 1 /
Tisk(i) /
0201 5100
0202 5100
0203 5100
0204 5100
0205 5100
0206 5100
0207 5100
0208 5100 /;

VARIABLE
TOTALCOST TOTAL COST
POSITIVE VARIABLE
Tj(g)
;
BINARY VARIABLE
X(g,i) MODE m OF ASSET i AT TIME t
;
EQUATION
Limit1(g)
Limit2(g,i)
TekIskele(g)
COST_EQ
IskeleTakvim0(g,i)

Iskele00034145210(g,i)
Iskele00034145211(g,i)
Iskele00034145212(g,i)
Iskele00034145213(g,i)
Iskele00034145214(g,i)
Iskele00034145215(g,i)

;

Limit1(g)… Eta(g) =L= Tj(g);
Limit2(g,i)… abs(Tj(g) - 5100) + abs(Tj(g) - 4100)) =G= 5100 - 4100; // i need this functionality but using Tj(g) is causing error
TekIskele(g)… SUM(i,X(g,i)) =E= 1;
COST_EQ… TOTALCOST =E= SUM(g, Tj(g)Pri(g));
IskeleTakvim0(g,i)… (Tj(g) + Tbj(g) - Tj(g-1) + 120)
(Tj(g-1) + Tbj(g-1) - Tj(g) + 120) =L= 74649600 * (2 - X(g,i) - X(g-1,i));

Iskele00034145210(g,i)… X(‘0003414521’,‘0201’) =E= 0;
Iskele00034145211(g,i)… X(‘0003414521’,‘0202’) =E= 0;
Iskele00034145212(g,i)… X(‘0003414521’,‘0203’) =E= 0;
Iskele00034145213(g,i)… X(‘0003414521’,‘0206’) =E= 0;
Iskele00034145214(g,i)… X(‘0003414521’,‘0207’) =E= 0;
Iskele00034145215(g,i)… X(‘0003414521’,‘0208’) =E= 0;


option optcr = 0;
option MIQCP=baron;
MODEL KDS /ALL/;
SOLVE KDS USING MIQCP MINIMAZING TOTALCOST;


\


the output of red labeled line is:

Limit2(0003414521,0201)… - (2)*Tj(0003414521) =G= 1000 ; (LHS = 9200)

so abs functionality not working for this scenario.


thanks for help.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Ibrahim: Quickly, you have a syntax error (not matched parenthesis):

abs(Tj(g) - 5100) + abs(Tj(g) - 4100)) =G= 5100 - 4100;

should probably be

abs(Tj(g) - 5100) + abs(Tj(g) - 4100) =G= 5100 - 4100;

The solver still complains, but I’ve never run this specific model type.

Regards
Claudio

On Wed, Feb 17, 2016 at 12:50 PM, Ibrahim Yilmaz wrote:

SETS
g gemiler /0003414521/
i iskele /0201,0202,0203,0204,0205,0206,0207,0208/;
PARAMETERS
Eta(g) /
0003414521 623 /
Tbj(g) /
0003414521 343 /
Pri(g) /
0003414521 1 /
Tisk(i) /
0201 5100
0202 5100
0203 5100
0204 5100
0205 5100
0206 5100
0207 5100
0208 5100 /;

VARIABLE
TOTALCOST TOTAL COST
POSITIVE VARIABLE
Tj(g)
;
BINARY VARIABLE
X(g,i) MODE m OF ASSET i AT TIME t
;
EQUATION
Limit1(g)
Limit2(g,i)
TekIskele(g)
COST_EQ
IskeleTakvim0(g,i)

Iskele00034145210(g,i)
Iskele00034145211(g,i)
Iskele00034145212(g,i)
Iskele00034145213(g,i)
Iskele00034145214(g,i)
Iskele00034145215(g,i)

;

Limit1(g)… Eta(g) =L= Tj(g);
Limit2(g,i)… abs(Tj(g) - 5100) + abs(Tj(g) - 4100)) =G= 5100 - 4100; // i need this functionality but using Tj(g) is causing error
TekIskele(g)… SUM(i,X(g,i)) =E= 1;
COST_EQ… TOTALCOST =E= SUM(g, Tj(g)Pri(g));
IskeleTakvim0(g,i)… (Tj(g) + Tbj(g) - Tj(g-1) + 120)
(Tj(g-1) + Tbj(g-1) - Tj(g) + 120) =L= 74649600 * (2 - X(g,i) - X(g-1,i));

Iskele00034145210(g,i)… X(‘0003414521’,‘0201’) =E= 0;
Iskele00034145211(g,i)… X(‘0003414521’,‘0202’) =E= 0;
Iskele00034145212(g,i)… X(‘0003414521’,‘0203’) =E= 0;
Iskele00034145213(g,i)… X(‘0003414521’,‘0206’) =E= 0;
Iskele00034145214(g,i)… X(‘0003414521’,‘0207’) =E= 0;
Iskele00034145215(g,i)… X(‘0003414521’,‘0208’) =E= 0;


option optcr = 0;
option MIQCP=baron;
MODEL KDS /ALL/;
SOLVE KDS USING MIQCP MINIMAZING TOTALCOST;


\


the output of red labeled line is:

Limit2(0003414521,0201)… - (2)*Tj(0003414521) =G= 1000 ; (LHS = 9200)

so abs functionality not working for this scenario.


thanks for help.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

A model with the abs() function with endogenous variables as arguments is not a MIQCP, it is an MINLP. If you change your solve statement to “SOLVE KDS USING MINLP MINIMAZING TOTALCOST;” and the solver selection “option MINLP=baron;” it all works.

Hope this helps,
Michael Bussieck - GAMSWorld Coordinator

On Wednesday, February 17, 2016 at 12:20:21 PM UTC-5, Claudio Delpino wrote:

Ibrahim: Quickly, you have a syntax error (not matched parenthesis):

abs(Tj(g) - 5100) + abs(Tj(g) - 4100)) =G= 5100 - 4100;

should probably be

abs(Tj(g) - 5100) + abs(Tj(g) - 4100) =G= 5100 - 4100;

The solver still complains, but I’ve never run this specific model type.

Regards
Claudio

On Wed, Feb 17, 2016 at 12:50 PM, Ibrahim Yilmaz wrote:

SETS
g gemiler /0003414521/
i iskele /0201,0202,0203,0204,0205,0206,0207,0208/;
PARAMETERS
Eta(g) /
0003414521 623 /
Tbj(g) /
0003414521 343 /
Pri(g) /
0003414521 1 /
Tisk(i) /
0201 5100
0202 5100
0203 5100
0204 5100
0205 5100
0206 5100
0207 5100
0208 5100 /;

VARIABLE
TOTALCOST TOTAL COST
POSITIVE VARIABLE
Tj(g)
;
BINARY VARIABLE
X(g,i) MODE m OF ASSET i AT TIME t
;
EQUATION
Limit1(g)
Limit2(g,i)
TekIskele(g)
COST_EQ
IskeleTakvim0(g,i)

Iskele00034145210(g,i)
Iskele00034145211(g,i)
Iskele00034145212(g,i)
Iskele00034145213(g,i)
Iskele00034145214(g,i)
Iskele00034145215(g,i)

;

Limit1(g)… Eta(g) =L= Tj(g);
Limit2(g,i)… abs(Tj(g) - 5100) + abs(Tj(g) - 4100)) =G= 5100 - 4100; // i need this functionality but using Tj(g) is causing error
TekIskele(g)… SUM(i,X(g,i)) =E= 1;
COST_EQ… TOTALCOST =E= SUM(g, Tj(g)Pri(g));
IskeleTakvim0(g,i)… (Tj(g) + Tbj(g) - Tj(g-1) + 120)
(Tj(g-1) + Tbj(g-1) - Tj(g) + 120) =L= 74649600 * (2 - X(g,i) - X(g-1,i));

Iskele00034145210(g,i)… X(‘0003414521’,‘0201’) =E= 0;
Iskele00034145211(g,i)… X(‘0003414521’,‘0202’) =E= 0;
Iskele00034145212(g,i)… X(‘0003414521’,‘0203’) =E= 0;
Iskele00034145213(g,i)… X(‘0003414521’,‘0206’) =E= 0;
Iskele00034145214(g,i)… X(‘0003414521’,‘0207’) =E= 0;
Iskele00034145215(g,i)… X(‘0003414521’,‘0208’) =E= 0;


option optcr = 0;
option MIQCP=baron;
MODEL KDS /ALL/;
SOLVE KDS USING MIQCP MINIMAZING TOTALCOST;


\


the output of red labeled line is:

Limit2(0003414521,0201)… - (2)*Tj(0003414521) =G= 1000 ; (LHS = 9200)

so abs functionality not working for this scenario.


thanks for help.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

@Michael Bussieck thanks, it works.


Can i use “or” with MINLP? Something like:

abs(Tj(g) - 5100) + abs(Tj(g) - 4100)) =G= 200 OR abs(Tj(g) - 5100) + abs(Tj(g) - 4100)) =L= 3600 ;


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.