I need help in Math Programming Language in GUSEK

235 views
Skip to first unread message

sahani rathnasiri

unread,
Mar 13, 2020, 7:36:51 AM3/13/20
to AMPL Modeling Language
 I am coding a multi-objective optimization problem in GUSEK. I consider a scenario with multiple players and I have put capacity constraints to select suppliers in the model.

Now I receive this cod error related to that contraintt;
param t;
param r;
param z;

set I := 1 .. t; #periods of time
set J := 1 .. 3; #player
set N := 1 .. r; # no of suppliers
set M := 1 .. z; # no of 3PL operators

param UC{i in I, n in N}; #unit production cost of supplier n in period i
param HC{i in I, n in N}; #inventory holding unit cost of the product supplier n in period i
param II{n in N}; #product supplier's initial inventory
param MCAP{i in I, n in N}; # maximum production capacity for supplier n
param WCAP{i in I, n in N}; #maximum warehouse capacity for supplier n
param VCAP{i in I, m in M};#maximum carrying capacity for 3PL operator m

subject to supplier_selection_constraint{i in I, n in N: i < t and n < r}: (if D[i] < MCAP[i,n] then D[i] <= q[i,n] + (s[i,n]+s[i+1,n])/2) else D[i] - (q[i,n-1]+(s[i,n-1]+s[i+1,1])/2) <= q[i,n] + (s[i,n] + s[i+1,n])/2);


Doc1.docx

AMPL Google Group

unread,
Mar 13, 2020, 3:21:26 PM3/13/20
to AMPL Modeling Language
In AMPL constraints, "then" and "else" need to be followed by arithmetic expressions, not by constraint expressions that have a <= in them. So the syntactically correct way to write this would be

subject to supplier_selection_constraint{i in I, n in N: i < t and n < r}: 
D[i] - (if D[i] < MCAP[i,n] then q[i,n-1]+(s[i,n-1]+s[i+1,1])/2) <= q[i,n] + (s[i,n]+s[i+1,n])/2;

However if D[i] is a variable, then this formulation has a variable in the "if" part, so it will not work with the popular linear solvers.

GUSEK works with GMPL/GNU Mathprog, however, which implements only a limited subset of AMPL (with a few changes) and has completely different error messages. Thus most AMPL advice from this group would not be helpful for you as a GUSEK and GLPK user.


--
Robert Fourer
am...@googlegroups.com
{#HS:1108916845-70335#}

sahani rathnasiri

unread,
Mar 13, 2020, 10:32:27 PM3/13/20
to am...@googlegroups.com
Thank you, Mr Robert Furer, for your response. I have noted the errors.

I saw disjoint constraints can derive a workaround in this situation? Can you elaborate more on that?

Really appreciate your support.

Thank you,

Sahani

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ampl/reply-77152-1108916845-3149179242-1584127280-697544702%40helpscout.net.

AMPL Google Group

unread,
Mar 16, 2020, 12:14:43 PM3/16/20
to AMPL Modeling Language
Do you mean "disjunctive" constraints? Those are constraints that have an "or" operator in them, and so they have all the same issues as constraints that have an "if-then" in them.

If you are using AMPL then I could suggest a way of handling your constraint, but if you are using GLPK then this group is not likely to be of much help.


--
Robert Fourer
am...@googlegroups.com
{#HS:1108916845-70335#}
On Sat, Mar 14, 2020 at 2:32 AM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
Thank you, Mr Robert Furer, for your response. I have noted the errors.

I saw disjoint constraints can derive a workaround in this situation? Can you elaborate more on that?

Really appreciate your support.

Thank you,

Sahani

On Fri, Mar 13, 2020 at 7:20 PM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
In AMPL constraints, "then" and "else" need to be followed by arithmetic expressions, not by constraint expressions that have a <= in them. So the syntactically correct way to write this would be

subject to supplier_selection_constraint{i in I, n in N: i < t and n < r}: 
D[i] - (if D[i] < MCAP[i,n] then q[i,n-1]+(s[i,n-1]+s[i+1,1])/2) <= q[i,n] + (s[i,n]+s[i+1,n])/2;

However if D[i] is a variable, then this formulation has a variable in the "if" part, so it will not work with the popular linear solvers.

GUSEK works with GMPL/GNU Mathprog, however, which implements only a limited subset of AMPL (with a few changes) and has completely different error messages. Thus most AMPL advice from this group would not be helpful for you as a GUSEK and GLPK user.


--
Robert Fourer
am...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages