Skip to content

Commit

Permalink
Rename MixIn to Mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
y0z committed Dec 16, 2024
1 parent 5b1d055 commit 8af9123
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions recipes/007_benchmarks_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import optuna
from optunahub.benchmarks import BaseProblem
from optunahub.benchmarks import ConstrainedMixIn
from optunahub.benchmarks import ConstrainedMixin


###################################################################################################
Expand Down Expand Up @@ -69,10 +69,10 @@ def evaluate(self, params: dict[str, float]) -> float:
# Implementing a problem with constraints
# -------------------------------------------------
# Here, let's implement a problem with constraints.
# To implement a problem with constraints, you need to inherit ``ConstrainedMixIn`` class in addition to ``BaseProblem`` and implement the ``evaluate_constraints`` method.
# To implement a problem with constraints, you need to inherit ``ConstrainedMixin`` class in addition to ``BaseProblem`` and implement the ``evaluate_constraints`` method.
# The ``evaluate_constraints`` method evaluates the constraint functions given a dictionary of input parameters and returns a list of constraint values.
# Then, ``ConstrainedMixIn`` internally defines the ``constraints_func`` method properly for Optuna samplers to handle constraints.
class ConstrainedProblem(ConstrainedMixIn, DynamicProblem):
# Then, ``ConstrainedMixin`` internally defines the ``constraints_func`` method properly for Optuna samplers to handle constraints.
class ConstrainedProblem(ConstrainedMixin, DynamicProblem):
def evaluate_constraints(self, params: dict[str, float]) -> list[float]:
x = params["x"]
c0 = x - 2
Expand Down

0 comments on commit 8af9123

Please sign in to comment.