c3.optimizers.optimizer
¶
Optimizer object, where the optimal control is done.
Module Contents¶
- class c3.optimizers.optimizer.Optimizer(pmap: c3.parametermap.ParameterMap, initial_point: str = '', algorithm: Callable = None, store_unitaries: bool = False, logger: List = None)[source]¶
General optimizer class from which specific classes are inherited.
- Parameters
algorithm (callable) – From the algorithm library
store_unitaries (boolean) – Store propagators as text and pickle
logger (List) – Logging classes
- replace_logdir(new_logdir)[source]¶
Specify a new filepath to store the log.
- Parameters
new_logdir –
- set_created_by(config) None [source]¶
Store the config file location used to created this optimizer.
- load_best(init_point, extend_bounds=False) None [source]¶
Load a previous parameter point to start the optimization from. Legacy wrapper. Method moved to Parametermap.
- Parameters
init_point (str) – File location of the initial point
extend_bounds (bool) – Whether or not to allow the loaded optimal parameters’ bounds to be extended if they exceed those specified.
- log_parameters(params) None [source]¶
Log the current status. Write parameters to log. Update the current best parameters. Call plotting functions as set up.
- abstract goal_run(current_params: Union[numpy.ndarray, tensorflow.constant]) Union[numpy.ndarray, tensorflow.constant] [source]¶
Placeholder for the goal function. To be implemented by inherited classes.
- lookup_gradient(x)[source]¶
Return the stored gradient for a given parameter set.
- Parameters
x (np.array) – Parameter set.
- Returns
Value of the gradient.
- Return type
np.array
- fct_to_min(input_parameters: Union[numpy.ndarray, tensorflow.constant]) Union[numpy.ndarray, tensorflow.constant] [source]¶
Wrapper for the goal function.
- Parameters
input_parameters ([np.array, tf.constant]) – Vector of parameters in the optimizer friendly way.
- Returns
Value of the goal function. Float if input is np.array else tf.constant
- Return type
[np.ndarray, tf.constant]