Open mlubin opened 9 years ago
I think the BoundsError
s may be a JuMP bug. Looks like you might not be setting a variable type for norm aux variables? Adding a few @show
s to the setvartype!
method in CoinOptServices/src/probmod.jl
I get the following:
julia> using JuMP, CoinOptServices, FactCheck
julia> modN = Model(solver=OsilSolver())
Feasibility problem with:
* 0 linear constraints
* 0 variables
Solver set to Osil
julia> @defVar(modN, x)
x
julia> @defVar(modN, y)
y
julia> @defVar(modN, t >= 0)
t
julia> @setObjective(modN, Min, t)
t
julia> @addConstraint(modN, x + y >= 1)
x + y ≥ 1
julia> @addConstraint(modN, norm([x,y]) <= t)
√(x² + y²) ≤ t
julia>
julia> @fact solve(modN) --> :Optimal
vartypes => [:Cont,:Cont,:Cont]
i => 0
vari => <var lb="-Inf"/>
i => 1
vari => <var lb="-Inf"/>
i => 2
vari => <var lb="0.0"/>
i => 3
vari => <var lb="0.0"/>
Error :: (line:-1)
solve(modN) --> :Optimal
BoundsError()
in setvartype! at /home/tkelman/.julia/v0.3/CoinOptServices/src/probmod.jl:131
in buildInternalModel at /home/tkelman/.julia/v0.3/JuMP/src/solvers.jl:684
in solve at /home/tkelman/.julia/v0.3/JuMP/src/solvers.jl:47
in anonymous at /home/tkelman/.julia/v0.3/FactCheck/src/FactCheck.jl:218
in do_fact at /home/tkelman/.julia/v0.3/FactCheck/src/FactCheck.jl:277
CC @joehuchette
That's weird, JuMP shouldn't introduce any auxiliary variables. Is this going through the MPB-level conic->quadratic wrapper?
Probably, since I don't have the conic MPB API implemented here. Something is doubling the number of variables.
julia> modN.internalModel.instanceData
<instanceData>
<variables numberOfVariables="6">
<var lb="-Inf" type="C"/>
<var lb="-Inf" type="C"/>
<var lb="0.0" type="C"/>
<var lb="0.0"/>
<var lb="-Inf"/>
<var lb="-Inf"/>
</variables>
<objectives numberOfObjectives="1">
<obj maxOrMin="min" numberOfObjCoef="1">
<coef idx="2">1.0</coef>
</obj>
</objectives>
<constraints numberOfConstraints="5">
<con lb="1.0"/>
<con lb="-0.0" ub="-0.0"/>
<con lb="0.0" ub="0.0"/>
<con lb="0.0" ub="0.0"/>
<con ub="0.0"/>
</constraints>
<linearConstraintCoefficients numberOfValues="8">
<start>
<el>0</el>
<el>2</el>
<el>4</el>
<el>6</el>
<el>8</el>
<el>8</el>
</start>
<colIdx>
<el>0</el>
<el>1</el>
<el>2</el>
<el>3</el>
<el>0</el>
<el>4</el>
<el>1</el>
<el>5</el>
</colIdx>
<value>
<el>1.0</el>
<el>1.0</el>
<el>-1.0</el>
<el>1.0</el>
<el>-1.0</el>
<el>1.0</el>
<el>-1.0</el>
<el>1.0</el>
</value>
</linearConstraintCoefficients>
<quadraticCoefficients numberOfQuadraticTerms="3">
<qTerm idx="4" idxOne="3" idxTwo="3" coef="-1.0"/>
<qTerm idx="4" idxOne="4" idxTwo="4" coef="1.0"/>
<qTerm idx="4" idxOne="5" idxTwo="5" coef="1.0"/>
</quadraticCoefficients>
</instanceData>
Oh, the conic->quadratic wrapper will introduce extra variables, which JuMP isn't aware of. @tkelman, could you tweak the implementation of setvartype!
work when the length of the input is less than the number of variables? The remaining variables don't change type (i.e., they're continuous).
Providing a different number of variable types than variables seems like an iffy thing to do to a solver, but I'll make it a warning. I could have old variable types sitting around from a previous version of the problem that has been modified so I always need to set a type, but looks like if you introduce a new variable then the auxiliaries move to the end of the new problem.
The conic->quadratic wrapper always calls loadproblem!
, which should clear out any old problem data.
@joehuchette, what happens if you go through the conic->quadratic interface with Gurobi, solve, and then add a new variable inside JuMP?
It probably makes sense to do the conic->quad translation with a Wrapper type so that we can retain a variable mapping. This will also help with duals.
I think everything passes now with JuMP and CoinOptServices both on master, let me know if you see otherwise. There are some failures with OS 2.10.0 that I still need to report, but that's still in a PR.
If we figure out https://github.com/JuliaOpt/MathProgBase.jl/issues/73, then this wrapper business will be easier.
@tkelman, I'm still getting this error with CoinOptServices master:
[model] Test MIQP vectorization
Error :: (line:-1)
bestsubset(solver,X,y,2,500,false) --> roughly([101.789,49.414,8.63904,1.72663],10TOL)
failed process: Process(`/home/mlubin/.julia/v0.3/CoinOptServices/deps/usr/lib/../bin/OSSolverService -osil /home/mlubin/.julia/v0.3/CoinOptServices/.osil/problem.osil -osol /home/mlubin/.julia/v0.3/CoinOptServices/.osil/options.osol -osrl /home/mlubin/.julia/v0.3/CoinOptServices/.osil/results.osrl -printLevel 1`, ProcessSignaled(11)) [0]
in pipeline_error at process.jl:502
in optimize! at /home/mlubin/.julia/v0.3/CoinOptServices/src/CoinOptServices.jl:535
in solve at /home/mlubin/.julia/v0.3/JuMP/src/solvers.jl:49
in bestsubset at /home/mlubin/.julia/v0.4/JuMP/test/model.jl:625
in anonymous at /home/mlubin/.julia/v0.3/FactCheck/src/FactCheck.jl:218
in do_fact at /home/mlubin/.julia/v0.3/FactCheck/src/FactCheck.jl:277
in anonymous at /home/mlubin/.julia/v0.4/JuMP/test/model.jl:218
in facts at /home/mlubin/.julia/v0.3/FactCheck/src/FactCheck.jl:391
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in include at ./boot.jl:245
in include_from_node1 at loading.jl:128
in process_options at ./client.jl:285
in _start at ./client.jl:354
Error :: (line:-1)
bestsubset(solver,X,y,2,500,true) --> roughly([106.25,53.7799,0.0,0.0],10TOL)
failed process: Process(`/home/mlubin/.julia/v0.3/CoinOptServices/deps/usr/lib/../bin/OSSolverService -osil /home/mlubin/.julia/v0.3/CoinOptServices/.osil/problem.osil -osol /home/mlubin/.julia/v0.3/CoinOptServices/.osil/options.osol -osrl /home/mlubin/.julia/v0.3/CoinOptServices/.osil/results.osrl -solver bonmin -printLevel 1`, ProcessSignaled(11)) [0]
in pipeline_error at process.jl:502
in optimize! at /home/mlubin/.julia/v0.3/CoinOptServices/src/CoinOptServices.jl:535
in solve at /home/mlubin/.julia/v0.3/JuMP/src/solvers.jl:49
in bestsubset at /home/mlubin/.julia/v0.4/JuMP/test/model.jl:625
in anonymous at /home/mlubin/.julia/v0.3/FactCheck/src/FactCheck.jl:218
in do_fact at /home/mlubin/.julia/v0.3/FactCheck/src/FactCheck.jl:277
in anonymous at /home/mlubin/.julia/v0.4/JuMP/test/model.jl:218
in facts at /home/mlubin/.julia/v0.3/FactCheck/src/FactCheck.jl:391
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in include at ./boot.jl:245
in include_from_node1 at loading.jl:128
in process_options at ./client.jl:285
in _start at ./client.jl:354
NLP0012I
Num Status Obj It time Location
NLP0014I 1 OPT -7639415.2 8 0.076
NLP0014I 2 INFEAS 1 13 0.116
Coin0506I Presolve 49 (-1) rows, 18 (-5) columns and 124 (-19) elements
Clp0006I 0 Obj -5.7204592e+08 Primal inf 44942.181 (19) Dual inf 416619.86 (4)
Clp0006I 6 Obj -7.4747283e+08
Clp0000I Optimal - objective value -7.4747283e+08
Clp0032I Optimal objective -747472832.6 - 6 iterations time 0.002, Presolve 0.00
Clp0000I Optimal - objective value -7.4747283e+08
Couenne: new cutoff value 6.9896992684e-09 (8.568 seconds)
NLP Heuristic: time limit reached.
Clp0000I Optimal - objective value -7.4747283e+08
Optimality Based BT: Couenne: new cutoff value -3.7947771136e-07 (8.572 seconds)
0 improved bounds
Probing: 0 improved bounds
NLP Heuristic: no solution.
Optimality Based BT: 0 improved bounds
Optimality Based BT: 0 improved bounds
Couenne: new cutoff value -3.5143102592e+06 (8.936 seconds)
Couenne: new cutoff value -4.9832192005e+06 (9.332 seconds)
Couenne: new cutoff value -6.3172319400e+06 (9.764 seconds)
Couenne: new cutoff value -7.6295948429e+06 (9.944 seconds)
Couenne: new cutoff value -7.6295948429e+06 (10.384 seconds)
Couenne: new cutoff value -7.6295948429e+06 (11.496 seconds)
Error :: (line:-1)
bestsubset(solver,X,y,2,500,true) --> roughly([106.25,53.7799,0.0,0.0],10TOL)
failed process: Process(`/home/mlubin/.julia/v0.3/CoinOptServices/deps/usr/lib/../bin/OSSolverService -osil /home/mlubin/.julia/v0.3/CoinOptServices/.osil/problem.osil -osol /home/mlubin/.julia/v0.3/CoinOptServices/.osil/options.osol -osrl /home/mlubin/.julia/v0.3/CoinOptServices/.osil/results.osrl -solver couenne -printLevel 1`, ProcessSignaled(11)) [0]
in pipeline_error at process.jl:502
in optimize! at /home/mlubin/.julia/v0.3/CoinOptServices/src/CoinOptServices.jl:535
in solve at /home/mlubin/.julia/v0.3/JuMP/src/solvers.jl:49
in bestsubset at /home/mlubin/.julia/v0.4/JuMP/test/model.jl:625
in anonymous at /home/mlubin/.julia/v0.3/FactCheck/src/FactCheck.jl:218
in do_fact at /home/mlubin/.julia/v0.3/FactCheck/src/FactCheck.jl:277
in anonymous at /home/mlubin/.julia/v0.4/JuMP/test/model.jl:218
in facts at /home/mlubin/.julia/v0.3/FactCheck/src/FactCheck.jl:391
What versions of OS, Ipopt, and Cbc are in the respective deps/src
? And I guess you're running from an 0.4 checkout of JuMP in Julia 0.3? Doubt that matters but looks slightly funny.
Cbc 2.9.1, OS 2.9.2, and Ipopt 3.12.1. Yes, I have my JuMP symlinked between v0.3 and v0.4.
What distro? I can't seem to reproduce that locally on Ubuntu 14.04. Signal 11 is a segfault, so if you run just one of the tests that's failing to populate the osil file you should be able to reproduce by running the quoted OSSolverService
command outside of Julia. We aren't building OS with debug info enabled by default, so gdb might not be too helpful.
This is Ubuntu 15.04. I'll try to dig into the segfault.
@joehuchette, what happens if you go through the conic->quadratic interface with Gurobi, solve, and then add a new variable inside JuMP?
Not sure, but it should be tested and should Just Work. I'll test it sometime over the next few days.
Recompiled with debug symbols, here's the backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff613d509 in __GI___libc_malloc (bytes=537) at malloc.c:2895
2895 malloc.c: No such file or directory.
(gdb) bt
#0 0x00007ffff613d509 in __GI___libc_malloc (bytes=537) at malloc.c:2895
#1 0x00007ffff66f8698 in operator new(unsigned long) ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#2 0x00007ffff675c6f9 in std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007ffff675d39b in std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007ffff675d450 in std::string::reserve(unsigned long) ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007ffff6737d64 in std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::overflow(int) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00007ffff673c005 in std::basic_streambuf<char, std::char_traits<char> >::xsputn(char const*, long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7 0x00007ffff6732a66 in std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#8 0x00007ffff6732e77 in std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#9 0x00007ffff7646bf3 in OSnLNodePlus::~OSnLNodePlus (this=0xba9500,
__in_chrg=<optimized out>)
at ../../../../OS/src/OSCommonInterfaces/OSnLNode.cpp:605
The lines in question are:
std::ostringstream outStr;
#ifndef NDEBUG
outStr << "inside OSnLNodePlus destructor" << endl;
Will try running valgrind next
Oh whoops, I actually just reproduced this in a docker container of 15.04 and sent a message to the OS mailing list (cc'ed you), but I wasn't getting a backtrace.
I'm also getting an issue on win64, julia 0.3.8:
[model] Test MIQP vectorization
Optimization Services Solver
Main Authors: Horand Gassmann, Jun Ma, and Kipp Martin
Distributed under the Eclipse Public License
OS Version: 2.9.2
Error :: (line:-1)
bestsubset(solver,X,y,2,500,false) --> roughly([101.789,49.414,8.63904,1.726
63],10TOL)
A s s e r t i o n f a i l e d !
P r o g r a m : C : \ U s e r s \ m l u b i n \ D e s k t o p \ w i n 6 4 \ J
u l i a - 0 . 3 . 8 \ b i n \ j u l i a . e x e
F i l e : s r c / u v - c o m m o n . c , L i n e 8 3
E x p r e s s i o n : 0
On Windows the backtrace shows 14000+ levels of OSnLNodePlus::constructADTape
which can't be healthy. Should there be a "combine duplicates" pass somewhere? If so, where?
These problem seem pretty small, how can the depth get to 14000+?
There are 16000 coefficients since JuMP does no presolve aggregation.
We could (and probably should) combine coefficients inside of JuMP, but all of the other solvers seem to handle duplicate coefficients in a reasonable way.
Yeah, was going to see how big the .nl file would get for this problem but the quadratic API isn't implemented in AmplNLWriter. May want to just take CoinOptServices off the quadratic solvers test list for now. Maybe only continuous if Bonmin and Couenne are working on this problem?
In the docker container of 15.04 where I was able to reproduce these failures, it looks like they're fixed with OS 2.10.0 (#5). Still need to re-test separately on Windows. There are a separate set of new failures all in nonlinear tests, but at least they aren't segfaults AFAICT.
On JuMP master, Julia 0.3.11, linux, I'm getting the following failures with OsilSolver.