Skip to content

Application

Clingo application class extended to solve COOM configuration problems

log = get_logger('main') module-attribute

COOMSolverApp

Bases: Application

Application class extending clingo.

__init__(log_level: str = '', options: Optional[Dict[str, Any]] = None, istest: bool = False)

Create application.

main(control: Control, files: Sequence[str]) -> None

Main function ran on call.

on_model(model: Model) -> None

Function called after finding each model. Args: model (Model): clingo Model

parse_log_level(log_level: str) -> bool

Parse log.

print_model(model: Model, printer: Callable[[], None]) -> None

Print a model on the console.

register_options(options: ApplicationOptions) -> None

Add custom options.

_get_valuation(model: Model) -> List[Symbol]

_sym_to_prg(symbols: Sequence[Symbol], output: Optional[str] = 'asp') -> str

Turns symbols into a program.

format_sym_coom(s: Symbol) -> str

Formats output symbols to a more readable COOM format.

get_encoding(file_name: str) -> str

Gets the path to a given ASP encoding in the encodings folder

Parameters:

Name Type Description Default
file_name str

The name of the ASP encoding with the extension

required

Returns:

Name Type Description
str str

The string for the path to the ASP encoding

get_logger(name: str) -> logging.Logger

Get a logger with the given name.