anchored_difference_bounded_variables
Graph.anchored_difference_bounded_variables(count, lower_bound, upper_bound, difference_bound, initial_values=None, *, name=None)
Create a sequence of optimizable variables with an anchored difference bound.
Use this function to create a sequence of optimization variables that have a difference bound (each variable is constrained to be within a given distance of the adjacent variables) and are anchored to zero at the start and end (the initial and final variables are within a given distance of zero).
Parameters
- count (int) – The number of individual real-valued variables to create.
- lower_bound (float) – The lower bound on the variables. The same lower bound applies to all count individual variables.
- upper_bound (float) – The upper bound on the variables. The same upper bound applies to all count individual variables.
- difference_bound (float) – The difference bound to enforce between adjacent variables.
- initial_values (np.ndarray or List [ np.ndarray ] or None , optional) – Initial values for optimization variable. You can either provide a single initial value, or a list of them. Note that all optimization variables in a graph with non-default initial values must have the same length. That is, you must set them either as a single array or a list of arrays of the same length. Defaults to None, meaning the optimizer initializes the variables with random values.
- name (str or None , optional) – The name of the node.
Returns
The sequence of anchored difference-bounded optimization variables, satisfying , for , , and .
Return type
SEE ALSO
Graph.optimization_variable
: Create 1D Tensor of optimization variables.
boulderopal.run_optimization
: Function to find the minimum of generic deterministic functions.
boulderopal.run_stochastic_optimization
: Function to find the minimum of generic stochastic functions.
Examples
Create optimizable PWC signal with anchored difference bound.
>>> values = graph.anchored_difference_bounded_variables(
... count=10, lower_bound=-1, upper_bound=1, difference_bound=0.1
... )
>>> graph.pwc_signal(values=values, duration=1)
<Pwc: name="pwc_signal_#1", operation_name="pwc_signal", value_shape=(), batch_shape=()>
See the “Band-limited pulses with bounded slew rates” example in the How to add smoothing and band-limits to optimized controls user guide.