Hey, I need your help!
What I am basically trying is to add a constraint to a JuMP matrix variable that no more than one element of a row can be a value larger than 0.
In other words only 1 element in the row can be a non Zero value.
@variable(ExModel, matrixVaribale[1:nSize,1:nSize] >= 0, Int)
for n = 1:nSize
@constraint(ExModel, sum((matrixVariable[n,s] > 0) for s=1:nSize) <= 1)
end
However when I try to run my code I get the following error:
LoadError: MethodError: no method matching isless(::Int64, ::VariableRef)
...
in expression starting at ..\caseStudy.jl:48
<(::Int64, ::VariableRef) at operators.jl:268
>(::VariableRef, ::Int64) at operators.jl:294
macro expansion at rewrite.jl:227 [inlined]
macro expansion at macros.jl:416 [inlined]
top-level scope at caseStudy.jl:49
Any ideas on other ways to acomplish this?
It must have to do something with the way Julia interprets the JuMP variabale as a VariableRef instead of as an Int or Float
Thanks in advance
valenmgama
Note: I also get this error when trying to perform other operations on the variable such as %