Need HELP in finding the model flaws! PLEASE!!

40 views
Skip to first unread message

Amir Lm

unread,
Jun 23, 2016, 7:28:29 PM6/23/16
to AMPL Modeling Language
Hi everyone,

I have developed a robust optimization model that doesn't work properly.
I wonder if anyone can have a look and let me know where the flaws are located that prevents the model from functioning properly.
The major issue is with obtaining the model robustness.
When the parameter "Omega" is set to ZERO, means there is no penalty for violating (not satisfying) the second stage constraints. The variable "f" represents the infeasibility of the second stage constraint which is the demand constraints in the model.
With that being said, if the demand constraint can not be satisfied using the existing resources, "f" should get some value under "Omega=0", however, for some unknown reason, I could not get that result!
I understand you might have your own busy schedule, but I am in desperate need of help. So, give me some thoughts!
I would be greatly appreciated your comments/thoughts.

Thank you in advance for your help!
Amir
----------------------------------------------------------------------------------
set room;
set specialty;
set day;
set scenario;

param O > 0;
param S > 0;
param T > 0;
param Eps > 0;

param h > 0;
param a {i in 1..O} > 0;
param k {s in 1..S, t in 1..T} >= 0;
param c1 {t in 1..T, z in 1..T} >= 0;
param c2 >= 0;
param c3 >= 0;
param Lamda >= 0;
param Omega >= 0;

param e {s in 1..S, t in 1..T, eps in 1..Eps} >= 0;
param g {s in 1..S, t in 1..T, eps in 1..Eps} >= 0;
param Pi {eps in 1 ..Eps} >= 0, <= 1;

var X {i in 1..O, s in 1..S, t in 1..T} >= 0, integer;
var U {s in 1..S, t in 1..T} >= 0;
var Y {s in 1..S, t in 1..T, z in 1..T} >= 0;
var Rho {s in 1..S, t in 1..T, eps in 1..Eps} >= 0;
var Iota {s in 1..S, t in 1..T, eps in 1..Eps} >= 0;
var FC >= 0;
var SC >= 0;
var d {eps in 1 ..Eps};
var Teta {eps in 1..Eps} >= 0;
var f {s in 1..S, t in 1..T, eps in 1..Eps};
var Gama {s in 1..S, t in 1..T, eps in 1..Eps} >= 0;

minimize P_tradeoff:
FC + SC + Lamda * sum {eps in 1..Eps} Pi[eps] * (d[eps] + 2 * Teta[eps]) + Omega * sum {s in 1..S} sum {t in 1..T} sum {eps in 1..Eps} Pi[eps] * (f[s,t,eps] + 2 * Gama[s,t,eps]);

subject to Eq4_01:
FC = sum {t in 1..T} sum {z in 1..T} (c1[t,z] * sum {s in 1..S} Y[s,t,z]);

subject to Eq4_02:
SC = sum {s in 1..S} sum {t in 1..T} sum {eps in 1..Eps} Pi[eps] * (c2 *  Rho[s,t,eps] + c3 * Iota[s,t,eps]);

subject to Eq4_03 {eps in 1..Eps}:
d[eps] = sum {s in 1..S} sum {t in 1..T} (c2 * Rho[s,t,eps] + c3 * Iota[s,t,eps]) - sum {s in 1..S} sum {t in 1..T} sum {eps1 in 1..Eps} Pi[eps1] * (c2 * Rho[s,t,eps1] + c3 * Iota[s,t,eps1]);

subject to Eq4_04 {s in 1..S, t in 1..T, eps in 1..Eps}:
f[s,t,eps] = e[s,t,eps] - h * sum {i in 1..O} X[i,s,t] + g[s,t,eps] - U[s,t] + sum {z in 1..T} Y[s,z,t] - sum {z in 1..T} Y[s,t,z] - Rho[s,t,eps] + Iota[s,t,eps];

subject to Eq4_2 {i in 1..O, t in 1..T}:
sum {s in 1..S} X[i,s,t] = a[i];

subject to Eq4_3 {t in 1..T}:
sum {s in 1..S} U[s,t] <= h;

subject to Eq4_4 {s in 1..S, t in 1..T}:
sum {i in 1..O} X[i,s,t] <= k[s,t];

subject to Eq4_5 {s in 1..S, t in 1..T, eps in 1..Eps}:
U[s,t] <= g[s,t,eps];

subject to Eq4_6 {s in 1..S, t in 1..T, eps in 1..Eps}:
sum {z in 1..T} Y[s,t,z] <= e[s,t,eps];

