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

Problem in solving the modified example model. #91

Open
yhy0258 opened this issue Nov 15, 2022 · 1 comment
Open

Problem in solving the modified example model. #91

yhy0258 opened this issue Nov 15, 2022 · 1 comment

Comments

@yhy0258
Copy link

yhy0258 commented Nov 15, 2022

Hi,
I copy the code of Simple Examples and modify the domain of the lower level variable to type integer.
M.y = pe.Var(bounds=(0,None),within=pe.Integers)
The whole code is provided as follows.

import pyomo.environ as pe
from pao.pyomo import *

# Create a model object
M = pe.ConcreteModel()

# Define decision variables
M.x = pe.Var(bounds=(0,None))
M.y = pe.Var(bounds=(0,None),within=pe.Integers)

# Define the upper-level objective
M.o = pe.Objective(expr=M.x - 4*M.y)

# Create a SubModel component to declare a lower-level problem
# The variable M.x is fixed in this lower-level problem
M.L = SubModel(fixed=M.x)

# Define the lower-level objective
M.L.o = pe.Objective(expr=M.y)

# Define lower-level constraints
M.L.c1 = pe.Constraint(expr=   -M.x -   M.y <= -3)
M.L.c2 = pe.Constraint(expr= -2*M.x +   M.y <=  0)
M.L.c3 = pe.Constraint(expr=  2*M.x +   M.y <= 12)
M.L.c4 = pe.Constraint(expr=  3*M.x - 2*M.y <=  4)

# Create a solver and apply it
with Solver('pao.pyomo.PCCG',mip_solver="cplex") as solver:
    results = solver.solve(M)

# The final solution is loaded into the model
print(M.x.value)
print(M.y.value)

Then an error returns
RuntimeError: ERROR! ERROR! Master: Could not find optimal solution,
however, a solution x=4, y=4 can be found when the domain of variables is set to real.

@yhy0258
Copy link
Author

yhy0258 commented Nov 15, 2022

This issue happens by using the solver PCCG with mip_solver Cplex, GLPK, and Gurobi.

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

1 participant