Skip to content

Commit 723d499

Browse files
committed
[UPD] Raise an error if ef cannot be solved
1 parent b64c2c7 commit 723d499

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/extensiveFormulation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function extensive_formulation(model,
9898
firstControl = collect(values(getValue(u)))[1:DIM_CONTROL*laws[1].supportSize]
9999
return getObjectiveValue(mod), firstControl, status
100100
else
101-
return -1., -1., status
101+
error("Extensive formulation not solved to optimality. Change the model")
102102
end
103103

104104
end

test/runtests.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ facts("SDDP algorithm: 1D case") do
118118
noise_scenarios = simulate_scenarios(model.noises,params.forwardPassNumber)
119119

120120
sddp_costs = 0
121+
122+
context("Unsolvable extensive formulation") do
123+
model_ef = StochDynamicProgramming.LinearDynamicLinearCostSPmodel(n_stages, u_bounds,
124+
x0, cost, dynamic, laws)
125+
x_bounds_ef = [(-2., -1.)]
126+
set_state_bounds(model_ef, x_bounds_ef)
127+
@fact_throws extensive_formulation(model_ef, params)
128+
end
129+
121130
context("Linear cost") do
122131
# Compute bellman functions with SDDP:
123132
V, pbs = solve_SDDP(model, params, 0)

0 commit comments

Comments
 (0)