chkwon / PATHSolver.jl

provides a Julia wrapper for the PATH Solver for solving mixed complementarity problems
http://pages.cs.wisc.edu/%7Eferris/path.html
MIT License
50 stars 15 forks source link

Gurobi to PathSolver #91

Closed Samuelhonorator closed 1 year ago

Samuelhonorator commented 1 year ago

I have this code working in Julia whit the gurobi solver. But i wanna made it work whit PathSolver. Can i have any feedback on how to do it? Thanks!! This is my code whit gurobi import Pkg Pkg.add("Gurobi")

A=[300,350,400,450,500]; theta=[0.2,0.2,0.2,0.2,0.2]; B=1; I=90; C=60; tau=8760;

using JuMP,Gurobi model=Model(Gurobi.Optimizer)

Variables

@variable(model, x>=0) #Capacidad @variable(model, Y[i in 1:5]>=0) # Produccion en escenario w @variable(model,Q[i in 1:5]>=0) # Demanda en escenario w

Restricciones

@constraint(model, demanda[i in 1:5], Y[i] == Q[i] ) @constraint(model, capacidad[i in 1:5], Y[i]-x<=0.0)

FO

@objective(model, Min, I1000x + tau(sum(theta[i](CY[i] - A[i]Q[i] + B0.5(Q[i]^2)) for i in 1:5) ))

Resolver

JuMP.optimize!(model)

println("Q = ", JuMP.value.(Q)) Qlist=JuMP.value.(Q)

j=1 P=[] while j<6 Pi=A[j]-B*Qlist[j] append!(P, Pi) j=j+1 end println("P = ",P)

println("x = ", JuMP.value(x))

odow commented 1 year ago

Hi there!

This type of question is best asked on our community forum: https://discourse.julialang.org/c/domain/opt/13

But to answer your question: you have a quadratic program. PATHSolver supports complementarity problems. It does not support quadratic programs. We do not have an automatic reformulation from QP to MCP, therefore, you cannot solve this problem with PATH.

If you don't want to use Gurobi, try an open-source nonlinear solver like Ipopt. See https://jump.dev/JuMP.jl/stable/tutorials/nonlinear/simple_examples/.

I'm going to close this issue because it is not a bug report for PATHSolver.jl.