def test_LP_case(self): with SolverFactory('mindtpy') as opt: m_class = LP_unbounded() m_class._generate_model() model = m_class.model print('\n Solving LP case with extended cutting plane') opt.solve(model, strategy='ECP', mip_solver=required_solvers[1], nlp_solver=required_solvers[0], )
def test_LP_case(self): with SolverFactory('mindtpy') as opt: m_class = LP_unbounded() m_class._generate_model() model = m_class.model print('\n Solving LP case with Outer Approximation') opt.solve(model, strategy='OA', mip_solver=required_solvers[1], nlp_solver=required_solvers[0], )
from pyomo.contrib.mindtpy.nlp_solve import handle_subproblem_other_termination, handle_feasibility_subproblem_tc, solve_subproblem, handle_nlp_subproblem_tc from pyomo.core.base import TransformationFactory from pyomo.opt import TerminationCondition as tc from pyomo.contrib.gdpopt.util import create_utility_block, time_code, process_objective, setup_results_object from pyomo.contrib.mindtpy.initialization import MindtPy_initialize_main, init_rNLP from pyomo.contrib.mindtpy.feasibility_pump import generate_norm_constraint, handle_fp_main_tc from pyomo.core import Block, ConstraintList from pyomo.contrib.mindtpy.mip_solve import solve_main, handle_main_other_conditions from pyomo.opt import SolutionStatus, SolverStatus from pyomo.core import (Constraint, Objective, TransformationFactory, minimize, Var, RangeSet, NonNegativeReals) from pyomo.contrib.mindtpy.iterate import algorithm_should_terminate nonconvex_model_list = [EightProcessFlowsheet(convex=False)] LP_model = LP_unbounded() LP_model._generate_model() QCP_model = QCP_simple() QCP_model._generate_model() extreme_model_list = [LP_model.model, QCP_model.model] required_solvers = ('ipopt', 'glpk') # required_solvers = ('gams', 'gams') if all(SolverFactory(s).available() for s in required_solvers): subsolvers_available = True else: subsolvers_available = False @unittest.skipIf(not subsolvers_available,