# Setting environment variables for a package "SCIP"

**URL:** <https://discourse.julialang.org/t/setting-environment-variables-for-a-package-scip/43839>\
**Category:** Optimization (Mathematical)\
**Created:** [July 28, 2020, 9:12pm UTC](https://discourse.julialang.org/t/setting-environment-variables-for-a-package-scip/43839 "2020-07-28T21:12:45Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 31, 2020, 4:09pm UTC](https://discourse.julialang.org/t/setting-environment-variables-for-a-package-scip/43839/21 "2020-07-31T16:09:19Z")

</div>

on line 86 …I am writing

```julia
JuMP.optimize!(m)

```

```julia
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

```

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 31, 2020, 4:16pm UTC](https://discourse.julialang.org/t/setting-environment-variables-for-a-package-scip/43839/22 "2020-07-31T16:16:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 31, 2020, 4:39pm UTC](https://discourse.julialang.org/t/setting-environment-variables-for-a-package-scip/43839/23 "2020-07-31T16:39:33Z")

</div>

@odow

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

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

```

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [July 31, 2020, 4:51pm UTC](https://discourse.julialang.org/t/setting-environment-variables-for-a-package-scip/43839/24 "2020-07-31T16:51:47Z")

</div>

For the expression question, please read the first post of [Please read: make it easier to help you - #81](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757/81) 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?

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 31, 2020, 5:21pm UTC](https://discourse.julialang.org/t/setting-environment-variables-for-a-package-scip/43839/25 "2020-07-31T17:21:35Z")

</div>

yes I set it

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 31, 2020, 5:31pm UTC](https://discourse.julialang.org/t/setting-environment-variables-for-a-package-scip/43839/26 "2020-07-31T17:31:00Z")

</div>

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

```julia
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]
end)

```

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

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 31, 2020, 5:51pm UTC](https://discourse.julialang.org/t/setting-environment-variables-for-a-package-scip/43839/27 "2020-07-31T17:51:44Z")

</div>

this is error

```julia
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

```

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [July 31, 2020, 9:46pm UTC](https://discourse.julialang.org/t/setting-environment-variables-for-a-package-scip/43839/28 "2020-07-31T21:46:07Z")

</div>

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

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

```

use

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

```

[Previous page](https://discourse.julialang.org/t/setting-environment-variables-for-a-package-scip/43839.md?page=1)
