Skip to content
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

infeasible solution #174

Closed
lorenzoreus opened this issue Jan 10, 2019 · 3 comments
Closed

infeasible solution #174

lorenzoreus opened this issue Jan 10, 2019 · 3 comments

Comments

@lorenzoreus
Copy link

lorenzoreus commented Jan 10, 2019

I have infeasible solution to this simple problem. However when ADDING a constraint (@constraint(sp, x == 500.0)) , the solver gives me a solution!
Please can someone help to undestand what is going on? Thanks

m = SDDPModel(
                  sense = :Min,
                 stages = 3,
                 solver = ClpSolver(),
        objective_bound = -10000000.00
                                ) do sp, t
    initial_stock= 1500.0
    @state(sp, stock >= 0.0   , stock0 == initial_stock )

    @variable(sp, 0.0 <=x<= 1000.0)

    @constraint(sp,  stock0 - x  == stock)
    #@constraint(sp,  x   == 500.0)
    if  t == 3
        @constraint(sp,  stock==0.0)
    end
    price= [550.0, 600.0, 650.0]
    @stageobjective(sp, price[t] * x)
end

status = SDDP.solve(m, iteration_limit = 100)
SDDP.getbound(m)

Edit(odow): formatting

@odow
Copy link
Owner

odow commented Jan 10, 2019

The problem is in the third stage. You might come in with stock0 = 1500. Then there is a constraint that stock == 0. From the constraint you have, x == stock0 - stock, so x = 1500, but x <= 1000 so the problem is infeasible.

SDDP.jl requires relatively complete recourse. That is, for all possible values of the incoming state variables, there is a feasible control. This model doesn't satisfy that requirement.

Either relax the upper bound on x, or allow the stock == 0 constraint in the last stage to be violated and penalise this violation in the objective.

@lorenzoreus
Copy link
Author

thanks oscar for your fast response . perfect explanation

@odow
Copy link
Owner

odow commented Jan 27, 2019

Great that this solved the problem.

@odow odow closed this as completed Jan 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants