Skip to content

Commit

Permalink
Update air conditioning example (#801)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thuener authored Nov 27, 2024
1 parent 7ff6013 commit 274bef9
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion docs/src/examples/air_conditioning.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
# # Air conditioning

# Taken from [Anthony Papavasiliou's notes on SDDP](https://web.archive.org/web/20200504214809/https://perso.uclouvain.be/anthony.papavasiliou/public_html/SDDP.pdf)
# This is a variation of the problem that first appears in the book
# Introduction to Stochastic Programming by Birge and Louveaux, 1997,
# Springer-Verlag, New York, on page 237, Example 1. For a rescaled problem,
# they reported an optimal value of 6.25 with a first-stage solution of x1 = 2
# (production)and y1 = 1 (store production). On this variation, without rescaling,
# it would be equivalent to 62500, 200 and 100, respectively.

# Consider the following problem
# * Produce air conditioners for 3 months
Expand Down Expand Up @@ -49,7 +55,17 @@ function air_conditioning_model(duality_handler)
)
end
SDDP.train(model; duality_handler = duality_handler)
@test isapprox(SDDP.calculate_bound(model), 62_500.0, atol = 0.1)
lb = SDDP.calculate_bound(model)
println("Lower bound is: $lb")
@test isapprox(lb, 62_500.0, atol = 0.1)
sims = SDDP.simulate(model, 1, [:production, :stored_production])
x1 = sims[1][1][:production]
y1 = sims[1][1][:stored_production].out
@test isapprox(x1, 200, atol = 0.1)
@test isapprox(y1, 100, atol = 0.1)
println(
"With first stage solutions $(x1) (production) and $(y1) (stored_production).",
)
return
end

Expand Down

0 comments on commit 274bef9

Please sign in to comment.