Coder Social home page Coder Social logo

jump-dev / jump.jl Goto Github PK

View Code? Open in Web Editor NEW
2.1K 82.0 387.0 216.35 MB

Modeling language for Mathematical Optimization (linear, mixed-integer, conic, semidefinite, nonlinear)

Home Page: https://jump.dev/

License: Other

Julia 100.00%
optimization julia modeling-language linear-programming mixed-integer-programming nonlinear-programming semidefinite-programming conic-programs mathematical-programming mathematical-modelling

jump.jl's Introduction

JuMP logo

Powered by NumFOCUS

JuMP is a domain-specific modeling language for mathematical optimization embedded in Julia. You can find out more about us by visiting jump.dev.

Latest release Development version
Tagged version version JuliaHub
Install import Pkg; Pkg.add("JuMP") import Pkg; Pkg.pkg"add JuMP#master"
Documentation stable dev
Get help Ask a question on the Community forum Join the Developer chatroom
Source code release-1.0 master
Testing status Build Status Build Status
Coverage codecov codecov

Need help?

Use the Community forum to search for answers to previously asked questions, or ask a new question.

The post Please read: make it easier to help you, describes the best practices for asking a question.

Bug reports

Please report any issues via the GitHub issue tracker. All types of issues are welcome and encouraged; this includes bug reports, documentation typos, feature requests, etc.

Citing JuMP

If you find JuMP useful in your work, we kindly request that you cite the following paper (journal, preprint):

@article{Lubin2023,
    author = {Miles Lubin and Oscar Dowson and Joaquim {Dias Garcia} and Joey Huchette and Beno{\^i}t Legat and Juan Pablo Vielma},
    title = {{JuMP} 1.0: {R}ecent improvements to a modeling language for mathematical optimization},
    journal = {Mathematical Programming Computation},
    volume = {15},
    pages = {581โ€“589},
    year = {2023},
    doi = {10.1007/s12532-023-00239-3}
}

For earlier works, see:

  • Our paper in SIAM Review (journal, pdf):

    @article{DunningHuchetteLubin2017,
        author = {Iain Dunning and Joey Huchette and Miles Lubin},
        title = {{JuMP}: {A} {M}odeling {L}anguage for {M}athematical {O}ptimization},
        journal = {SIAM Review},
        volume = {59},
        number = {2},
        pages = {295-320},
        year = {2017},
        doi = {10.1137/15M1020575},
    }
  • Our paper in IJOC (journal, preprint):

    @article{LubinDunningIJOC,
        author = {Miles Lubin and Iain Dunning},
        title = {{C}omputing in {O}perations {R}esearch {U}sing {J}ulia},
        journal = {INFORMS Journal on Computing},
        volume = {27},
        number = {2},
        pages = {238-248},
        year = {2015},
        doi = {10.1287/ijoc.2014.0623},
    }

NumFOCUS logo

JuMP is a Sponsored Project of NumFOCUS, a 501(c)(3) nonprofit charity in the United States. NumFOCUS provides JuMP with fiscal, legal, and administrative support to help ensure the health and sustainability of the project. Visit numfocus.org for more information.

You can support JuMP by donating.

Donations to JuMP are managed by NumFOCUS. For donors in the United States, your gift is tax-deductible to the extent provided by law. As with any donation, you should consult with your tax adviser about your particular tax situation.

JuMP's largest expense is the annual JuMP-dev workshop. Donations will help us provide travel support for JuMP-dev attendees and take advantage of other opportunities that arise to support JuMP development.

jump.jl's People

Contributors

atsushisakai avatar blegat avatar ccoffrin avatar chkwon avatar coroa avatar dourouc05 avatar expandingman avatar guilhermebodin avatar henriquebecker91 avatar iainnz avatar jackdunnnz avatar jd-foster avatar jd-lara avatar joaquimg avatar joehuchette avatar jrevels avatar leotac avatar matbesancon avatar mlubin avatar mohamed82008 avatar mtanneau avatar odow avatar pulsipher avatar raphaelsaavedra avatar remi-garcia avatar tkelman avatar vrngupta53 avatar yashvardhan747 avatar yeesian avatar yuyichao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jump.jl's Issues

