qutip_qoc._crab module
This module provides an interface to the CRAB optimization algorithm in qutip-qtrl. It defines the _CRAB class, which uses a qutip_qtrl.optimizer.Optimizer object to store the control problem and calculate the fidelity error function and its gradient with respect to the control parameters, according to the CRAB algorithm.
- class qutip_qoc._crab._CRAB(qtrl_optimizer)[source]
Bases:
objectClass to interface with the CRAB optimization algorithm in qutip-qtrl. It has an attribute qtrl that is a qutip_qtrl.optimizer.Optimizer object for storing the control problem and calculating the fidelity error function and its gradient wrt the control parameters, according to the CRAB algorithm. The class does only provide the infidelity method, as the CRAB algorithm is not a gradient-based optimization.
- infidelity(*args)[source]
This method is adapted from the original qutip_qtrl.optimizer.Optimizer.fid_err_func_wrapper
Get the fidelity error achieved using the ctrl amplitudes passed in as the first argument.
This is called by generic optimisation algorithm as the func to the minimised. The argument is the current variable values, i.e. control amplitudes, passed as a flat array. Hence these are reshaped as [nTimeslots, n_ctrls] and then used to update the stored ctrl values (if they have changed)