subject to Eq4_7 {s in 1..S, t in 1..T, eps in 1..Eps}:
Rho[s,t,eps] <= e[s,t,eps];

subject to Eq4_8 {s in 1..S, t in 1..T, eps in 1..Eps}:
Iota[s,t,eps] <= h;

subject to Eq4_15 {s in 1..S, t in 1..T, eps in 1..Eps}:
h * sum {i in 1..O} X[i,s,t] >= g[s,t,eps] - U[s,t] + sum {z in 1..T} Y[s,z,t];

subject to Eq4_16 {s in 1..S, t in 1..T, eps in 1..Eps}:
e[s,t,eps] = h * sum {i in 1..O} X[i,s,t] - g[s,t,eps] + U[s,t] - sum {z in 1..T} Y[s,z,t] + sum {z in 1..T} Y[s,t,z] + Rho[s,t,eps] - Iota[s,t,eps];

subject to Eq4_18 {eps in 1..Eps}:
d[eps] + Teta[eps] >= 0;

subject to Eq4_20 {s in 1..S, t in 1..T, eps in 1..Eps}:
f[s,t,eps] + Gama[s,t,eps] >= 0;
---------------------------------------------------------------------------------------------------------------------------------------------------------
data;
param O = 2;
param S = 6;
param T = 5;
param Eps = 4;

set room:= 1 2;
set specialty:= 1 2 3 4 5 6;
set day:= 1 2 3 4 5;
set scenario:= 1 2 3 4;

param h = 8;

param 
a:=
1 1
2 8;

param k:
1 2 3 4 5:=

1 2 3 3 3 2
2 2 2 2 3 2
3 3 3 2 2 2
4 3 2 2 3 2
5 2 2 3 3 3
6 3 2 2 3 2;

param 
Pi:=
1 0.75
2 0.10
3 0.075
4 0.075;

param c1:
1 2 3 4 5:=

1 70 10 20 30 40
2 60 70 10 20 30
3 50 60 70 10 20
4 40 50 60 70 10
5 30 40 50 60 70
;

param
c2 = 400;

param 
c3 = 40;

param 
Lamda = 0.1;
param 
Omega = 0;
param e:
1 2 3 4:=

1 1 8.59       9.89       4.69    12.49
1 2 4.68       5.98       0.78     8.58
1 3 11.60 12.90 7.70 15.50
1 4 7.25 8.55 3.35 11.15
1 5 9.05 10.35 5.15 12.95
2 1 12.00 12.67 9.99 14.01
2 2 10.26 10.93 8.25 12.27
2 3 10.74 11.41 8.73 12.75
2 4 10.08 10.75 8.07 12.09
2 5 9.99 10.66 7.98 12.00
3 1 9.37 9.80 8.08 11.09
3 2 10.07 10.50 8.78 11.79
3 3 9.69 10.12 8.40 11.41
3 4 9.32 9.75 8.03 11.04
3 5 9.32 9.75 8.03 11.04
4 1 10.35 11.32 7.44 14.23
4 2 12.09 13.06 9.18 15.97
4 3 10.94 11.91 8.03 14.82
4 4 10.41 11.38 7.50 14.29
4 5 11.15 12.12 8.24 15.03
5 1 10.36 10.89 8.77 12.48
5 2 9.82 10.35 8.23 11.94
5 3 12.21 12.74 10.62 14.33
5 4 9.42 9.95 7.83 11.54
5 5 9.59 10.12 8.00 11.71
6 1 10.94 11.92 8.00 14.86
6 2 11.48 12.46 8.54 15.40
6 3 11.25 12.23 8.31 15.17
6 4 9.64 10.62 6.70 13.56
6 5 9.97 10.95 7.03 13.89
;

param g:
1 2 3 4:=

1 1 7.03 8.33 3.13 10.93
1 2 3.83 5.13 0.00 7.73
1 3 9.49 10.79 5.59 13.39
1 4 5.93 7.23 2.03 9.83
1 5 7.40 8.70 3.50 11.30
2 1 4.00 4.67 1.99 6.01
2 2 3.42 4.09 1.41 5.43
2 3 3.58 4.25 1.57 5.59
2 4 3.36 4.03 1.35 5.37
2 5 3.33 4.00 1.32 5.34
3 1 3.12 3.55 1.83 4.41
3 2 3.36 3.79 2.07 4.65
3 3 3.23 3.66 1.94 4.52
3 4 3.11 3.54 1.82 4.40
3 5 3.11 3.54 1.82 4.40
4 1 3.45 4.42 0.54 6.36
4 2 4.03 5.00 1.12 6.94
4 3 3.65 4.62 0.74 6.56
4 4 3.47 4.44 0.56 6.38
4 5 3.72 4.69 0.81 6.63
5 1 3.45 3.98 1.86 5.04
5 2 3.27 3.80 1.68 4.86
5 3 4.07 4.60 2.48 5.66
5 4 3.14 3.67 1.55 4.73
5 5 2.91 3.44 1.32 4.50
6 1 3.65 4.63 0.71 6.59
6 2 3.83 4.81 0.89 6.77
6 3 3.75 4.73 0.81 6.69
6 4 3.21 4.19 0.27 6.15
6 5 3.32 4.30 0.38 6.26
;