Travis build fails

Looks like an issue with Pkg. I'm willing to wait it out until the mess gets fixed in Julia (i.e. Pkg is replaced by Pkg2).

Rename to JuMP

So, currently we have
ac61be9
which won't pass tests because of the wrong package name. But if you do manually change the folder name and put it in .julia, it works.

There is a lot of internal stuff called MathProg* that I haven't touched - and hopefully I haven't renamed anything I shouldn't have.

If it looks good, I'll rename the repository - but I want another look first!

Fix pretty printers

Both aff and quad need "compression"
and quad has the extra + and might be slow - but this stuff isn't in performance critical code anyway

errors inside macros give incorrect line numbers

In dummy.jl:

using MathProg
m = Model("max")
@setObjective(m, z)

Then:

$ julia dummy.jl 
ERROR: z not defined
 in include_from_node1 at loading.jl:92
 in process_options at client.jl:250
 in _start at client.jl:329
at /home/mlubin/.julia/MathProg/test/dummy.jl:139

QCQP tests failing

$ julia runtests.jl 
Running tests:
 Test: qcqpmodel.jl
Optimize a model with 0 rows, 2 columns and 0 nonzeros
Model has 1 quadratic constraint
Presolve time: 0.00s
Presolved: 3 rows, 5 columns, 6 nonzeros
Presolved model has 1 second-order cone constraint
Ordering time: 0.00s

Barrier statistics:
 AA' NZ     : 3.000e+00
 Factor NZ  : 6.000e+00
 Factor Ops : 1.400e+01 (less than 1 second per iteration)
 Threads    : 1

                  Objective                Residual
Iter       Primal          Dual         Primal    Dual     Compl     Time
   0   0.00000000e+00 -7.11109926e+00  1.22e+00 9.75e-01  1.49e+00     0s
   1  -1.47199294e+00 -4.28730677e+00  1.21e-01 3.66e-01  4.26e-01     0s
   2  -1.81200237e+00 -2.19495518e+00  1.21e-07 3.66e-07  4.79e-02     0s
   3  -1.99979675e+00 -2.00249656e+00  3.75e-10 7.76e-12  3.37e-04     0s
   4  -1.99999980e+00 -2.00000293e+00  4.02e-13 4.88e-15  3.92e-07     0s
   5  -2.00000000e+00 -2.00000000e+00  2.32e-11 1.29e-12  3.92e-10     0s

Barrier solved model in 5 iterations and 0.00 seconds
Optimal objective -2.00000000e+00

Solving KKT system to obtain QCP duals...

Optimize a model with 1 rows, 2 columns and 2 nonzeros
Presolve time: 0.00s
Presolved: 1 rows, 2 columns, 2 nonzeros
Ordering time: 0.00s

Barrier statistics:
 AA' NZ     : 0.000e+00
 Factor NZ  : 1.000e+00
 Factor Ops : 1.000e+00 (less than 1 second per iteration)
 Threads    : 1

                  Objective                Residual
Iter       Primal          Dual         Primal    Dual     Compl     Time
   0   4.99999500e+05 -5.19991353e+05  9.97e+02 5.00e+02  1.00e+06     0s
   1   4.39007151e+03 -2.34434851e+04  1.25e+02 3.16e+01  6.73e+04     0s
   2   2.14689407e+01 -1.76970139e+04  0.00e+00 3.16e-05  3.54e+03     0s
   3   2.14641519e+01 -5.28909679e+01  0.00e+00 1.01e-07  1.49e+01     0s
   4   6.99898860e+00 -1.95012065e+01  0.00e+00 1.01e-13  5.30e+00     0s
   5  -7.16551769e-01 -6.17996811e+00  0.00e+00 8.88e-16  1.09e+00     0s
   6  -1.94060202e+00 -2.12813568e+00  0.00e+00 0.00e+00  3.75e-02     0s
   7  -1.99994227e+00 -2.00013317e+00  0.00e+00 0.00e+00  3.82e-05     0s
   8  -1.99999994e+00 -2.00000013e+00  0.00e+00 2.22e-16  3.82e-08     0s
   9  -2.00000000e+00 -2.00000000e+00  0.00e+00 0.00e+00  3.83e-11     0s

Barrier solved model in 9 iterations and 0.00 seconds
Optimal objective -2.00000000e+00


ERROR: assertion failed: |:(modQ.objVal) - :(-(-1,/(4,sqrt(3))))| <= 1.0e-6
  :(modQ.objVal) = -1.9999999997966855
  :(-(-1,/(4,sqrt(3)))) = -3.3094010767585034
  difference = 1.3094010769618178 > 1.0e-6
 in error at error.jl:22
 in test_approx_eq at test.jl:78
 in anonymous at no file:17
 in include at boot.jl:238
at /home/mlubin/.julia/JuMP/test/qcqpmodel.jl:43
at /home/mlubin/.julia/JuMP/test/runtests.jl:18

@joehuchette

quadratic objective weirdness

using MathProg
setLPSolver(:Gurobi)

m = Model(:Min)

@defVar(m, x)

setObjective(m, (x-1)*(x-1))
solve(m)
xval = getValue(x)
println(xval)
println(getObjectiveValue(m)," ", (xval-1)*(xval-1))

prints:

Optimize a model with 0 rows, 1 columns and 0 nonzeros
Model has 1 quadratic objective term
Presolve removed 0 rows and 1 columns
Presolve time: 0.00s
Presolve: All rows and columns removed

Barrier solved model in 0 iterations and 0.00 seconds
Optimal objective -2.50000000e-01
0.5
0.75 0.25

What's going on?

quadratic objective support

  • Complete operator overloads, e.g. AffExpr*Variable
  • Get rid of objIsQuad structure -- it really messes with type inference. Instead there should be separate quadratic and linear parts of the objective as members of Model. If there is a quadratic part, then m.affobj can point to the same object as m.quadobj.aff, for example.
  • Clean up and document using Gurobi for quadratic objectives, as added in 3db9f64. Alternatively (in the long term) push this into MathProgBase.
  • Macro support.

Speed regression tests

Put some stuff from paper in and put a loop around it just to quickly check for regressions?
Maybe do a non-macro version too.

Constraints

Are we happy with how constraints are defined? It doesn't make much sense as it is, given that the affine expression part has the constant in it anyway. Then there is the range constraint question, and quadratic constraints.

repl printing of constraints is broken

julia> m = Model("max")
Model(0,0,false,"max",[],0,[],[],[],[],0,[],nothing,Dict{Any,Any}())

julia> @defVar(m, x)
Variable(Model(0,0,false,"max",[],1,["x"],[-Inf],[Inf],[0],0,[],nothing,Dict{Any,Any}()),1)

julia> @addConstraint(m, x == 1)
1-element Constraint Array:
^CError showing value of type Array{Constraint,1}:
ERROR: interrupt
 in stupdate at inference.jl:970
 in typeinf at inference.jl:1276
 in abstract_call_gf at inference.jl:557
 in abstract_call at inference.jl:607
 in abstract_eval_call at inference.jl:712
 in abstract_eval at inference.jl:745
 in abstract_eval_arg at inference.jl:681
 in typeinf at inference.jl:1234
 in abstract_call_gf at inference.jl:557
 in abstract_call at inference.jl:607
 in abstract_eval_call at inference.jl:712
 in abstract_eval at inference.jl:745
 in abstract_eval_arg at inference.jl:681
 in typeinf at inference.jl:1234
 in abstract_call_gf at inference.jl:557
 in abstract_call at inference.jl:607
 in abstract_eval_call at inference.jl:712
 in abstract_eval at inference.jl:745
 in abstract_interpret at inference.jl:893
 in typeinf at inference.jl:1186
 in type_annotate at inference.jl:1431
 in typeinf at inference.jl:1289
 in abstract_call_gf at inference.jl:557
 in abstract_call at inference.jl:607
 in abstract_eval_call at inference.jl:712
 in abstract_eval at inference.jl:745
 in abstract_eval_arg at inference.jl:681
 in typeinf at inference.jl:1234
 in abstract_call_gf at inference.jl:557
 in abstract_call at inference.jl:607
 in abstract_eval_call at inference.jl:712
 in abstract_eval at inference.jl:745
 in abstract_interpret at inference.jl:893
 in typeinf at inference.jl:1186
 in typeinf_ext at inference.jl:1018
 in show at show.jl:19
 in showcompact at show.jl:71
 in sprint at io.jl:385
 in alignment at show.jl:634
 in print_matrix at show.jl:705
 in repl_show at repl.jl:9

