-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFCTP_Sto.gms
81 lines (61 loc) · 2.09 KB
/
FCTP_Sto.gms
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
$Title Stochastic fixed-charge transportation problem (SFCTP)
$OnText
Developed by
Andres Ramos
Instituto de Investigacion Tecnologica
Escuela Tecnica Superior de Ingenieria - ICAI
UNIVERSIDAD PONTIFICIA COMILLAS
Alberto Aguilera 23
28015 Madrid, Spain
Andres.Ramos@comillas.edu
https://pascua.iit.comillas.edu/aramos/Ramos_CV.htm
May 8, 2023
$OffText
* relative optimality tolerance in solving MIP problems
option OptcR = 0, Decimals = 6
sets
I origins / i1 * i4 /
J destinations / j1 * j3 /
S scenarios / s000 * s099 /
parameters
A(i) product offer / i1 20, i2 30, i3 40, i4 20 /
B(j) product demand / j1 21, j2 51, j3 31 /
P(s) scenario probability
BS(s, j) product demand stochastic ;
BS(s,j) = B(j) * [1+round(uniform(-0.05,0.05),2)] ;
P (s) = 1/card(s) ;
table C(i,j) per unit variable transportation cost
j1 j2 j3
i1 1 2 3
i2 3 2 1
i3 2 3 4
i4 4 3 2 ;
table F(i,j) fixed transportation cost
j1 j2 j3
i1 10 20 30
i2 20 30 40
i3 30 40 50
i4 40 50 60 ;
loop (s, abort $(sum[i, A(i)] < sum[j, BS(s,j)]) 'Infeasible problem' )
positive variable
X(s,i,j) arc flow
binary variable
Y(i,j ) arc investment decision
variables
Z1 objective function
equations
EQ_OBJ complete problem objective function
Offer (s,i ) offer at origin
Demand (s, j) demand at destination
FlowLimit(s,i,j) arc flow limit ;
EQ_OBJ .. Z1 =e= sum[(i,j), F(i,j)*Y(i,j)] + sum[(s,i,j), P(s)*C(i,j)*X(s,i,j)] ;
Offer (s,i ) .. sum[j, X(s,i,j)] =l= A ( i) ;
Demand (s, j) .. sum[i, X(s,i,j)] =g= BS(s,j) ;
FlowLimit(s,i,j) .. X(s,i,j) =l= 100 * Y(i,j) ;
model Complete / EQ_OBJ Offer Demand FlowLimit / ;
X.up(s,i,j) = 100 ;
Complete.OptFile = 1 ;
file COPT / cplex.opt / ;
put COPT putclose 'writelp FCTP_Sto.lp' / ;
solve Complete using MIP minimizing Z1
display Z1.l, Y.l