Korean
언어
English
Japanese
German
Korean
Portuguese, Brazilian
French
Shortcuts

qiskit.optimization.algorithms.CobylaOptimizer

class CobylaOptimizer(rhobeg=1.0, rhoend=0.0001, maxfun=1000, disp=None, catol=0.0002, trials=1, clip=100.0)[소스]

The SciPy COBYLA optimizer wrapped as an Qiskit OptimizationAlgorithm.

This class provides a wrapper for scipy.optimize.fmin_cobyla (https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.optimize.fmin_cobyla.html) to be used within the optimization module. The arguments for fmin_cobyla are passed via the constructor.

예제

>>> from qiskit.optimization.problems import QuadraticProgram
>>> from qiskit.optimization.algorithms import CobylaOptimizer
>>> problem = QuadraticProgram()
>>> # specify problem here
>>> optimizer = CobylaOptimizer()
>>> result = optimizer.solve(problem)

Initializes the CobylaOptimizer.

This initializer takes the algorithmic parameters of COBYLA and stores them for later use of fmin_cobyla when solve() is invoked. This optimizer can be applied to find a (local) optimum for problems consisting of only continuous variables.

매개변수
  • rhobeg (float) – Reasonable initial changes to the variables.

  • rhoend (float) – Final accuracy in the optimization (not precisely guaranteed). This is a lower bound on the size of the trust region.

  • disp (Optional[int]) – Controls the frequency of output; 0 implies no output. Feasible values are {0, 1, 2, 3}.

  • maxfun (int) – Maximum number of function evaluations.

  • catol (float) – Absolute tolerance for constraint violations.

  • trials (int) – The number of trials for multi-start method. The first trial is solved with the initial guess of zero. If more than one trial is specified then initial guesses are uniformly drawn from [lowerbound, upperbound] with potential clipping.

  • clip (float) – Clipping parameter for the initial guesses in the multi-start method. If a variable is unbounded then the lower bound and/or upper bound are replaced with the -clip or clip values correspondingly for the initial guesses.

__init__(rhobeg=1.0, rhoend=0.0001, maxfun=1000, disp=None, catol=0.0002, trials=1, clip=100.0)[소스]

Initializes the CobylaOptimizer.

This initializer takes the algorithmic parameters of COBYLA and stores them for later use of fmin_cobyla when solve() is invoked. This optimizer can be applied to find a (local) optimum for problems consisting of only continuous variables.

매개변수
  • rhobeg (float) – Reasonable initial changes to the variables.

  • rhoend (float) – Final accuracy in the optimization (not precisely guaranteed). This is a lower bound on the size of the trust region.

  • disp (Optional[int]) – Controls the frequency of output; 0 implies no output. Feasible values are {0, 1, 2, 3}.

  • maxfun (int) – Maximum number of function evaluations.

  • catol (float) – Absolute tolerance for constraint violations.

  • trials (int) – The number of trials for multi-start method. The first trial is solved with the initial guess of zero. If more than one trial is specified then initial guesses are uniformly drawn from [lowerbound, upperbound] with potential clipping.

  • clip (float) – Clipping parameter for the initial guesses in the multi-start method. If a variable is unbounded then the lower bound and/or upper bound are replaced with the -clip or clip values correspondingly for the initial guesses.

Methods

__init__([rhobeg, rhoend, maxfun, disp, …])

Initializes the CobylaOptimizer.

get_compatibility_msg(problem)

Checks whether a given problem can be solved with this optimizer.

is_compatible(problem)

Checks whether a given problem can be solved with the optimizer implementing this method.

multi_start_solve(minimize, problem)

Applies a multi start method given a local optimizer.

solve(problem)

Tries to solves the given problem using the optimizer.

Attributes

clip

Returns the clip value for this optimizer.

trials

Returns the number of trials for this optimizer.

property clip

Returns the clip value for this optimizer.

반환 형식

float

반환값

The clip value.

get_compatibility_msg(problem)[소스]

Checks whether a given problem can be solved with this optimizer.

Checks whether the given problem is compatible, i.e., whether the problem contains only continuous variables, and otherwise, returns a message explaining the incompatibility.

매개변수

problem (QuadraticProgram) – The optimization problem to check compatibility.

반환 형식

str

반환값

Returns a string describing the incompatibility.

is_compatible(problem)

Checks whether a given problem can be solved with the optimizer implementing this method.

매개변수

problem (QuadraticProgram) – The optimization problem to check compatibility.

반환 형식

bool

반환값

Returns True if the problem is compatible, False otherwise.

multi_start_solve(minimize, problem)

Applies a multi start method given a local optimizer.

매개변수
  • minimize (Callable[[array], Tuple[array, Any]]) – A callable object that minimizes the problem specified

  • problem (QuadraticProgram) – A problem to solve

반환 형식

OptimizationResult

반환값

The result of the multi start algorithm applied to the problem.

solve(problem)[소스]

Tries to solves the given problem using the optimizer.

Runs the optimizer to try to solve the optimization problem.

매개변수

problem (QuadraticProgram) – The problem to be solved.

반환 형식

OptimizationResult

반환값

The result of the optimizer applied to the problem.

예외

QiskitOptimizationError – If the problem is incompatible with the optimizer.

property trials

Returns the number of trials for this optimizer.

반환 형식

int

반환값

The number of trials.