HerAdri
1
When I try to run JuMP packets, GLPK with the command
using JuMP, GLPK
I get the following alert:
m = Model(GLPK.Optimizer)
ERROR: MethodError: no method matching Model(::Type{GLPK.Optimizer})
Closest candidates are:
Model(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at C:\Users\hermesr\.julia\packages\JuMP\iGamg\src\JuMP.jl:126
Model(; caching_mode, solver) at C:\Users\hermesr\.julia\packages\JuMP\iGamg\src\JuMP.jl:161
Model(::MathOptInterface.AbstractOptimizer, ::Dict{MathOptInterface.ConstraintIndex,AbstractShape}, ::Set{Any}, ::Any, ::Any, ::Dict{Symbol,Any}, ::Int64, ::Dict{Symbol,Any}) at C:\Users\hermesr\.julia\packages\JuMP\iGamg\src\JuMP.jl:126
...
Stacktrace:
[1] top-level scope at REPL[11]:1
[2] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1088
#
(@ v1.5)pkg> st -m JuMP
[4076af6c] JuMP v0.21.3
(@ v1.5) pkg> st -m GLPK
[60bf3e95] GLPK v0.13.0
1 Like
odow
2
Quit Julia and open a new instance of the REPL to load the latest versions.
It looks like you have the old version of JuMP in memory, so I guess you updated in this session?
HerAdri
3
Now the following alert is presented:
Julia>@constraints(m, begin
3x + 5y + 2z == 12,
2x + 5y - 4z == 9,
4x - y + 5z == -3
end)
ERROR: In `@constraint(m, 3x + 5y + 2z == 12, (2x + 5y) - 4z == 9, (4x - y) + 5z == -3)`: Too many arguments.
Stacktrace:
[1] error(::String, ::String) at .\error.jl:42
[2] _macro_error(::Symbol, ::Array{Any,1}, ::String) at C:\Users\hermesr\.julia\packages\JuMP\YXK4e\src\macros.jl:894
[3] (::JuMP.var"#_error#68"{Symbol})(::String) at C:\Users\hermesr\.julia\packages\JuMP\YXK4e\src\macros.jl:366
[4] _constraint_macro(::Tuple{Symbol,Expr,Expr,Expr}, ::Symbol, ::typeof(parse_constraint_expr)) at C:\Users\hermesr\.julia\packages\JuMP\YXK4e\src\macros.jl:385
[5] @constraint(::LineNumberNode, ::Module, ::Vararg{Any,N} where N) at C:\Users\hermesr\.julia\packages\JuMP\YXK4e\src\macros.jl:490 [6] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1088
@constraints(m, begin
3x + 5y + 2z == 12
2x + 5y - 4z == 9
4x - y + 5z == -3
end)
no commas after the expressions.
HerAdri
5
OK;
@constraints(m, begin
3x + 5y + 2z == 12
2x + 5y - 4z == 9
4x - y + 5z == -3
end)
Julia>optimize!(m)
Julia>value.((x,y,z))
11:07:17->>(-0.8918918918918918, 2.675675675675676, 0.6486486486486487)
1 Like