julia> ^C

I think it's caught in an infinite loop because the variables have a reference to the model. We need to overload the appropriate function so this doesn't happen.

Aliases

We have the abbreviated defVar, and the long addConstraint and setObjective

Maybe we should have
defineVariable
addConstraint
setObjective

and
defVar
addCon
setObj

?

Create getters/setters for Model

I feel like accessing the values of Model in a raw fashion is not in keeping with everything else - it looks weird next to getValue() in particular

documentation update

The function listing contains some out of date information and isn't very clear what's going on with the operator overloading interface (now that we use it officially for QPs).

Openblas segfault with Cbc

Hi,
I've tried to run the combination lock example
http://iaindunning.com/2013/combination-locks.html

require("comblock")
Segmentation fault: 11

Further investigation shows the segmentation fault is occuring somewhere in the
solve command.

julia> versioninfo()
Julia Version 0.2.0-prerelease+3937
Commit 4666764* 2013-10-05 23:49:45 UTC
Platform Info:
System: Darwin (x86_64-apple-darwin12.5.0)
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY)
LAPACK: libopenblas
LIBM: libopenlibm

accessing row duals

We need user-facing Constraint objects through which solution information (e.g. dual variables) can be accessed. There should be a user-constructable MathProgDict of Constraints for convenience.

Solving problem with bounds but no constraints with Cbc causes error

ERROR: f not defined
in LoadMatrix at /home/idunning/.julia/Cbc/src/Cbc.jl:65
in loadproblem at /home/idunning/.julia/Cbc/src/CbcSolverInterface.jl:33
in solveMIP at /home/idunning/.julia/JuMP/src/solvers.jl:151
in solve at /home/idunning/.julia/JuMP/src/solvers.jl:15
in SolveSubproblem at /home/idunning/Dropbox/Optimize Quest/Julia/vrp.jl:84

Just needs a better error message I guess, or no error message at all ideally.

Constraints could be parametric

For example:

  • Constraint{AffExpr{Float64,Variable}}
  • Constraint{QuadExpr}
  • Constraint{AffExpr{Float64, Uncertain}}
  • Constraint{AffExpr{AffExpr{Float64, Uncertain}, Variable}}

travis failure?

Not really sure what's going on there. Can't reproduce it locally.

Cool!

Looks interesting! You presumably saw my SymbolicLP package; it looks like we followed partially parallel paths in some areas, but with big differences too. Sorry I didn't announce that earlier, I had it mostly in shape by New Year's but just never got around to announcing it.

I guess I should ask, is there any profit in merging them? I haven't really looked through your code seriously. In some ways it looks like the parsing is currently a bit further along in mine, but you have a big push to support other (more powerful) solvers. In the long run, from what I know of your interests I suspect you guys will devote more love to LP than I, and will generate and maintain a more capable package. For that reason, I'm happy contributing to your package/having you steal stuff/whatever, if you think it makes sense.

OTOH, since I got my package to the point where it seems to do what I think I need, we can alternatively just leave the two sitting around and let people make whatever choices they want.

File split?

How do we feel about splitting up MathProg.jl into separate files?
Perhaps:
MathProg.jl (object definitions)
operators.jl
write.jl
solve.jl
I'm not totally bothered about this, I just get worried looking at a 800 line file that has such clear demarcations

