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

Gurobi to PathSolver #91

Closed
Samuelhonorator opened this issue Aug 16, 2023 · 1 comment
Closed

Gurobi to PathSolver #91

Samuelhonorator opened this issue Aug 16, 2023 · 1 comment

Comments

@Samuelhonorator
Copy link

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
Copy link
Collaborator

odow commented Aug 16, 2023

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.

@odow odow closed this as completed Aug 16, 2023
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