clingo.theory
This module allows for using theories implemented in C from Python.
Object to call functions from a C-library implementing a custom theory.
Construct a theory object.
Arguments:
- library: Library object to store symbols in.
- create: A capsule object holding a function pointer to initialize the theory.
Get the symbols and values currently assigned by the theory
It depends on the theory when this function can be called. Generally, it can be
called after on_model
while the solver is still holding its current model.
Arguments:
- thread_id: The id of the thread to query.
Returns:
An interable over symbol value pairs.
Configure the theory using its name/value interface.
It depends on the theory which keys are supported and when this function can be called.
Arguments:
- key: The name of the option.
- value: The value of the option.
Notify the theory about the given model.
Some theories extend the model here are set their internal assignments. This function should be called in the on_model callback of a control's solve function.
Arguments:
- model: The current model.
Let the theory update statistics.
Some theories extend the statistics here.
Arguments:
- step: The per step statistics.
- accu: The accumulated statistics.
Register the theory with the given control object.
This function should be called once on the control object before grounding and solving starts.
Arguments:
- control: The control object to register the theory with.
Register theory related options.
Arguments:
- options: The application options.
See also: clingo.app.App.register_options
Rewrite the given statement and pass the result to the callback.
Some theories require rewriting prior to adding a non-ground program to a control object.
Arguments:
- statement: The statement to rewrite.
- callback: The callback receiving rewritten statements.
Rewrite the program in the given files and add it to the control.
Arguments:
- lib: The library to store symbols.
- control: The target control..
- files: The files to parse.
Rewrite the given program adding it to the control object.
Arguments:
- lib: The library to store symbols.
- control: The target control..
- program: The program to parse.
Check the registered options.
See also: clingo.app.App.validate_options
Get the value of the symbol in the assignment of the given thread.
It depends on the theory when this function can be called. Generally, it can be
called after on_model
while the solver is still holding its current model.
Arguments:
- thread_id: The id of the thread to query.
- symbol: The symbol to lookup.
Returns:
The value or None if unnassigned.
Assignment of theory values.
Get the value at the given index in the assignment.
Arguments:
- index: The index of the value
Returns:
The value.