pyanno4rt.optimization

Optimization module.


This module aims to provide methods and classes for setting up and solving the inverse planning problem.

Subpackages

Overview

Classes

FluenceOptimizer

Fluence optimization class.

Classes

class pyanno4rt.optimization.FluenceOptimizer(components, method, solver, algorithm, initial_strategy, initial_fluence_vector, lower_variable_bounds, upper_variable_bounds, max_iter, tolerance)[source]

Fluence optimization class.

This class provides methods to optimize the fluence vector by solving the inverse planning problem. It preprocesses the configuration inputs, sets up the optimization problem and the solver, and allows to compute both optimized fluence vector and optimized 3D dose cube (CT resolution).

Parameters:
  • components (dict) – Optimization components for each segment of interest, i.e., objective functions and constraints.

  • method ({'lexicographic', 'pareto', 'weighted-sum'}) – Single- or multi-criteria optimization method.

  • solver ({'proxmin', 'pymoo', 'scipy'}) – Python package to be used for solving the optimization problem.

  • algorithm (str) – Solution algorithm from the chosen solver.

  • initial_strategy ({'data-medoid', 'target-coverage', 'warm-start'}) – Initialization strategy for the fluence vector.

  • initial_fluence_vector (None or list) – User-defined initial fluence vector for the optimization problem, only used if initial_strategy=’warm-start’.

  • lower_variable_bounds (None, int, float, or list) – Lower bound(s) on the decision variables.

  • upper_variable_bounds (None, int, float, or list) – Upper bound(s) on the decision variables.

  • max_iter (int) – Maximum number of iterations taken for the solver to converge.

  • tolerance (float) – Precision goal for the objective function value.

Overview

Methods

set_optimization_components(components)

static Set the components of the optimization problem.

remove_overlap(components)

static Remove overlaps between segments.

resize_segments_to_dose()

static Resize the segments from CT to dose grid.

adjust_parameters_for_fractionation(components)

static Adjust the dose parameters according to the number of fractions.

get_variable_bounds(lower, upper, length)

static Get the lower and upper variable bounds in a compatible form.

get_constraint_bounds(method, constraints)

static Get the lower and upper constraint bounds in a compatible form.

solve()

Solve the optimization problem.

compute_dose_3d(optimized_fluence)

Compute the 3D dose cube from the optimized fluence vector.

Members

static set_optimization_components(components)[source]

Set the components of the optimization problem.

Parameters:

components (dict) – Optimization components for each segment of interest, i.e., objectives and constraints, in the raw user format.

Returns:

  • dict – Dictionary with the internally configured objectives.

  • dict – Dictionary with the internally configured constraints.

static remove_overlap(components)[source]

Remove overlaps between segments.

Parameters:

voi (tuple) – Tuple with the labels for the volumes of interest.

static resize_segments_to_dose()[source]

Resize the segments from CT to dose grid.

static adjust_parameters_for_fractionation(components)[source]

Adjust the dose parameters according to the number of fractions.

Parameters:

components (dict) – Dictionary with the internally configured objectives/constraints.

static get_variable_bounds(lower, upper, length)[source]

Get the lower and upper variable bounds in a compatible form.

Parameters:
  • lower (int, float, list or None) – Lower bound(s) on the decision variables.

  • upper (int, float, list or None) – Upper bound(s) on the decision variables.

  • length (int) – Length of the initial fluence vector.

Returns:

  • list – Transformed lower bounds on the decision variables.

  • list – Transformed upper bounds on the decision variables.

static get_constraint_bounds(method, constraints)[source]

Get the lower and upper constraint bounds in a compatible form.

Parameters:
  • method ({'lexicographic', 'pareto', 'weighted-sum'}) – Single- or multi-criteria optimization method.

  • constraints (dict) – Dictionary with the internally configured problem constraints.

Returns:

Transformed lower and upper bounds on the constraints.

Return type:

tuple

solve()[source]

Solve the optimization problem.

compute_dose_3d(optimized_fluence)[source]

Compute the 3D dose cube from the optimized fluence vector.

Parameters:

optimized_fluence (ndarray) – Optimized fluence vector(s).

Returns:

Optimized 3D dose cube (CT resolution).

Return type:

ndarray