gdm
desdeo.gdm.gdmtools
This module contains tools for group decision making such as manipulating set of preferences.
agg_aspbounds
agg_aspbounds(
po_list: list[dict[str, float]], problem: Problem
) -> tuple[dict[str, float], dict[str, float]]
Aggregate a set of preferences into shared aspiration levels and bounds.
For each objective, the aggregated aspiration level is the most optimistic value across the given preferences (the maximum for objectives to be maximized, the minimum for objectives to be minimized), while the aggregated bound is the least optimistic value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
po_list
|
list[dict[str, float]]
|
a list of preferences, where each preference maps objective symbols to values. |
required |
problem
|
Problem
|
the problem the preferences relate to. Used to determine the objective symbols and whether each is maximized. |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict[str, float], dict[str, float]]
|
tuple[dict[str, float], dict[str, float]]: the aggregated aspiration levels and the aggregated bounds, each mapping objective symbols to values. |
Source code in desdeo/gdm/gdmtools.py
dict_of_rps_to_list_of_rps
dict_of_rps_to_list_of_rps(
reference_points: dict[str, dict[str, float]],
) -> list[dict[str, float]]
Convert a dict of preferences keyed by decision maker into an ordered list of preferences.
list_of_rps_to_dict_of_rps
list_of_rps_to_dict_of_rps(
reference_points: list[dict[str, float]],
) -> dict[str, dict[str, float]]
Convert an ordered list of preferences into a dict keyed by decision maker (DM1, DM2, ...).
Source code in desdeo/gdm/gdmtools.py
scale_delta
Scale a step size into a per-objective delta based on the objective ranges.
For each objective, the delta has magnitude equal to the fraction d of the
objective's range, i.e. the distance between the ideal and nadir points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
the problem whose ideal and nadir points define the objective ranges. |
required |
d
|
float
|
the fraction of each objective's range to use as the delta. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
dict[str, float]: a mapping from objective symbols to the scaled delta. |
Source code in desdeo/gdm/gdmtools.py
desdeo.gdm.voting_rules
This module contains voting rules for group decision making such as majority rule.
consensus_rule
Choose all options that have at least min_votes votes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
votes
|
dict[str, int]
|
A dictionary mapping voter IDs to their votes. |
required |
min_votes
|
int
|
The minimum number of votes required for an option to be selected. |
required |
Source code in desdeo/gdm/voting_rules.py
majority_rule
Choose the option that has more than half of the votes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
votes
|
dict[str, int]
|
A dictionary mapping voter IDs to their votes. |
required |
Returns:
| Type | Description |
|---|---|
int | None
|
int | None: The option that has more than half of the votes, or None if no such option exists. |
Source code in desdeo/gdm/voting_rules.py
plurality_rule
Choose the option that has the most votes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
votes
|
dict[str, int]
|
A dictionary mapping voter IDs to their votes. |
required |
Returns:
| Type | Description |
|---|---|
list[int]
|
list[int]: A list of options that have the most votes (in case of a tie). |
Source code in desdeo/gdm/voting_rules.py
desdeo.gdm.score_bands
Implements a interactive SCORE bands based GDM.
SCOREBandsGDMConfig
Bases: BaseModel
Configuration for the SCORE bands based GDM.
Source code in desdeo/gdm/score_bands.py
from_iteration
instance-attribute
The iteration number from which to consider the clusters. Set to None if method is initializing.
minimum_votes
class-attribute
instance-attribute
Minimum number of votes required to select a cluster.
SCOREBandsGDMResult
Bases: BaseModel
Result of the SCORE bands based GDM.
Source code in desdeo/gdm/score_bands.py
previous_iteration
instance-attribute
The previous iteration number, if any.
relevant_ids
instance-attribute
IDs of the relevant solutions in the current iteration. Assumes that data is not modified between iterations.
score_bands_result
instance-attribute
Result of the SCORE bands method.
score_bands_gdm
score_bands_gdm(
data: DataFrame,
config: SCOREBandsGDMConfig,
state: list[SCOREBandsGDMResult],
votes: dict[str, int] | None = None,
) -> list[SCOREBandsGDMResult]
Run the SCORE bands based interactive GDM.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame
|
The data to run the GDM on. |
required |
config
|
SCOREBandsGDMConfig
|
Configuration for the GDM. |
required |
state
|
list[SCOREBandsGDMResult]
|
List of previous state of the GDM. Empty list if first iteration. |
required |
votes
|
dict[str, int] | None
|
Votes from the decision makers. Defaults to None. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
Both state and votes must be provided or neither. |
Returns:
| Type | Description |
|---|---|
list[SCOREBandsGDMResult]
|
list[SCOREBandsGDMResult]: The updated state of the GDM. |