Code Monkey home page Code Monkey logo

Comments (16)

IainNZ avatar IainNZ commented on August 29, 2024

I wonder if ScikitLearn defines something called Model...

from jumper.jl.

IainNZ avatar IainNZ commented on August 29, 2024

Although it is getting through solve(::Model) so maybe not that.

from jumper.jl.

IainNZ avatar IainNZ commented on August 29, 2024

If you are at a REPL with using JuMP, JuMPeR, ScikitLearn, and do methods JuMPeR.setup_set!, what do you see?

from jumper.jl.

IainNZ avatar IainNZ commented on August 29, 2024

JuMPeR hardly exports anything so I'm not sure the root of this really...

from jumper.jl.

brad-sturt avatar brad-sturt commented on August 29, 2024

In the REPL, I ran the following sequences of commands:

using JuMP, JuMPeR
model = RobustModel()
@variable(model,x)
@objective(model,Min,x)
@constraint(model, x>= 0)
@uncertain(model,u >= 0)
@constraint(model, x == u)
solve(model) # Solves correctly

Then, I tried again with ScikitLearn

using JuMP, JuMPeR, Scikitlearn
model = RobustModel()
@variable(model,x)
@objective(model,Min,x)
@constraint(model, x>= 0)
solve(model)  
# :Optimal

@uncertain(model,u >= 0)
@constraint(model, x == u)
solve(model) 
# ERROR: JuMPeR.BasicUncertaintySet has not implemented setup_set!
 in error at /Applications/Julia-0.4.3.app/Contents/Resources/julia/lib/julia/sys.dylib
 in _solve_robust at /Users/brad-sturt/.julia/v0.4/JuMPeR/src/solve.jl:65
 in solve at /Users/brad-sturt/.julia/v0.4/JuMP/src/solvers.jl:114

In both cases, JuMPeR.setup_set is a defined method, but JuMPeR.setup_set! is undefined.

from jumper.jl.

brad-sturt avatar brad-sturt commented on August 29, 2024

(sorry, in the previous post, it should be ScikitLearn, not Scikitlearn)

from jumper.jl.

IainNZ avatar IainNZ commented on August 29, 2024

error("$(typeof(us)) has not implemented setup_set!")

is the cause of setup_set! appearing - its just an incorrect error message.

So I guess what I meant before was methods(setup_set)

from jumper.jl.

brad-sturt avatar brad-sturt commented on August 29, 2024

Sorry! Here are the methods.

julia> methods(JuMPeR.setup_set)
# 3 methods for generic function "setup_set":
setup_set(us::JuMPeR.BasicUncertaintySet, rm::JuMP.Model, idxs::Array{Int64,1}, scens_requested::Bool, other_prefs::Dict{Symbol,Any}) at /Users/brad-sturt/.julia/v0.4/JuMPeR/src/uncsets_basic.jl:82
setup_set(us::JuMPeR.BudgetUncertaintySet, rm::JuMP.Model, idxs::Array{Int64,1}, scens_requested::Bool, other_prefs::Dict{Symbol,Any}) at /Users/brad-sturt/.julia/v0.4/JuMPeR/src/uncsets_budget.jl:58
setup_set(us::JuMPeR.AbstractUncertaintySet, rm::JuMP.Model, idxs::Array{Int64,1}, scens_requested::Bool, other_prefs) at /Users/brad-sturt/.julia/v0.4/JuMPeR/src/uncsets.jl:33

from jumper.jl.

IainNZ avatar IainNZ commented on August 29, 2024

OK, good. So its falling through to the abstract error case, but the only reason it should do that is if other_prefs made it - I just noticed that the abstract one doesn't have that restriction.
The thing I don't get is,

  • That dictionary is defined here:
    prefs = Dict{Symbol,Any}([name => value for (name,value) in kwargs])
  • Why ScikitLearn being loaded would affect that

from jumper.jl.

brad-sturt avatar brad-sturt commented on August 29, 2024

Interestingly, I found that the first file works correctly, whereas the second file crashes.

File1.jl

using JuMP, JuMPeR

model = RobustModel()
@variable(model, x)
@uncertain(model, u)
@constraint(model, u >= 0)
@constraint(model, u <= 1)
@constraint(model, x >= u)
@objective(model, Min, x)
@show solve(model)

using ScikitLearn

model = RobustModel()
@variable(model, x)
@uncertain(model, u)
@constraint(model, u >= 0)
@constraint(model, u <= 1)
@constraint(model, x >= u)
@objective(model, Min, x)
@show solve(model)

File2.jl

using JuMP, JuMPeR
using ScikitLearn

model = RobustModel()
@variable(model, x)
@uncertain(model, u)
@constraint(model, u >= 0)
@constraint(model, u <= 1)
@constraint(model, x >= u)
@objective(model, Min, x)
@show solve(model)

from jumper.jl.

brad-sturt avatar brad-sturt commented on August 29, 2024

The following also works:

using JuMP, JuMPeR

model = RobustModel()
solve(model)

using ScikitLearn

model = RobustModel()
@variable(model, x)
@uncertain(model, u)
@constraint(model, u >= 0)
@constraint(model, u <= 1)
@constraint(model, x >= u)
@objective(model, Min, x)
@show solve(model)

It appears that is we run a solve() prior to loading ScikitLearn, the problem goes away.

from jumper.jl.

IainNZ avatar IainNZ commented on August 29, 2024

Can you try Julia 0.4.5?

from jumper.jl.

brad-sturt avatar brad-sturt commented on August 29, 2024

Same problem

from jumper.jl.

brad-sturt avatar brad-sturt commented on August 29, 2024

The workaround a couple posts above works for now. I'll keep looking through the code to see if I can figure out the problem.

from jumper.jl.

yeesian avatar yeesian commented on August 29, 2024

I can't reproduce this in #69. Is it still an issue?

from jumper.jl.

yeesian avatar yeesian commented on August 29, 2024

Closing stale issues. Re-open if it's still a problem.

from jumper.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.