Closed Thuener closed 2 months ago
upper_bound = 10^6,
Your upper bound is too small.
Try rescaling order_size
down a bit.
Here's what I have:
using SDDP
import HiGHS
T = 12
c_order_size, c_price, c_cost = 10, 40, 3
Ω, P = [45], [1.0]
model = SDDP.PolicyGraph(
SDDP.UnicyclicGraph(0.95; num_nodes = T);
sense = :Max,
upper_bound = 10^7,
optimizer = HiGHS.Optimizer,
) do sp, t
@variables(sp, begin
x_inv >= 0, SDDP.State, (initial_value = 0)
u_num_orders >= 0, Int
u_prod >= 0
u_sales >= 0
end)
@constraints(sp, begin
u_sales <= x_inv.in
u_prod == c_order_size * u_num_orders
x_inv.out == x_inv.in + u_prod - u_sales
end)
@stageobjective(sp, c_price * u_sales - c_cost * u_prod)
SDDP.parameterize(sp, Ω, P) do ω
return set_upper_bound(u_sales, ω)
end
end
SDDP.train(
model;
iteration_limit = 50,
duality_handler = SDDP.StrengthenedConicDuality(),
log_every_iteration = true,
)
Thanks, Oscar. I owe you another one.
Why use StrengthenedConicDuality?
Do you have any account for donations to the SDDP.jl project?
Why use StrengthenedConicDuality?
In my quick tests, it seemed to be a little tighter than the default. (Also known as strengthened benders.)
Do you have any account for donations to the SDDP.jl project?
For you, most definitely not.
Let me close this one. Thanks for the help! The conclusion is that infinity policies will require a bigger upper bound.
The conclusion is that infinity policies will require a bigger upper bound.
Since we compute the discounted objective, the bound is approximately 1 / (1 - p)
larger than the finite case of a single cycle. Since you have p =0.95, the bound is 20 times larger than you might "expect".
For your model, a naive bound is to assume you make perfect production decisions, and that you always sell maximum demand:
julia> (500_000 * 40 - 3 * 500_000) * 12 * 1 / (1 - 0.95)
4.439999999999996e9
4e9 is quite large :smile:
Hi Oscar, I'm trying to get back to SDDP problems. This library is getting better each year. Congrats!!
I'm trying to experiment with UnicyclicGraph, but I'm getting some strange convergence issues because of one Integer variable. Here is an example:
The model can get out of the local optimal:
If I change the policy graph to SDDP.LinearGraph(T*8) then we get:
Any idea on what could be the issue?