Open yhy0258 opened 1 year ago
You can consider following approach as pao.pyomo-Solver do currently unfortunatley not consider all available config-parameters their mpr-counterparts do.
# build your pyomo-Model
M_pyomo = pyo.ConcreteModel()
# transform model
M_mpr, soln = pao.pyomo.convert.convert_pyomo2MultilevelProblem(M_pyomo , linear = True)
# Solve model, with given config-attributes
# for an overview of existing config-Parameter consult help(pao.Solver('pao.mpr.YourSolverChoice'))
opt = pao.Solver('pao.mpr.PCCG', mip_solver = 'gurobi', quiet = False,maxit=10, rtol= 1e-10)
result = opt.solve(M_mpr)
# Check the terminition conditions (for a describtion of existing terminition conditions, consult https://github.com/or-fusion/pao/blob/master/pao/common/solver.py#L31)
result.solver.termination_condition
# Load solution from mpr to pyomo-Model
soln.copy(From = M_mpr, To = M_pyomo )
# Access values in pyomo model
M_pyomo.x.extract_values()
The example is solved by PCCG and CPLEX as follows. https://pao.readthedocs.io/en/latest/examples.html
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.
The outputs are
How to set the the max iteration? The version of the CPLEX for this test is 22.1.0.0.
Thanks.