Skip to content

Config parser

Parser for LNS configuration inside ASP encodings.

ConfigParser

Parser for extracting and validating configuration from model.

get_atom_term_pairs(model: Model, projected_atoms: set[Symbol], destroy_operator_name: str) -> list[dict[str, Symbol]] classmethod

Extract atoms subject to destruction and corresponding terms from atoms of _destroy/3.

Parameters:

Name Type Description Default
model Model

Model containing the atoms.

required
projected_atoms set[Symbol]

Projected atoms.

required
destroy_operator_name str

Destroy operator name.

required

Returns:

Type Description
list[dict[str, Symbol]]

Atoms subject to destruction and corresponding terms.

get_destruction_candidate_atoms(model: Model, projected_atoms: set[Symbol], destroy_operator_name: str) -> set[Symbol] classmethod

Extract atoms subject to destruction from atoms of _destroy/3.

Parameters:

Name Type Description Default
model Model

Model containing the atoms.

required
projected_atoms set[Symbol]

Projected atoms.

required
destroy_operator_name str

Destroy operator name.

required

Returns:

Type Description
set[Symbol]

Atoms subject to destruction.

get_heuristic_targets(model: Model, undestroyed_atoms: set[Symbol], prioritize_operator_name: str) -> set[Symbol] classmethod

Extract atoms subject to prioritization from atoms of _prioritize/2.

Parameters:

Name Type Description Default
model Model

Model containing the atoms.

required
undestroyed_atoms set[Symbol]

Undestroyed atoms.

required
prioritize_operator_name str

Prioritize operator name.

required

Returns:

Type Description
set[Symbol]

Atoms subject to prioritization.

get_op_specs(model: Model) -> dict[str, set[Symbol]] classmethod

Extract operation specifications from the model.

Parameters:

Name Type Description Default
model Model

Model containing the atoms.

required

Returns:

Type Description
dict[str, set[Symbol]]

Dictionary mapping operation names to sets of symbols.

get_projected_atoms(model: Model, project_operator_name: str) -> set[Symbol] classmethod

Extract subset of atoms included in answer set from atoms of _project/2.

Parameters:

Name Type Description Default
model Model

Model containing the atoms.

required
project_operator_name str

Project operator name.

required

Returns:

Type Description
set[Symbol]

Projected atoms.

parse_lns_config(lns_object: LNS) -> ConfigCatalog classmethod

Extract and validate LNS configuration from model. If in non-declarative mode, the configuration is constructed from options and default behavior of operators.

Parameters:

Name Type Description Default
lns_object LNS

LNS instance that provides solver and runtime options.

required

Returns:

Type Description
ConfigCatalog

Configuration catalog used by the LNS loop.