I discovered that the printing of a MCPModel did not provide the complementarity constraints. Here is a first test to fix that:
function printMCP(m)
mcp_data = Complementarity.get_MCP_data(m)
res = "$(m)Complementarity constraints\n"
# replace all subexpression
dict_s = Dict{Int,String}(
i => nl_expr_string(m, REPLMode , expr)
for (i,expr) in enumerate(m.nlp_data.nlexpr)
)
sub_reg = r"subexpression\[(?<id>[0-9]+)\]"
for (i,expr) in dict_s
m = match(sub_reg, expr)
try
dict_s[i] = replace(expr, m.match => dict_s[parse(Int, m[:id])])
catch
end
end
for c in mcp_data
expr_id = parse(Int,split("$(c.F)", "#")[end][1:end-1])
res = res * " $(c.lb) ≦ $(c.var) \n ⟂ $(dict_s[expr_id]) ≧ 0.0\n"
end
return res
end
For the example on the start page, this is the outcome of println(printMCP(m)):
Feasibility
Subject to
x >= 0.0
Complementarity constraints
0.0 ≦ x
⟂ x + 2.0 ≧ 0.0
Hi all,
I discovered that the printing of a MCPModel did not provide the complementarity constraints. Here is a first test to fix that:
For the example on the start page, this is the outcome of
println(printMCP(m))
: