quara.interface.cvxpy.qtomography.standard.minimization_algorithm module
- class CvxpyMinimizationAlgorithm[source]
Bases:
quara.minimization_algorithm.minimization_algorithm.MinimizationAlgorithmConstructor.
Subclasses have a responsibility to set the following variables.
_is_gradient_required: whether or not to require gradient._is_hessian_required: whether or not to require Hessian.
- is_loss_and_option_sufficient()[source]
returns whether the loss and the option are sufficient.
In the default implementation, this function returns True. Override with subclasses as needed.
- Returns
whether the loss and the option are sufficient.
- Return type
bool
- is_loss_sufficient()[source]
returns whether the loss is sufficient.
In the default implementation, this function returns True. Override with subclasses as needed.
- Returns
whether the loss is sufficient.
- Return type
bool
- optimize()[source]
optimizes using specified parameters.
- Parameters
loss_function (LossFunction) – Loss Function
loss_function_option (LossFunctionOption) – Loss Function Option
algorithm_option (MinimizationAlgorithmOption) – Minimization Algorithm Option
on_iteration_history (bool, optional) – whether to return iteration history, by default False
- Returns
the result of the optimization.
- Return type
- Raises
NotImplementedError – this function does not be implemented in the subclass.
- class CvxpyMinimizationAlgorithmOption(name_solver, verbose=False, eps_tol=1e-08, mode_constraint='physical')[source]
Bases:
quara.minimization_algorithm.minimization_algorithm.MinimizationAlgorithmOptionConstructor
- Parameters
name_solver (str) – name of solver
verbose (bool, optional) – verbose option of solver, by default False
eps_tol (np.float64, optional) – eps option of solver, by default 1e-8
mode_constraint (str, optional) – mode of constraint, by default “physical”
- Raises
ValueError – Unsupported name_solver is specified.
ValueError – eps_tol is negative.
ValueError – Unsupported mode_constraint is specified.
- property eps_tol: numpy.float64
returns eps option of solver.
- Returns
eps option of solver.
- Return type
np.float64
- property mode_constraint: str
returns mode of constraint.
- Returns
mode of constraint.
- Return type
str
- property name_solver: str
returns name of solver.
- Returns
name of solver.
- Return type
str
- property verbose: bool
returns verbose option of solver.
- Returns
verbose option of solver.
- Return type
bool
- class CvxpyMinimizationResult(variable_value, loss_value=None, comp_time=None)[source]
Bases:
quara.minimization_algorithm.minimization_algorithm.MinimizationResultConstructor
- Parameters
variable_value (np.ndarray) – the result of the minimization.
loss_value (np.float64, optional) – loss for the minimization, by default None
comp_time (float, optional) – computation time for the minimization, by default None
- property loss_value: numpy.float64
returns loss for the minimization.
- Returns
loss for the minimization.
- Return type
np.float64
- property variable_value: numpy.ndarray
returns the result of the minimization.
- Returns
the result of the minimization.
- Return type
np.ndarray