The optimization results for categorical levers are indices not the actual values. To avoid confusion, I suggest either fixing this to return the actual values or clarifying this in the documentation.
I'm using version 3.0.0. A MWE to reproduce the issue is given below. The known optimum solution should be x = 30 (index = 2) and y = 2.0 (index = 2).
`
from ema_workbench import (
Model,
CategoricalParameter,
ScalarOutcome,
SequentialEvaluator,
Sample,
RealParameter
)
Model
def toy_model(x, y, b):
objective = -(x + y) + b
# return objective
return {"objective": objective}
EMA model
model = Model("Toy", function=toy_model)
model.uncertainties = [
RealParameter("b", 0.0001, 0.0005),
]
reference_SoW = Sample('reference',
b = 0.0003,
)
model.levers = [
CategoricalParameter(
"x",
(10, 20, 30)
),
CategoricalParameter(
"y",
(0.5, 1.0, 2.0)
)
]
model.outcomes = [
ScalarOutcome(
"objective",
ScalarOutcome.MINIMIZE
)
]
Optimization
with SequentialEvaluator(model) as evaluator:
results_toy = evaluator.optimize(
nfe=20,
searchover="levers",
epsilons=[0.01],
directory="toy_archive",
filename="archive_test_toy.tar.gz",
reference = reference_SoW
)
`
The optimization results for categorical levers are indices not the actual values. To avoid confusion, I suggest either fixing this to return the actual values or clarifying this in the documentation.
I'm using version 3.0.0. A MWE to reproduce the issue is given below. The known optimum solution should be x = 30 (index = 2) and y = 2.0 (index = 2).
`
from ema_workbench import (
Model,
CategoricalParameter,
ScalarOutcome,
SequentialEvaluator,
Sample,
RealParameter
)
Model
def toy_model(x, y, b):
EMA model
model = Model("Toy", function=toy_model)
model.uncertainties = [
RealParameter("b", 0.0001, 0.0005),
]
reference_SoW = Sample('reference',
b = 0.0003,
)
model.levers = [
]
model.outcomes = [
]
Optimization
with SequentialEvaluator(model) as evaluator:
`