Quadratic objective macros

The @setObjective macro does not currently work for quadratic objectives (although setObjective works fine)
(See #11)

Change syntax for setting solver

Write MathProgBase.setlpsolver(...) is not only cumbersome, its also a bit weird because the user doesn't explicity import MathProgBase. It is also the only function that doesn't use camel-case (unlike the rest of MathProg).

Is there any reason to not export setlpsolver/setmipsolver from MathProg?
And as for camel-case...

TODO List

Documentation (@IainNZ @mlubin @joehuchette)

  • Figure out platform (@mlubin)
  • Do it!
  • Lots of examples

General Infrastructure

  • Parametric affine expressions
  • More regular testing on Windows

Problem modification

  • Determine where the column-wise problem representation is kept
  • Add methods to JuMP
  • Make sure all the interfaces are working
  • Develop example, e.g. column/row generation
  • Speculative: automatic DW/LR/Benders reformulations ala Dip/Dippy

Nonlinear

  • IPOPT.jl interface
  • Store the expression trees with the model
  • Syntax of adding a NL constraint
  • Integrate NLTester code into JuMP
  • Factor out/share chain rule stuff with rest of Julia package ecosystem
  • Tests
  • Document

Robust (@IainNZ)

  • Complete overloads for Uncertain/UAffExpr/FullAffExpr (2013/9/21)
  • Create solve(m::RobustModel, solveMethod::Symbol)
  • Implement reformulation
  • Implement cutting plane
  • Allow user to give initial cut set
  • Allow variables to be defined as affinely adaptive
  • Allow variables to be defined as finitely adaptive (Iain research related)

Disjunctive (@mlubin @joehuchette)

  • Speculate on what this looks like

Other ideas

  • OpenSolver SolverStudio integration on Windows (@IainNZ)
  • SDPs

Absolute values in objective/constraints

Essentially, this would be some way to add absolute value terms to the model without forcing the user to deal with the proliferation of auxiliary variables/constraints themselves. More generally, this approach could be applied to other things that can be modeled via LP but require some kind of problem transformation (e.g. convex piecewise linear), but absolute value seems the most immediate (and useful, for my research).

Something wrong with QCP example?

@joehuchette

idunning@IAINLAPTOP:~/.../JuMP/examples$ julia qcp.jl 
Max 1.0 x
Subject to: 
1.0 x + 1.0 y + 1.0 z == 1.0
1.0 x*x + 1.0 y*y - 1.0 z*z <= 0
1.0 x*x - 1.0 y*z <= 0
-Inf <= x <= Inf
-Inf <= y <= Inf
-Inf <= z <= Inf
Optimize a model with 1 rows, 4 columns and 4 nonzeros
Model has 2 quadratic constraints
Presolve removed 0 rows and 1 columns
Presolve time: 0.00s
ERROR: GurobiError(10020,"Q matrix is not positive semi-definite (PSD)")
 in optimize at /home/idunning/.julia/Gurobi/src/grb_solve.jl:7
 in optimize at /home/idunning/.julia/Gurobi/src/GurobiSolverInterface.jl:104
 in solveLP at /home/idunning/.julia/JuMP/src/solvers.jl:152
 in solve at /home/idunning/.julia/JuMP/src/solvers.jl:12
 in include at boot.jl:238
 in include_from_node1 at loading.jl:96
 in process_options at client.jl:275
 in _start at client.jl:351
at /home/idunning/.julia/JuMP/examples/qcp.jl:39

use MathProgBase lp/mip interface

In preparation for #2 we have to switch over to using the state-based solver interface from MathProgBase. This would be a good opportunity to support reoptimization and LP hot-starts, but it will require some reorganization.

Missing addToExpression overload?

@setObjective(mod, (x + y)/2.0)

Kills it with
ERROR: no method addToExpression(AffExpr,Float64,AffExpr)

Is it as simple a matter as adding the overload?

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.