atomica.optimization.SpendingAdjustment

class atomica.optimization.SpendingAdjustment(prog_name, t, limit_type='abs', lower=0.0, upper=inf, initial=None)[source]

Bases: Adjustment

Adjust program spending

This adjustment class represents making a spending quantity adjustable. By default, the base class simply overwrites the spending value at a particular point in time A SpendingAdjustment has a separate Adjustable for each time reached (independently)

Parameters:
  • prog_name – The code name of a program

  • t – A single time, or list/array of times at which to make adjustments

  • limit_type – Interpret lower and upper as absolute or relative limits (should be 'abs' or 'rel')

  • lower – Lower bound (0 by default). A single value (used for all times) or a list/array the same length as t

  • upper – Upper bound (np.inf by default). A single value (used for all times) or a list/array the same length as t

  • initial – Optionally specify the initial value, either as a scalar or list/array the same length as t. If not specified, the initial spend will be drawn from the program instructions, or the progset.

Attributes

adjustables

A list of Adjustables

Methods

get_initialization

Return initial values for ASD

update_instructions

adjustables

A list of Adjustables

get_initialization(progset, instructions)[source]

Return initial values for ASD

The initial values correspond to either

  • The explicitly specified initial spend

  • The initial spend from the program set/instructions

Note that the initial spend is NOT clipped to any bounds. This is because the initial spend is in turn used to compute relative spending constraints. If the initial spend is not consistent then an error will be subsequently raised at that point.

Parameters:
Return type:

list

Returns:

A list of initial values, one for each adjustable