Skip to content

Commit f8d7afc

Browse files
committed
[UPD] Upgrade to JuMP 0.15 syntax
1 parent 42927e2 commit f8d7afc

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/extensiveFormulation.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ function extensive_formulation(model, param; verbose=0)
7777
[x[t+1,DIM_STATE*(m-1)+k] for k = 1:DIM_STATE] .== model.dynamics(t,
7878
[x[t,DIM_STATE*(n-1)+k] for k = 1:DIM_STATE],
7979
[u[t,DIM_CONTROL*(m-1)+k] for k = 1:DIM_CONTROL],
80-
laws[t].support[xi]))
80+
laws[t].support[:, xi]))
8181

8282
#Add constraints to define the cost at each node
8383
@constraint(mod,
8484
c[t,m] == model.costFunctions(t,
8585
[x[t,DIM_STATE*(n-1)+k] for k = 1:DIM_STATE],
8686
[u[t,DIM_CONTROL*(m-1)+k] for k = 1:DIM_CONTROL],
87-
laws[t].support[xi]))
87+
laws[t].support[:, xi]))
8888
end
8989
end
9090
end
@@ -94,11 +94,10 @@ function extensive_formulation(model, param; verbose=0)
9494

9595
#Define the objective of the function
9696
@objective(mod, Min,
97-
sum{
98-
sum{ proba[t][laws[t].supportSize*(n-1)+k]*c[t,laws[t].supportSize*(n-1)+k],
99-
k = 1:laws[t].supportSize},
100-
t = 1:T, n=1:div(N[t+1],laws[t].supportSize)}
101-
)
97+
sum(
98+
sum(proba[t][laws[t].supportSize*(n-1)+k]*c[t,laws[t].supportSize*(n-1)+k]
99+
for k = 1:laws[t].supportSize)
100+
for t = 1:T, n=1:div(N[t+1],laws[t].supportSize)))
102101

103102
status = solve(mod)
104103
solved = (status == :Optimal)

0 commit comments

Comments
 (0)