Skip to content

Problem in solving the modified example model by PCCG+CPLEX/GUROBI #92

Open
@yhy0258

Description

@yhy0258

The example is solved by PCCG and CPLEX as follows.
https://pao.readthedocs.io/en/latest/examples.html

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))

# 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)

The solution is x=3 and y=6, which is different from the solution x=4 and y=4 obtained by FA. Th solution, x=3 and y=6, is inorrect since y should be 2.5 to reduce its objective function if x=3.
Then I check the status as follows.

print(results.solver.termination_condition)
print(results.check_optimal_termination())

The outputs are

maxIterations
False

How to set the the max iteration?
The version of the CPLEX for this test is 22.1.0.0.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions