Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting MemLimit parameter #463

Closed
YoungFaithful opened this issue Mar 24, 2022 · 2 comments
Closed

Setting MemLimit parameter #463

YoungFaithful opened this issue Mar 24, 2022 · 2 comments

Comments

@YoungFaithful
Copy link

Using the MemLimit parameter leads to the following issue:


julia> using JuMP, Gurobi

julia> model = Model(Gurobi.Optimizer)
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: Gurobi
julia> set_optimizer_attribute(model, "MemLimit", 100)
ERROR: Gurobi Error 10003: Unable to modify parameter MemLimit after environment started
Stacktrace:
 [1] _check_ret
   @ ~/.julia/packages/Gurobi/A9YqC/src/MOI_wrapper/MOI_wrapper.jl:350 [inlined]
 [2] set(model::Gurobi.Optimizer, raw::MathOptInterface.RawOptimizerAttribute, value::Int64)
   @ Gurobi ~/.julia/packages/Gurobi/A9YqC/src/MOI_wrapper/MOI_wrapper.jl:602
 [3] set
   @ ~/.julia/packages/MathOptInterface/eoIu0/src/Bridges/bridge_optimizer.jl:839 [inlined]
 [4] set(model::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{Gurobi.Optimizer}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}, attr::MathOptInterface.RawOptimizerAttribute, value::Int64)
   @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/eoIu0/src/Utilities/cachingoptimizer.jl:979
 [5] set(m::Model, attr::MathOptInterface.RawOptimizerAttribute, value::Int64)
   @ JuMP ~/.julia/packages/JuMP/2IF9U/src/JuMP.jl:1294
 [6] set_optimizer_attribute
   @ ~/.julia/packages/JuMP/2IF9U/src/JuMP.jl:896 [inlined]
 [7] set_optimizer_attribute(model::Model, name::String, value::Int64)
   @ JuMP ~/.julia/packages/JuMP/2IF9U/src/JuMP.jl:870
 [8] top-level scope
   @ REPL[4]:1

julia> 

It is necessary first to set up the Env and then create the model:

Set parameter ServerPassword
Set parameter TokenServer to value "35.242.224.71"
Gurobi.Env(Ptr{Nothing} @0x0000000003d55380, false, 0)

julia> Gurobi.GRBsetintparam(env, "MemLimit", 10)
10007

julia> model = Model(() -> Gurobi.Optimizer(env))
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: Gurobi

julia> 

Do you see a possibility of changing the package to avoid the workaround?

@mlubin
Copy link
Member

mlubin commented Mar 24, 2022

Unlikely. Gurobi's documentation instructs users to do the exact workaround you used:

This parameter must be set when the Gurobi environment is first created. You will need to create an empty environment, set the parameter, and then start the environment.

@odow
Copy link
Member

odow commented Mar 24, 2022

Closing because this is intended behavior from Gurobi. The error isn't coming from the design of Gurobi.jl.

@odow odow closed this as completed Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants