Ejemplo n.º 1
0
import pandas as pd
from tests.helper import Helper
from pyaugmecon import PyAugmecon
from tests.optimization_models import three_kp_model

model_type = "3kp50"

options = {
    "name": model_type,
    "grid_points": 847,
    "nadir_points": [1124, 1041],
}

py_augmecon = PyAugmecon(three_kp_model(model_type), options)
py_augmecon.solve()

xlsx = pd.ExcelFile(f"tests/input/{model_type}.xlsx", engine="openpyxl")


def test_payoff_table():
    payoff = Helper.read_excel(xlsx, "payoff_table").to_numpy()
    assert Helper.array_equal(py_augmecon.model.payoff, payoff, 2)


def test_pareto_sols():
    pareto_sols = Helper.read_excel(xlsx, "pareto_sols").to_numpy()
    assert Helper.array_equal(py_augmecon.unique_pareto_sols, pareto_sols, 2)
Ejemplo n.º 2
0
from pyaugmecon import PyAugmecon
from tests.optimization_models import three_kp_model

# Multiprocessing requires this If statement (on Windows)
if __name__ == "__main__":
    model_type = "3kp40"

    # AUGMECON related options
    opts = {
        "name": model_type,
        "grid_points": 540,
        "nadir_points": [1031, 1069],
    }

    # Options passed to Gurobi
    solver_opts = {}

    A = PyAugmecon(
        three_kp_model(model_type), opts, solver_opts
    )  # instantiate  PyAugmecon
    A.solve()  # solve PyAugmecon multi-objective optimization problem
    print(A.model.payoff)  # this prints the payoff table
    print(A.unique_pareto_sols)  # this prints the unique Pareto optimal solutions