Graph.optimizable_scalar(lower_bound, upper_bound, is_lower_unbounded=False, is_upper_unbounded=False, initial_values=None, *, name=None)

Create an optimizable scalar Tensor, which can be bounded, semi-bounded, or unbounded.

Use this function to create a single variable that can be tuned by the optimizer to minimize the cost function.


  • lower_bound (float) – The lower bound vminv_\mathrm{min}
  • upper_bound (float) – The upper bound vmaxv_\mathrm{max}
  • is_lower_unbounded (bool , optional) – Defaults to False. Set this flag to True to define a semi-bounded variable with lower bound -\infty
  • is_upper_unbounded (bool , optional) – Defaults to False. Set this flag to True to define a semi-bounded variable with upper bound ++\infty
  • initial_values (float or List [ float ] or None , optional) – Initial values for the 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 all either as a single value or a list of values of the same length. Defaults to None, meaning the optimizer initializes the variable with a random value.
  • name (str or None , optional) – The name of the node.


The vv optimizable scalar. If both is_lower_unbounded and is_upper_unbounded are False, the variables is bounded such that vminvvmaxv_\mathrm{min}\leq v \leq v_\mathrm{max}. If one of the flags is True (for example is_lower_unbounded=True), the variable is semi-bounded (for example vvmax-\infty \leq v \leq v_\mathrm{max}). If both of them are True, then the variable is unbounded and satisfies that v+-\infty \leq v \leq +\infty

Return type



Graph.optimization_variable : Create 1D Tensor of optimization variables.

boulderopal.run_optimization : Function to find the minimum of a generic function.

Was this useful?