from warehouse_data import * import pyomo.environ as pe import warehouse_function as wf # call function to create model model = wf.create_wl_model(N, M, d, P) # solve the model solver = pe.SolverFactory('glpk') solver_opt = dict() solver_opt['log'] = 'warehouse.log' solver_opt['nointopt'] = None solver.solve(model, options=solver_opt) # look at the solution model.y.pprint()
import warnings warnings.filterwarnings("ignore") # @all: from warehouse_data import * from pyomo.environ import * from pyomo.opt import TerminationCondition import warehouse_function as wf import matplotlib.pyplot as plt # call function to create model model = wf.create_wl_model(N, M, d, P) model.integer_cuts = ConstraintList() objective_values = list() done = False while not done: # solve the model solver = SolverFactory("glpk") results = solver.solve(model) objective_values.append(value(model.obj)) term_cond = results.solver.termination_condition print("") print("--- Solver Status: {0} ---".format(term_cond)) if term_cond != TerminationCondition.optimal: done = True else: # look at the solution print("Optimal Obj. Value = {0}".format(value(model.obj))) model.y.pprint()