jump-dev / jump.jl Goto Github PK
View Code? Open in Web Editor NEWModeling language for Mathematical Optimization (linear, mixed-integer, conic, semidefinite, nonlinear)
Home Page: http://jump.dev/JuMP.jl/
License: Other
Modeling language for Mathematical Optimization (linear, mixed-integer, conic, semidefinite, nonlinear)
Home Page: http://jump.dev/JuMP.jl/
License: Other
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.
Makes collecting all variables coefficients together not work.
Potential idea to speed up JuMPDict when not indexed by an integer range.
The @setObjective macro does not currently work for quadratic objectives (although setObjective works fine)
(See #11)
Currently getValue works for JuMPDict but the other setters/getters don't. Should we make them work for those too?
Since Jeff patched it in?
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.
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.
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 Constraint
s for convenience.
Codespeed?
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
).
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?
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
Not really sure what's going on there. Can't reproduce it locally.
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!
after JuliaLang/julia#3346 is resolved.
Quadratic part isn't sign flipped.
Allow modifying and resolving instances.
e.g. AffExpr(coeffType, variableType)
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.
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...
For example:
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).
Related to ability to pass options to solvers
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
Have an interface function for each solver that reports whether it accepts quadratic objectives objectives and constraints?, then add new functions to set the quadratic objective to the interface.
Add optional dependency and support for @lindahua's interface for Gurobi.
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.
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
@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?
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.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
... because it is provides nice consistency (and throws unpleasant error if you do it currently)
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.
$ 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
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).
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
e.g. setObjective(Model, Variable)
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
We have the abbreviated defVar, and the long addConstraint and setObjective
Maybe we should have
defineVariable
addConstraint
setObjective
and
defVar
addCon
setObj
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.