Setting environment variables for a package "SCIP"

What is the output of ] st? You probably need SCIP.jl v0.9.5.


I tried to install this version and it showed successful build

(@v1.4) pkg> add SCIP@v0.9.5

then I added the environment

ENV["SCIPOPTDIR"] = "C:\\Program Files\\SCIPOptSuite 7.0.1"

then I build the solver

(@v1.4) pkg> build SCIP@v0.9.5

It showed successful build

Now I am trying to use it

using SCIP
using JuMP

optimizer = SCIP.Optimizer()
MOI.set(optimizer, SCIP.Param("display/verblevel"), 0)
MOI.set(optimizer, SCIP.Param("limits/gap"), 0.05)
m = Model(with_optimizer(optimizer, print_level=0))`

but it does not work

The syntax is

model = Model(SCIP.Optimizer)
set_optimizer_attribute(model, "display/verblevel", 0)
set_optimizer_attribute(model, "limits/gap", 0.05)
1 Like

I tried it now and it worked…Thank you so much

1 Like

Hello @odow , can you tell me what does that mean pls ?

LoadError: InitError: SCIP is installed at version 7.0.1, supported are 6.0.0 up to (including) 7.0.0.
during initialization of module SCIP
in expression starting at D:\M A S T E R S S S S S S\chapter_4\work\codes\a-SCIP\ML-scip.jl:1
error(::String) at error.jl:33
__init__() at init.jl:16
_include_from_serialized(::String, ::Array{Any,1}) at loading.jl:697
_require_search_from_serialized(::Base.PkgId, ::String) at loading.jl:781
_require(::Base.PkgId) at loading.jl:1006
require(::Base.PkgId) at loading.jl:927
require(::Module, ::Symbol) at loading.jl:922

The next time, I ran the program, The error changes to…

LoadError: Unexpected quadratic expression 0 in nonlinear expression. Quadratic expressions (e.g., created using @expression) and nonlinear expressions cannot be mixed. in expression starting at D:\

It looks like 7.0.1 was only recently released, and SCIP.jl hasn’t been released with support. But you can get something working with ] add SCIP#master.

The second error is a JuMP message. Use @NLexpression instead of @expression when making nonlinear constraints. Here are the NLP docs for JuMP:

I will add the master now and tell you what happened
I use a combination of both in fact
NL expressions and expression
Let me show it

I use a combination of both in fact

Yes, hence the error.

You cannot use @expression in the nonlinear macros @NLxxx. Use @NLexpression instead.

Ok…I am trying now
in 5 minutes, I will update you

I added the master branch

m = Model(SCIP.Optimizer)
then this line returns an error

 Model not defined

I think…they need JuMP. before it

on line 86 …I am writing

LoadError: MethodError: no method matching getindex(::Symbol, ::Int64)

in expression starting at D:\M A S T E R S S S S S S\chapter_4\work\codes\a-SCIP\ML-scip.jl:86

push_expr!(::SCIP.NonlinExpr, ::SCIP.ManagedSCIP, ::Expr) at nonlinear.jl:35

add_nonlinear_constraint(::SCIP.ManagedSCIP, ::Expr, ::Float64, ::Float64) at nonlinear.jl:180

set(::SCIP.Optimizer, ::MathOptInterface.NLPBlock, ::MathOptInterface.NLPBlockData) at nonlinear_constraints.jl:17

I searched for something like @expressions but found only @expression and @NLexpressions
there is no way to add multiple expressions like @NLexpressions ??


I doubted that I am still confused between @expression , @NLexpression and @constraint
so I hashed everything but making a model and adding the variables and optimizing it
but I found that there is a compilaton error

LoadError: Failed to precompile SCIP [82193955-e24f-5292-bf16-6f2c5261a85f] to C:\Users\mayar.madboly\.julia\compiled\v1.4\SCIP\a0EUw_U5N9T.ji.

For the expression question, please read the first post of PSA: make it easier to help you and provide a minimal reproducible example.

For the compilation error, please exit Julia, restart, and if you still have the error, post the complete text of the error. Did you remember to set the SCIPOPTDIR environment variable?

yes I set it

for the macro @constraints, I can use it for something like that ?

JuMP.@constraints(m, begin
    Bus_VoltageMagnitude_Constraint[i in Nodes_set], (0.9)^2<=(vRe[i])^2+(vIm[i])^2 <=(1.06)^2
    Smax[i in Nodes_set, j in Nodes_set], pij[i,j]^2 + qij[i,j]^2 ≤ S[i,j]^2
    Reactive_Nodal_Balance[i in Nodes_set], sum(qij[i,j] for j in Nodes_set) == q[i]+Qd[i]
    Active_Nodal_Balance[i in Nodes_set], sum(pij[i,j] for j in Nodes_set) == p[i]+Pd[i]

given that qij and pij are defined using @expression not @NLexpression !

this is error

LoadError: MethodError: no method matching ^(::JuMP.GenericQuadExpr{Float64,JuMP.VariableRef}, ::Int64)
Closest candidates are:
  ^(!Matched::Float16, ::Integer) at math.jl:885
  ^(!Matched::Regex, ::Integer) at regex.jl:712
  ^(!Matched::Missing, ::Integer) at missing.jl:155
in expression starting at D:\M A S T E R S S S S S S\chapter_4\work\codes\a-SCIP\ML-scip.jl:88

Again, please provide a complete minimal working example. We need to see the code to offer advice.

If you are going to be building things that are not linear or quadratic, instead of

model = Model()
@variable(model, x)
@expression(model, ex, 2x + 1)
@constraint(model, ex^2 <= 1)


model = Model()
@variable(model, x)
@NLexpression(model, ex, 2x + 1)
@NLconstraint(model, ex^2 <= 1)
1 Like