quast_decisiontree.algorithms.classical.base
quast_decisiontree.algorithms.classical.base
Base class for classical (non-quantum) optimization algorithms.
ClassicalAlgorithm
Bases: ABC
Abstract base class for classical solvers.
Classical solvers take a fully specified optimization problem and return a
result synchronously via :meth:execute. Unlike hybrid algorithms, they
involve no quantum backend, input lifecycle, or builder integration.
Subclasses may override :meth:check_input to validate problem inputs.
Source code in src/quast_decisiontree/algorithms/classical/base.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
execute
abstractmethod
execute(opt_problem, classical_args=None)
Run the algorithm on opt_problem and return the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
opt_problem
|
Any
|
The optimization problem to solve. |
required |
classical_args
|
Any
|
Optional algorithm-specific arguments. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
An algorithm-specific result. |
Source code in src/quast_decisiontree/algorithms/classical/base.py
25 26 27 28 29 30 31 32 33 34 35 | |
check_input
classmethod
check_input(opt_problem)
Check whether opt_problem is a valid input for this algorithm.
The default implementation accepts any input; override to validate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
opt_problem
|
Any
|
The optimization problem to validate. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the input is valid, False otherwise. |
Source code in src/quast_decisiontree/algorithms/classical/base.py
37 38 39 40 41 42 43 44 45 46 47 48 49 | |