-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnicyclicGraph with Integer variables #751
Comments
Your upper bound is too small. Try rescaling |
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? |
In my quick tests, it seemed to be a little tighter than the default. (Also known as strengthened benders.)
For you, most definitely not. |
Let me close this one. Thanks for the help! |
Since we compute the discounted objective, the bound is approximately 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 😄 |
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?
The text was updated successfully, but these errors were encountered: