Code Monkey home page Code Monkey logo

Comments (9)

odow avatar odow commented on September 5, 2024 2

Any solution is correct. 0 is just the least worst option, and most often the one the user intended.

from gams.jl.

renkekuhlmann avatar renkekuhlmann commented on September 5, 2024 1

I still doubt that 0 is "the correct answer", but

Getting NaN solutions is going to cause no-end of issues.

is a very good point. I will change the behaviour to return 0 with the next release. Thanks a lot for pointing this out!

from gams.jl.

ChrisFuelOR avatar ChrisFuelOR commented on September 5, 2024 1

Thanks for your quick responses and for fixing the bug.

from gams.jl.

odow avatar odow commented on September 5, 2024

Just chiming in here: I don't know about the GAMS issue, but please talk to me if you have development plans for SDDiP odow/SDDP.jl#246!

from gams.jl.

renkekuhlmann avatar renkekuhlmann commented on September 5, 2024

Thanks very much for reporting! I can confirm that the used GAMS savepoint option only includes the symbols that are present in the model, which results in the incorrect behaviour reported by you.

from gams.jl.

renkekuhlmann avatar renkekuhlmann commented on September 5, 2024

This has been fixed with GAMS.jl v0.1.6. The output of the above program will be:

8-element Array{Float64,1}:
 NaN
 NaN
   1.0
   0.0
   0.0
   0.0
   0.0
 NaN

I thought about using missing instead of NaN, but that resulted in errors with MathOptInterface. missing would have been nice, but NaN works as well. Thanks again for reporting the issue!

from gams.jl.

odow avatar odow commented on September 5, 2024

Isn't the correct answer 0, not NaN?

from gams.jl.

renkekuhlmann avatar renkekuhlmann commented on September 5, 2024

Good question. I have thought about this for a while and I think that missing or NaN is best here as it indicates the value could have been set to anything since it wasn't part of the optimization. If I set it to something, e.g. 0, this is unclear to the user. But I am happy to hear your thoughts about it. Is there any convention in MathOptInterface to set the value to 0 in this case?

from gams.jl.

odow avatar odow commented on September 5, 2024

I think the convention in most (every?) solver is that unspecified variables default to 0. That's what pure-Gurobi does, so it makes sense that is what GAMS-Gurobi should do:

using JuMP, Gurobi
approx_model = Model(Gurobi.Optimizer)
@variables(approx_model, begin
    θ <= 100
    x[1:8]
end)
@objective(approx_model, Max, θ)
@constraint(approx_model, θ - 0.65 * x[3] + x[4] - x[5] + x[6] + x[7] <= 36)
optimize!(approx_model)
julia> value.(x)
8-element Array{Float64,1}:
  0.0
  0.0
 98.46153846153845
  0.0
  0.0
  0.0
  0.0
  0.0

For SDDP, we take the solution to the Lagrangian dual, and use the optimal x as an input to a different LP. Getting NaN solutions is going to cause no-end of issues.

from gams.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.