Coder Social home page Coder Social logo

Comments (4)

IainNZ avatar IainNZ commented on June 26, 2024

Can't be done (yet)
Robust models are JuMP models with an "extension".

function RobustModel(;solver=nothing,cutsolver=nothing)
    m = Model(solver=solver)
    m.ext[:Robust] = RobustData(cutsolver)
    return m
end

Alternatives that would let you do multiple dispatch including using an AbstractModel from which Model and a hypothetical RobustModel inherit from is one option, another was making Model parametric. Both had issues...
This is something @mlubin and I talked about a lot, and this "extension" mechanism was the best we could do without compromising any JuMP speed. Somewhat related to JuliaLang/julia#4935

from jumper.jl.

vgupta1 avatar vgupta1 commented on June 26, 2024

I noticed that... Do you know if the language extension is coming soon?
(i.e. requiring abstract types to have certain members?)

Alternatively, although it seems a bit dodgy, (for my own edifiaton)
couldn't you have done this?

type RobustModel <: Model
    m  #This is actually a model
     rd #this is the robust data and extension stuff
end

In other words, Robust models implement BOTH "is a" and "has a" in the
inheritance scheme?


Vishal Gupta
PhD Candidate, 2014
Operations Research Center
Massachusetts Institute of Technology
www.mit.edu/~vgupta1/

On Thu, Apr 10, 2014 at 9:50 PM, Iain Dunning [email protected]:

Can't be done (yet)
Robust models are JuMP models with an "extension".

function RobustModel(;solver=nothing,cutsolver=nothing)
m = Model(solver=solver)
m.ext[:Robust] = RobustData(cutsolver)
return m
end

Alternatives that would let you do multiple dispatch including using an
AbstractModel from which Model and a hypothetical RobustModel inherit from
is one option, another was making Model parametric. Both had issues...
This is something @mlubin https://github.com/mlubin and I talked about
a lot, and this "extension" mechanism was the best we could do without
compromising any JuMP speed. Somewhat related to JuliaLang/julia#4935JuliaLang/julia#4935

Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-40163671
.

from jumper.jl.

mlubin avatar mlubin commented on June 26, 2024

The issue is that variables contain a reference to their parent model, which needs to be a Model. We tried making variables parametric on the model type, but that led to Julia's version of C++ template hell. Having different model types also makes extensions mutually exclusive.

from jumper.jl.

mlubin avatar mlubin commented on June 26, 2024

Also you can't inherit from concrete types in Julia. Model would need to be an abstract type.

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.