Amir Lm

unread,
Jun 24, 2016, 4:51:50 PM6/24/16
to AMPL Modeling Language
CAN ANYONE PLEASE HELP ME!
I AM IN DESPERATE NEED OF HELP IN DEBUGGING THIS MODEL.
I HAVE A DEADLINE THAT IS QUICKLY APPROACHING.
PLEASE, HELP ME... OR ATLEAST DIRECT ME TO SOMEWHERE THAT I CAN GET SOME HELP...!

Robert Fourer

unread,
Jun 25, 2016, 4:30:11 PM6/25/16
to am...@googlegroups.com
Well, I will give you a hint. When I add to your model either the constraint

subj to test1: sum {s in 1..S, t in 1..T, eps in 1..Eps} f[s,t,eps] = 0.001;

or the constraint

subj to test2: sum {s in 1..S, t in 1..T, eps in 1..Eps} f[s,t,eps] = -0.001;

then the problem becomes infeasible. This strongly suggests that 0 is the only feasible value for the f variables. There isn't any one constraint that sets f[s,t,eps] to 0, but you can look for a combination of constraints that together imply f[s,t,eps] = 0.

Bob Fourer
am...@googlegroups.com

=======

Amir Lm

unread,
Jul 13, 2016, 3:56:35 PM7/13/16
to AMPL Modeling Language, 4...@ampl.com
Dear Bob,

Thanks for your advice.
Actually, I have run the model using option 'iisfind 1' to figure out why the model implies f to ZERO.
Here is what I've got.
The model shows "non" over ALL the constraints except Eq4-16 as shown below!

ampl: display Eq4_16.iis;
Eq5_17.iis [*,*,1]
:    1     2     3     4     5     :=
1   non   non   non   non   non
2   non   non   non   non   non
3   non   non   non   non   non
4   non   non   non   non   non
5   non   non   non   non   non
6   non   mem   non   non   non

 [*,*,2]
:    1     2     3     4     5     :=
1   non   non   non   non   non
2   non   non   non   non   non
3   non   non   non   non   non
4   non   non   non   non   non
5   non   non   non   non   non
6   non   mem   non   non   non

 [*,*,3]
:    1     2     3     4     5     :=
1   non   non   non   non   non
2   non   non   non   non   non
3   non   non   non   non   non
4   non   non   non   non   non
5   non   non   non   non   non
6   non   non   non   non   non

 [*,*,4]
:    1     2     3     4     5     :=
1   non   non   non   non   non
2   non   non   non   non   non
3   non   non   non   non   non
4   non   non   non   non   non
5   non   non   non   non   non
6   non   non   non   non   non

Would you please let me know using iisfind options, how can I diagnose the model?
I would really appreciate your comments/thoughts.

Robert Fourer

unread,
Jul 17, 2016, 3:43:23 AM7/17/16
to am...@googlegroups.com
To get a convenient list of the components of an irreducible infeasible subset (IIS), use the following two commands:

display {i in 1.._ncons: _con[i].iis <> 'non'} (_conname[i],_con[i].iis);
display {j in 1.._nvars: _var[j].iis <> 'non'} (_varname[j],_var[j].iis);

The IIS consists of all the listed constraints, plus bounds on the listed variables. If a variable's listing shows "low" then it is the variable's lower bound that is in the IIS, while if a variable's listing shows "upp" then it is the variable's upper bound that is in the IIS.

This analysis tells you that there is no solution that is feasible for all of the constraints and bounds in the IIS, but that if you drop any one of these constraints or bounds, then there will be a feasible solution for all of the remaining ones.

Bob Fourer
am...@googleroups.com

Amir Lamzi

unread,
Jul 17, 2016, 9:33:55 AM7/17/16
to am...@googlegroups.com
Thank you very much for the advice, Bob!

--
You received this message because you are subscribed to a topic in the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ampl/CmhLSJKrGO8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages