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

Sets in PATH for equations as JuMPDict #16

Closed
hhoeschle opened this issue Mar 16, 2017 · 1 comment
Closed

Sets in PATH for equations as JuMPDict #16

hhoeschle opened this issue Mar 16, 2017 · 1 comment

Comments

@hhoeschle
Copy link

Hallo,

here is a minor thing I saw when run my model which could be fixed with the next version:

  • The name of the indexes are not forwarded to the PATH solver if the equation is of type JuMPDict

Here is a MWE:

using Complementarity
model = MCPModel()
scenarios = [@sprintf "s%03d" s for s=1:3]
INDEX = Dict("s001" => 1., "s002" => 0., "s003" => 0.5)
COST = Dict("s001" => 10., "s002" => 2., "s003" => 5)
COST_INDEX = Dict("s001" => 2., "s002" => 1., "s003" => 3.)
@variable(model, xname[s in scenarios] >= 0) 
@variable(model, ynoname[s in scenarios; INDEX[s] >0] >= 0)
@show typeof(xname)
@show typeof(ynoname)
@variable(model, lambda1 >= 0)
@variable(model, lambda2 >= 0)
@NLexpression(model, lambda,
    lambda1 - lambda2)

@mapping(model, market_lambda1,
    + sum(xname[s] for s in scenarios)
    + sum(ynoname[s] for s in scenarios if INDEX[s] > 0)
    - 10)
@complementarity(model, market_lambda1, lambda1)
                
@mapping(model, market_lambda2,
    - sum(xname[s] for s in scenarios)
    - sum(ynoname[s] for s in scenarios if INDEX[s] > 0)
    + 10)
@complementarity(model, market_lambda2, lambda2)
@mapping(model, KKT_xname[s in scenarios],
    - lambda
    + COST[s])
@complementarity(model, KKT_xname, xname)
@show typeof(KKT_xname)
@mapping(model, KKT_ynoname[s in scenarios; INDEX[s] >0],
    - lambda
    + COST_INDEX[s])
# @complementarity(model, KKT_ynoname, ynoname)
for s in scenarios
    if INDEX[s] > 0
        @complementarity(model, KKT_ynoname[s], ynoname[s])
    end
end
@show typeof(KKT_ynoname)

PATHSolver.options(
    convergence_tolerance=1e-6, 
    output=:yes, 
    time_limit=3600*12, 
    # time_limit=0.1, 
    minor_iteration_limit=1000,
    cumulative_iteration_limit=1000000000)

stat = solveMCP(model)
# Inf-Norm of Complementarity . .  1.1410e-006 eqn: (KKT_ynoname[s]) <---- NAME of index set not included
# Inf-Norm of Normal Map. . . . .  2.2820e-007 eqn: (KKT_xname[s002])
# Inf-Norm of Minimum Map . . . .  2.2820e-007 eqn: (KKT_xname[s002])
# Inf-Norm of Fischer Function. .  2.2820e-007 eqn: (KKT_xname[s002])
# Inf-Norm of Grad Fischer Fcn. .  4.5641e-007 eqn: (market_lambda2)
@chkwon
Copy link
Owner

chkwon commented Mar 17, 2017

Thanks for reporting. I'll work on it.

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

No branches or pull requests

2 participants