Comments (11)
The MathProgBase documentation gives the signature as
setlazycallback!(m::AbstractLinearQuadraticModel, f)
So if we actually used SCIPNonlinearModel
then I would believe this to be the issue. But anyway in NonlinearModel(s::SCIPSolver)
we return a SCIPMathProgModel
which is in fact an AbstractNonlinearModel
?!
from scip.jl.
Is this a restriction inherent in JuMP or MathProgBase?
It's not in MathProgBase or JuMP only because we've never put effort into supporting callbacks for nonlinear solvers. I would support tweaking the wording to make it clear that callbacks may be implemented in nonlinear models. JuMP will need a few small changes to set up the callbacks for nonlinear model, shouldn't be too difficult.
But anyway in
NonlinearModel(s::SCIPSolver)
we return aSCIPMathProgModel
which is in fact anAbstractNonlinearModel
?!
That's not good. There should be a wrapper type which implements AbstractNonlinearModel
a lot of the other solver interfaces do this.
from scip.jl.
Thanks for the info, @mlubin.
JuMP will need a few small changes to set up the callbacks for nonlinear model, shouldn't be too difficult.
Sounds good, should I open an issue for this?
There should be a wrapper type which implements AbstractNonlinearModel a lot of the other solver interfaces do this.
Can you give me an example? I've looked at the code for some solver interfaces, such as IPOPT, Xpress or KNITRO, but they all only implement one type of AbstractLinearQuadraticModel
or AbstractNonlinearModel
and then use a NonlinearToLPQPBridge
to provide also the other. Is that what you suggest for SCIP.jl also?
The issue I see is that if we use separate subtypes for AbstractNonlinearModel
and AbstractLinearQuadraticModel
, there would be a lot of duplicate methods, and only loadproblem!
would really make this distinction.
What I'd like to do here is something like this:
abstract SCIPModel <: AbstractMathProgModel
type SCIPNonlinearModel <: AbstractNonlinearModel end
type SCIPLinearQuadraticModel <: AbstractLinearQuadraticModel end
but have the latter concrete types also be subtype of SCIPModel
so that we can use SCIPModel
to provide the common implemenation of functions such as getsolvetime
or numvar
.
I believe that multiple inheritance is not possible in Julia, but is this maybe a use case for union types?
from scip.jl.
Another thing I just noticed: The MPB doc says that setwarmstart!
takes an AbstractLinearQuadraticModel
. But really, it's also called by JuMP for AbstractNonlinearModel
(see _buildInternalModel_nlp
).
from scip.jl.
The MPB doc says that setwarmstart! takes an AbstractLinearQuadraticModel. But really, it's also called by JuMP for AbstractNonlinearModel (see _buildInternalModel_nlp).
Yes, that's worth fixing. PRs are welcome.
from scip.jl.
I tried running my example above using the change in JuMP/#878 and it kind of worked:
<<< Now try with nonlinear constraints:
### lazycb is called! (1)
[src/scip/scip.c:19502] ERROR: invalid SCIP stage <3>
[src/scip/cons_linear.c:640] ERROR: Error <-8> in function call
[src/scip/cons_linear.c:3513] ERROR: Error <-8> in function call
[src/scip/cons_linear.c:16568] ERROR: Error <-8> in function call
Failing with retcode 1 at 118
Failing with retcode 1 at 1374
### lazycb is called! (2)
presolving (16 rounds: 16 fast, 3 medium, 3 exhaustive):
16 deleted vars, 20 deleted constraints, 14 added constraints, 44 tightened bounds, 0 added holes, 0 changed sides, 1 changed coefficients
9 implications, 0 cliques
presolved problem has 13 variables (0 bin, 0 int, 0 impl, 13 cont) and 6 constraints
### lazycb is called! (3)
[...]
So the callback is definitely called, but there is some SCIP stage issue (3 = transformed). I don't know yet whether that issue should be dealt with on the CSIP side. I'm guessing it is triggered by the (all-0) warmstart solution added by JuMP for NLPs.
from scip.jl.
I tried the same again, using SCIP in debug mode (OPT=dbg
):
[src/scip/scip.c:247] ERROR: cannot call method <SCIPlockVarCons> in problem transformed stage
[src/scip/scip.c:19464] ERROR: Error <-8> in function call
[src/scip/cons_linear.c:640] ERROR: Error <-8> in function call
[src/scip/cons_linear.c:3513] ERROR: Error <-8> in function call
[src/scip/cons_linear.c:16568] ERROR: Error <-8> in function call
[...]
julia: src/scip/cons_linear.c:770: consCatchAllEvents: Assertion `consdata->eventdata == ((void *)0)' failed.
[...]
while loading /home/bzfschwa/.julia/v0.5/PipeLayout/examples/minlp_callbacks.jl, in expression starting on line 48
[...]
consCatchAllEvents at /home/bzfschwa/src/scipoptsuite/scip-3.2.1/src/scip/cons_linear.c:770
consInitLinear at /home/bzfschwa/src/scipoptsuite/scip-3.2.1/src/scip/cons_linear.c:13771
SCIPconshdlrInit at /home/bzfschwa/src/scipoptsuite/scip-3.2.1/src/scip/cons.c:2389
SCIPsetInitPlugins at /home/bzfschwa/src/scipoptsuite/scip-3.2.1/src/scip/set.c:4308
SCIPtransformProb at /home/bzfschwa/src/scipoptsuite/scip-3.2.1/src/scip/scip.c:12817
SCIPpresolve at /home/bzfschwa/src/scipoptsuite/scip-3.2.1/src/scip/scip.c:14366
SCIPsolve at /home/bzfschwa/src/scipoptsuite/scip-3.2.1/src/scip/scip.c:14581
CSIPsolve at /home/bzfschwa/.julia/v0.5/SCIP/deps/usr/lib/libcsip.so (unknown line)
optimize! at /home/bzfschwa/.julia/v0.5/SCIP/src/mpb_interface.jl:52
@fserra: Does that mean anything to you?
I double-checked and I create a "fresh" SCIPSolver
object for this second run. Also, the same happens when I only run the second part.
from scip.jl.
I think that the error message and the failing assertion are actually not directly related.
from scip.jl.
OK, we have a workaround for the SCIP stage problem in CSIP, then we're good.
from scip.jl.
CSIP is updated, now we only need the change in JuMP merged.
from scip.jl.
The relevant PR JuMP.jl/#894 was already merged.
from scip.jl.
Related Issues (20)
- SCIP fails when a problem is read from a file HOT 3
- SCIP craches due to symbol lookup error HOT 5
- Can I develop models in Julia and solve them in Python? HOT 6
- SCIP 8.0 support?! HOT 1
- SCIP EXCEPTION_ACCESS_VIOLATION In JuMP 1.1.0 and SCIP V0.11.3 on Windows 11 HOT 26
- How to trigger SCIPsolveConcurrent? HOT 3
- Multiple threads HOT 10
- SCIP not working on Windows HOT 4
- Crash When Optimizing HOT 15
- Get original variables from constraint
- Collect all feasible solutions HOT 4
- Cannot install globally in Windows HOT 1
- [EXCEPTION_ACCESS_VIOLATION] Julia 1.8.5 incompatibility with SCIP v0.11.12 HOT 1
- MultipleObjectiveAlgorithms usage HOT 1
- Implement LazyConstraint from ConstraintHandler HOT 4
- SCIP solver -- issue in "quadratic_constraints.jl". HOT 2
- Not solving the optimization model with the SCIP solver HOT 12
- `MathOptInterface.ScalarNonlinearFunction` not supported by the solver HOT 9
- A new release is probably warranted - `is_valid()` is broken in `v0.11.14`
- How to get ConstraintDual? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scip.jl.