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
import numpy as np
from tests.helper import Helper
from pyaugmecon import PyAugmecon
from tests.optimization_models import three_objective_model

model_type = "three_objective_model"

options = {
    "name": model_type,
    "grid_points": 10,
}

py_augmecon = PyAugmecon(three_objective_model(), options)
py_augmecon.solve()


def test_payoff_table():
    payoff = np.array([[3075000, 62460, 33000], [3855000, 45180, 37000],
                       [3225000, 55260, 23000]])
    assert Helper.array_equal(py_augmecon.model.payoff, payoff, 2)


def test_pareto_sols():
    pareto_sols = np.array([
        [3075000, 62460, 33000],
        [3085000, 61980, 32333.33],
        [3108333.33, 60860, 30777.78],
        [3115000, 60540, 30333.33],
        [3131666.67, 59740, 29222.22],
        [3155000, 58620, 27666.67],
        [3178333.33, 57500, 26111.11],
Ejemplo n.º 3
0
model_type = "two_objective_model"

options = {
    "name": model_type,
    "grid_points": 10,
    "solver_name": "glpk",
    "solver_io": None,
}

solver_options = {
    "MIPGap": None,
    "NonConvex": None,
}

py_augmecon = PyAugmecon(two_objective_model(), options, solver_options)
py_augmecon.solve()


def test_payoff_table():
    payoff = np.array([[20, 160], [8, 184]])
    assert Helper.array_equal(py_augmecon.model.payoff, payoff, 2)


def test_pareto_sols():
    pareto_sols = np.array([
        [8, 184],
        [9.33, 181.33],
        [10.67, 178.67],
        [12, 176],
        [13.33, 173.33],
Ejemplo n.º 4
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