Source code for desdeo.preference.base

from abc import ABC

import numpy as np

from desdeo.method.base import InteractiveMethod


[docs]class PreferenceInformation(ABC):
[docs] def __init__(self, method: InteractiveMethod) -> None: self._method = method
[docs] def _weights(self) -> np.ndarray: return np.array([1.] * self._method.problem.nof_objectives())
[docs] def weights(self): """ Return weight vector corresponding to the given preference information """ return self._weights()
[docs]class Direction(PreferenceInformation):
[docs] def default_input(self) -> np.ndarray: return np.array([0.0] * len(self._method.problem.nadir))
[docs] def check_input(self, data) -> str: return ""
[docs]class ReferencePoint(PreferenceInformation):
[docs] def __init__(self, method: InteractiveMethod, reference_point=None) -> None: super().__init__(method) self._reference_point = reference_point
[docs] def reference_point(self): """ Return reference point corresponding to the given preference information """ return self._reference_point