-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Hi again. I posted this on the discourse JULIA forum and was told it could be a bug with this package.
I am trying to set some constraints on some of my variables and get an error message.
using Complementarity
nodes = ["n1", "n2"]
m=MCPModel()
@variable(m, q_extract[n in nodes] >=0)
@variable(m, q_inject[n in nodes] >=0)
@mapping(m, KKT_q_extract[n in nodes], q_inject[n])
@mapping(m, KKT_q_inject[n in nodes], q_extract[n])
@complementarity(m, KKT_q_extract, q_extract)
@complementarity(m, KKT_q_inject, q_inject)
for n in nodes
@constraints(m, begin
q_extract[n] == 0
q_inject[n] == 0
end)
end
solveMCP(m))
This is a highly reduced version of the code to only one variable (doesnt make physical sense but gives same error message).
Without this constraints loop, the model solves.
Including the loop setting the constraints, causes this error message:
BoundsError: attempt to access 4-element Array{Float64,1} at index [5] in solveMCP at Complementarity\src\mcp.jl:52 in #solveMCP#1 at Complementarity\src\mcp.jl:53 in at base\<missing> in #_solve_path#3 at Complementarity\src\mcp.jl:138 in solveMCP at PATHSolver\src\PATHSolver.jl:56 in f_user_wrap at PATHSolver\src\PATHSolver.jl:124 in FunctionWrapper at FunctionWrappers\src\FunctionWrappers.jl:106 in do_ccall at FunctionWrappers\src\FunctionWrappers.jl:91 in macro expansion at FunctionWrappers\src\FunctionWrappers.jl:100 in at FunctionWrappers\src\FunctionWrappers.jl:49 in myfunc at Complementarity\src\mcp.jl:82 in eval_g at JuMP\src\nlp.jl:557
Here's the post I made on discourse: https://discourse.julialang.org/t/newbie-looking-for-help-with-constraints-in-jump/12200