This function creates an object of class "CDEPD"
, by which the
deterministic equivalent problem is defined.
1 
MP 

q 

W 

h 

Tech 

SubDir 

prob 

The master and the subproblems must be specified as LP to be minimized.
An object of S4class "CDEPD"
.
Bernhard Pfaff
Birge, J. R. and Louveaux, F., Introduction to Stochastic Programming, Springer Series in Operations Research and Financial Engineering, Second Edition, 2004, New York: Springer.
CDEPD
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  ##
## Birge & Louveaux
## Chapter 1, Section 1, The farmer's problem
##
## Formulating as twostage problem
##
mpobj < c(150, 230, 260)
names(mpobj) < c("x1", "x2", "x3")
## Constraints in master problem
mpA < matrix(c(1, 1, 1),
nrow = 1, ncol = 3, byrow = TRUE)
colnames(mpA) < names(mpobj)
rownames(mpA) < "R1"
## direction in master problem
mpdir < "<="
## rhs in master problem
mprhs < c(500)
## Formulating firststage problem
MP < LPD(mpobj, mpA, mpdir, mprhs)
## Formulation of second stage problems
## objective is the same for the three scenarios
q < c(170, 238, 150, 210, 36, 10)
q < 1.0 * q
names(q) < c("w1", "y1", "w2", "y2", "w3", "w4")
## recourse matrix
W < matrix(c(1, 1, 0, 0, 0, 0,
0, 0, 1, 1, 0, 0,
0, 0, 0, 0, 1, 1,
0, 0, 0, 0, 1, 0),
nrow = 4, ncol = 6, byrow = TRUE)
colnames(W) < names(q)
rownames(W) < paste("SSR", 1:4, sep = "")
## technology matrixes for the three scenarios
## reflecting the bad, average and good crop yields
## Scenario 1
T1 < matrix(c(3, 0, 0,
0, 3.6, 0,
0, 0, 24,
0, 0, 0),
nrow = 4, ncol = 3, byrow = TRUE)
colnames(T1) < names(mpobj)
rownames(T1) < rownames(W)
## Scenario 2
T2 < matrix(c(2.5, 0, 0,
0, 3, 0,
0, 0, 20,
0, 0, 0),
nrow = 4, ncol = 3, byrow = TRUE)
colnames(T2) < names(mpobj)
rownames(T2) < rownames(W)
## Scenario 3
T3 < matrix(c(2, 0, 0,
0, 2.4, 0,
0, 0, 16,
0, 0, 0),
nrow = 4, ncol = 3, byrow = TRUE)
colnames(T3) < names(mpobj)
rownames(T3) < rownames(W)
Tech < list(T1, T2, T3)
## affine terms on rhs, same in the three scenarios
h < c(200, 240, 0, 6000)
names(h) < rownames(W)
ssdir < c(">=", ">=", "<=", "<=")
## Defining DEP
DEP < DEP(MP, q, W, h, Tech, SubDir = ssdir)
DEP

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.