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

Support of JuMP expressions #27

Closed
persiflex opened this issue Mar 23, 2020 · 1 comment · Fixed by #90
Closed

Support of JuMP expressions #27

persiflex opened this issue Mar 23, 2020 · 1 comment · Fixed by #90

Comments

@persiflex
Copy link
Contributor

persiflex commented Mar 23, 2020

Hi again,

Nothing urgent I'd say, but it would be nice being able to allow for the possibility foreseen in JuMP of creating expressions (http://www.juliaopt.org/JuMP.jl/v0.20.0/expressions/). While this functionality can in principle also be achieved by the creation of derived variables plus their constraints, the expression mechanism allows for cleaner and more compact model formulations.

When applying Coluna to a model that contains expressions, the currently thrown error is

ERROR: LoadError: MethodError: no method matching setannotation!(::Model, ::Int64, ::BlockDecomposition.Annotation{Int64,BlockDecomposition.Master,BlockDecomposition.DantzigWolfe})                                                                                       
Closest candidates are: 
  setannotation!(::Any, ::ConstraintRef, ::Any) at .julia/dev/BlockDecomposition/src/decomposition.jl:84 
  setannotation!(::Any, ::VariableRef, ::Any) at .julia/dev/BlockDecomposition/src/decomposition.jl:85 
Stacktrace: 
 [1] _annotate_elements!(::Model, ::JuMP.Containers.DenseAxisArray{Real,2,Tuple{Array{Symbol,1},Array{Symbol,1}},Tuple{Dict{Symbol,In
t64},Dict{Symbol,Int64}}}, ::BlockDecomposition.Tree) at .julia/dev/BlockDecomposition/src/decomposition.jl:41
 [2] register_decomposition(::Model) at .julia/dev/BlockDecomposition/src/decomposition.jl:12
 [3] optimize!(::Model) at .julia/dev/BlockDecomposition/src/BlockDecomposition.jl:31
 [4] #optimize!#97(::Bool, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(optimize!), ::Mod
el, ::Nothing) at .julia/packages/JuMP/CZ8vV/src/optimizer_interface.jl:121
 [5] optimize! at .julia/packages/JuMP/CZ8vV/src/optimizer_interface.jl:107 [inlined] (repeats 2 times) 
 [6] start_optimization(::Model) at /media/files/sw/coluna/algo.jl:185
 [7] top-level scope at .julia/packages/TimerOutputs/7Id5J/src/TimerOutput.jl:214
 [8] include at ./boot.jl:328 [inlined] 
 [9] include_relative(::Module, ::String) at ./loading.jl:1094
 [10] include(::Module, ::String) at ./Base.jl:31
 [11] include(::String) at ./client.jl:431
 [12] top-level scope at REPL[2]:1
in expression starting at /media/files/sw/coluna/algo.jl:21
@guimarqu
Copy link
Contributor

Hi,

I don't exactly know how expressions work but I guess the model received by the solver is the same whether you use expressions or not.
We can thus create a method setannotation! that do nothing for expressions because we only need annotations on variables and constraints to do the decomposition.

Do you know why the second argument is a Int64 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants