mis.pipeline.config
source module mis.pipeline.config
Configuration for MIS solvers.
Classes
-
BackendConfig — Generic configuration for backends.
-
BackendType — Type of backend to use for solving the QUBO.
-
SolverConfig — Configuration class for setting up solver parameters.
-
GreedyConfig — Configuration for greedy solving strategies.
Functions
-
default_preprocessor — Instantiate the default preprocessor.
-
default_postprocessor — Instantiate the default postprocessor.
class BackendConfig(**data: Any)
Bases : pydantic.BaseModel
Generic configuration for backends.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError
][pydantic_core.ValidationError] if the input data cannot be
validated to form a valid model.
self
is explicitly positional-only to allow self
as a field name.
Attributes
-
model_config : ClassVar[ConfigDict] — Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict]. -
model_extra : dict[str, Any] | None — Get extra fields set during validation.
-
model_fields_set : set[str] — Returns the set of fields that have been explicitly set on this model instance.
-
backend : BackendType — The type of backend to use.
-
username : str | None — For a backend that requires authentication, such as Pasqal Cloud,.
-
password : str | None — For a backend that requires authentication, such as Pasqal Cloud,.
-
project_id : str | None — For a backend that associates jobs to projects, such as Pasqal Cloud,.
-
device : NamedDevice | DeviceType | None
-
dt : int — For a backend that supports customizing the duration of steps, the.
enum BackendType()
Bases : StrEnum
Type of backend to use for solving the QUBO.
Attributes
-
QUTIP
-
REMOTE_QPU
-
REMOTE_EMUMPS
-
EMU_MPS
-
EMU_SV
source dataclass SolverConfig(backend: BaseBackend | BackendConfig | None = None, weighting: Weighting = Weighting.UNWEIGHTED, method: MethodType = MethodType.EAGER, max_iterations: int = 1, max_number_of_solutions: int = 1, device: Device | None = None, embedder: BaseEmbedder | None = None, pulse_shaper: BasePulseShaper | None = None, preprocessor: Callable[[SolverConfig, nx.Graph], BasePreprocessor] | None = field(default_factory=default_preprocessor), postprocessor: Callable[[SolverConfig], BasePostprocessor] | None = field(default_factory=default_postprocessor), greedy: GreedyConfig = field(default_factory=GreedyConfig), runs: int = 500)
Configuration class for setting up solver parameters.
Attributes
-
backend : BaseBackend | BackendConfig | None — Backend configuration to use. If
None
, use a non-quantum heuristic solver. -
weighting : Weighting — The weighting policy for this solver, i.e. should it attempt to maximize size of the solution (by number of nodes, ignoring weights) or maximizing the total weight of the solution (the sum of weights of individual nodes, ignoring the number of nodes).
-
method : MethodType — The method used to solve this instance of MIS.
-
max_iterations : int — Maximum number of iterations allowed for solving.
-
max_number_of_solutions : int — A maximal number of solutions to return.
-
device : Device | None — Quantum device to execute the code in. If unspecified, use a reasonable default device.
-
embedder : BaseEmbedder | None — If specified, an embedder, i.e. a mechanism used to customize the layout of neutral atoms on the quantum device. Ignored for non-quantum backends.
-
pulse_shaper : BasePulseShaper | None — If specified, a pulse shaper, i.e. a mechanism used to customize the laser pulse to which the neutral atoms are subjected during the execution of the quantum algorithm. Ignored for non-quantum backends.
-
preprocessor : Callable[[SolverConfig, nx.Graph], BasePreprocessor] | None — A graph preprocessor, used to decrease the size of the graph (hence the duration of actual resolution) by applying heuristics prior to embedding on a quantum device.
-
postprocessor : Callable[[SolverConfig], BasePostprocessor] | None — A postprocessor used to sort out and improve results.
-
greedy : GreedyConfig — If specified, use this for solving the GreedyMIS. Needs to be specified when method is GreedyMIS
-
runs : int — When using a quantum backend, how many times we repeat each quantum run. Since quantum executions are non-deterministic, higher numbers increases the reliability of the result, but also the duration until the results are available.
source default_preprocessor() → Callable[[SolverConfig, nx.Graph], BasePreprocessor]
Instantiate the default preprocessor.
As of this writing, the default preprocessor is mis.pipeline.kernelization.Kernelization.
source default_postprocessor() → Callable[[SolverConfig], BasePostprocessor]
Instantiate the default postprocessor.
As of this writing, the default postprocessor is mis.pipeline.maximization.Maximization.
source dataclass GreedyConfig(default_solving_threshold: int = 2, subgraph_quantity: int = 5, mis_sample_quantity: int = 1)
Configuration for greedy solving strategies.
Attributes
-
default_solving_threshold : int — Size threshold (number of nodes) for using MIS solving when greedy method is used.
-
subgraph_quantity : int — Number of candidate subgraphs to generate during greedy mapping.
-
mis_sample_quantity : int — Number of MIS solutions to sample per iteration (if applicable).