NIMBUS¶
-
class
desdeo_mcdm.interactive.
NIMBUS
(problem, scalar_method=None)[source]¶ Bases:
desdeo_mcdm.interactive.InteractiveMethod.InteractiveMethod
Implements the synchronous NIMBUS algorithm.
- Parameters
problem (MOProblem) – The problem to be solved.
scalar_method (Optional[ScalarMethod], optional) – The method used to solve the various ASF minimization problems present in the method. Defaults to None.
Methods Summary
calculate_new_solutions
(number_of_solutions, …)Calcualtes new solutions based on classifications supplied by the decision maker by
compute_intermediate_solutions
(solutions, …)Computs intermediate solution between two solutions computed earlier.
create_plot_request
(objectives, msg)Used to create a plot request for visualizing objective values.
handle_classification_request
(request)Handles a classification request.
handle_intermediate_solutions_request
(request)Handles an intermediate solutions request.
handle_most_preferred_request
(request)Handles a preferres solution request.
handle_save_request
(request)Handles a save request.
iterate
(request)Implements a finite state machine to iterate over the different steps defined in Synchronous NIMBUS based on a supllied request.
request_classification
()- rtype
Tuple
[NimbusClassificationRequest
,SimplePlotRequest
]
request_most_preferred_solution
(solutions, …)Create a NimbusMostPreferredRequest.
request_stop
()Create a NimbusStopRequest based on self.
save_solutions_to_archive
(objectives, …)Save solutions to the archive.
start
()Return the first request to start iterating NIMBUS.
update_current_solution
(solutions, …)Update the state of self with a new current solution and the corresponding objective values.
Methods Documentation
-
calculate_new_solutions
(number_of_solutions, levels, improve_inds, improve_until_inds, acceptable_inds, impaire_until_inds, free_inds)[source]¶ - Calcualtes new solutions based on classifications supplied by the decision maker by
solving ASF problems.
- Parameters
number_of_solutions (int) – Number of solutions, should be between 1 and 4.
levels (np.ndarray) – Aspiration and upper bounds relevant to the some of the classifications.
improve_inds (np.ndarray) – Indices corresponding to the objectives which should be improved.
improve_until_inds (np.ndarray) – Like above, but improved until an aspiration level is reached.
acceptable_inds (np.ndarray) – Indices of objectives which are acceptable as they are now.
impaire_until_inds (np.ndarray) – Indices of objectives which may be impaired until an upper limit is reached.
free_inds (np.ndarray) – Indices of objectives which may change freely.
- Returns
A save request with the newly computed soutions, and a plot request to visualize said solutions.
- Return type
Tuple[NimbusSaveRequest, SimplePlotRequest]
-
compute_intermediate_solutions
(solutions, n_desired)[source]¶ Computs intermediate solution between two solutions computed earlier.
- Parameters
solutions (np.ndarray) – The solutions between which the intermediat solutions should be computed.
n_desired (int) – The number of intermediate solutions desired.
- Raises
- Returns
A save request with the compured intermediate points, and a plot request to visualize said points.
- Return type
Tuple[NimbusSaveRequest, SimplePlotRequest]
-
create_plot_request
(objectives, msg)[source]¶ Used to create a plot request for visualizing objective values.
- Parameters
objectives (np.ndarray) – A 2D numpy array containing objective vectors to be visualized.
msg (str) – A message to be displayed in the context of a visualization.
- Returns
A plot request to create a visualization.
- Return type
SimplePlotRequest
-
handle_classification_request
(request)[source]¶ Handles a classification request.
- Parameters
request (NimbusClassificationReuest) – A classification request with the response attribute set.
- Returns
A NIMBUS save request and a plot request with the solutions the decision maker can choose from to save for alter use.
- Return type
Tuple[NimbusSaveRequest, SimplePlotRequest]
-
handle_intermediate_solutions_request
(request)[source]¶ Handles an intermediate solutions request.
- Parameters
request (NimbusIntermediateSolutionsRequest) – A NIMBUS intermediate solutions request with the response attribute set.
- Returns
Return either a save request or a preferred solution request. The former is returned if the decision maker wishes to see intermediate points, the latter otherwise. Also a plot request is returned with the solutions available in it.
- Return type
Tuple[Union[NimbusSaveRequest, NimbusMostPreferredRequest], SimplePlotRequest,]
-
handle_most_preferred_request
(request)[source]¶ Handles a preferres solution request.
- Parameters
request (NimbusMostPreferredRequest) – A NIMBUS preferred solution request with the response attribute set.
- Returns
Return a classificaiton request if the decision maker wishes to continue. If the decision maker wishes to stop, return a stop request. Also return a plot request with all the solutions saved so far.
- Return type
Tuple[Union[NimbusClassificationRequest, NimbusStopRequest], SimplePlotRequest]
-
handle_save_request
(request)[source]¶ Handles a save request.
- Parameters
request (NimbusSaveRequest) – A save request with the response attribute set.
- Returns
Return an intermediate solution request where the decision maker can specify whether they would like to see intermediate solution between two previously computed solutions. The plot request has the available solutions.
- Return type
Tuple[NimbusIntermediateSolutionsRequest, SimplePlotRequest]
-
iterate
(request)[source]¶ Implements a finite state machine to iterate over the different steps defined in Synchronous NIMBUS based on a supllied request.
- Parameters
request (Union[NimbusClassificationRequest,NimbusSaveRequest,NimbusIntermediateSolutionsRequest,NimbusMostPreferredRequest,NimbusStopRequest,]) – A request based on the next step in the NIMBUS algorithm is taken.
- Raises
NimbusException – If a wrong type of request is supllied based on the current state NIMBUS is in.
- Returns
The next logically sound request.
- Return type
Tuple[Union[NimbusClassificationRequest,NimbusSaveRequest,NimbusIntermediateSolutionsRequest,],Union[SimplePlotRequest, None],]
-
request_most_preferred_solution
(solutions, objectives)[source]¶ Create a NimbusMostPreferredRequest.
- Parameters
solutions (np.ndarray) – A 2D numpy array of decision variable vectors.
objectives (np.ndarray) – A 2D numpy array of objective value vectors.
- Returns
The requests based on the given arguments.
- Return type
Tuple[NimbusMostPreferredRequest, SimplePlotRequest]
Note
The ‘i’th decision variable vector in solutions should correspond to the ‘i’th objective value vector in objectives.
-
request_stop
()[source]¶ Create a NimbusStopRequest based on self.
- Returns
A stop request and a plot request with the final solution chosen in it.
- Return type
Tuple[NimbusStopRequest, SimplePlotRequest]
-
save_solutions_to_archive
(objectives, decision_variables, indices)[source]¶ Save solutions to the archive. Saves also the corresponding objective function values.
- Parameters
objectives (np.ndarray) – Available objectives.
decision_variables (np.ndarray) – Available solutions.
indices (List[int]) – Indices of the solutions to be saved.
- Returns
An intermediate solutions request asking the decision maker whether they would like to generate intermediata solutions between two existing solutions. Also returns a plot request to visualize the available solutions between which the intermediate solutions should be computed.
- Return type
Tuple[NimbusIntermediateSolutionsRequest, None]
-
start
()[source]¶ Return the first request to start iterating NIMBUS.
- Returns
The first request and and a plot request to visualize relevant data.
- Return type
Tuple[NimbusClassificationRequest, SimplePlotRequest]
-
update_current_solution
(solutions, objectives, index)[source]¶ Update the state of self with a new current solution and the corresponding objective values. This solution is used in the classification phase of synchronous NIMBUS.
- Parameters
solutions (np.ndarray) – A 2D numpy array of decision variable vectors.
objectives (np.ndarray) – A 2D numpy array of objective value vectors.
index (int) – The index of the solution in solutions and objectives.
- Returns
The requests based on the given arguments.
- Return type
Tuple[NimbusMostPreferredRequest, SimplePlotRequest]
Note
The ‘i’th decision variable vector in solutions should correspond to the ‘i’th objective value vector in objectives.