Skip to content

Commit

Permalink
Fix import path
Browse files Browse the repository at this point in the history
  • Loading branch information
hrntsm committed Sep 5, 2024
1 parent b79ba4e commit 1e42045
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from __future__ import annotations

from _scalar_aggregation_func import pbi
from _scalar_aggregation_func import tchebycheff
from _scalar_aggregation_func import weighted_sum
import numpy as np
from optuna import Study
from optuna.study import StudyDirection
from optuna.trial import FrozenTrial
from scipy.spatial import cKDTree
from scipy.stats import qmc

from ._scalar_aggregation_func import tchebycheff
from ._scalar_aggregation_func import weighted_sum


class MOEAdElitePopulationSelectionStrategy:
def __init__(
Expand All @@ -26,8 +26,6 @@ def __init__(

if scalar_aggregation_func == "tchebycheff":
self._scalar_aggregation_func = tchebycheff
elif scalar_aggregation_func == "PBI":
self._scalar_aggregation_func = pbi
elif scalar_aggregation_func == "weighted_sum":
self._scalar_aggregation_func = weighted_sum
else:
Expand Down
15 changes: 0 additions & 15 deletions package/samplers/moead/_scalar_aggregation_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,3 @@ def tchebycheff(
ref = np.array(reference_point)
nadir = np.array(nadir_point)
return float(np.max(lambda_ * np.abs((value - ref) / (nadir - ref))))


# TODO: Is this method correct?
def pbi(
weight_vector: list[float],
trial: FrozenTrial,
reference_point: list[float],
nadir_point: list[float],
theta: float = 5.0,
) -> float:
diff = trial.values - reference_point
d1 = np.dot(diff, weight_vector)
d2 = np.linalg.norm(diff - d1 * weight_vector)

return d1 + theta * d2
5 changes: 3 additions & 2 deletions package/samplers/moead/moead.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from typing import Dict
from typing import TYPE_CHECKING

from _child_generation_strategy import MOEAdChildGenerationStrategy
from _elite_population_selection_strategy import MOEAdElitePopulationSelectionStrategy
import optuna
from optuna.distributions import BaseDistribution
from optuna.samplers import BaseSampler
Expand All @@ -18,6 +16,9 @@
from optuna.search_space import IntersectionSearchSpace
from optuna.trial import FrozenTrial

from ._child_generation_strategy import MOEAdChildGenerationStrategy
from ._elite_population_selection_strategy import MOEAdElitePopulationSelectionStrategy


if TYPE_CHECKING:
from optuna.study import Study
Expand Down

0 comments on commit 1e42045

Please sign in to comment.