Struct clingo::Control [] [src]

pub struct Control { /* fields omitted */ }

Control object holding grounding and solving state.

Methods

impl Control
[src]

[src]

Create a new control object.

Note: Only gringo options (without --output) and clasp's options are supported as arguments, except basic options such as --help. Furthermore, a control object is blocked while a search call is active; you must not call any member function during search.

Messages are printed to stderr.

Arguments

  • arguments - string array of command line arguments

Errors

[src]

Create a new control object.

Note: Only gringo options (without --output) and clasp's options are supported as arguments, except basic options such as --help. Furthermore, a control object is blocked while a search call is active; you must not call any member function during search.

Arguments

  • arguments - string array of command line arguments
  • logger - callback functions for warnings and info messages
  • message_limit - maximum number of times the logger callback is called

Errors

[src]

Extend the logic program with the given non-ground logic program in string form.

This function puts the given program into a block of form: #program name(parameters).

After extending the logic program, the corresponding program parts are typically grounded with ground().

Arguments

  • name - name of the program block
  • parameters - string array of parameters of the program block
  • program - string representation of the program

Errors

[src]

Ground the selected parts of the current (non-ground) logic program.

After grounding, logic programs can be solved with solve().

Note: Parts of a logic program without an explicit #program specification are by default put into a program called base - without arguments.

Arguments

  • parts - array of parts to ground

Errors

[src]

Ground the selected parts of the current (non-ground) logic program.

After grounding, logic programs can be solved with solve().

Note: Parts of a logic program without an explicit #program specification are by default put into a program called base - without arguments.

Arguments

Errors

[src]

Solve the currently grounded logic program enumerating its models.

Arguments

  • mode - configures the search mode
  • assumptions - array of assumptions to solve under

Errors

[src]

Solve the currently grounded logic program enumerating its models.

Arguments

  • mode - configures the search mode
  • assumptions - array of assumptions to solve under
  • handler - implementing the trait SolveEventHandler

Errors

[src]

Clean up the domains of clingo's grounding component using the solving component's top level assignment.

This function removes atoms from domains that are false and marks atoms as facts that are true. With multi-shot solving, this can result in smaller groundings because less rules have to be instantiated and more simplifications can be applied.

Errors

[src]

Assign a truth value to an external atom.

If the atom does not exist or is not external, this is a noop.

Arguments

  • atom - atom to assign
  • value - the truth value

Errors

[src]

Release an external atom.

After this call, an external atom is no longer external and subject to program simplifications. If the atom does not exist or is not external, this is a noop.

Arguments

  • atom - atom to release

Errors

[src]

Register a custom propagator with the control object.

If the sequential flag is set to true, the propagator is called sequentially when solving with multiple threads.

Arguments

  • propagator - implementing the trait Propagator
  • sequential - whether the propagator should be called sequentially

Errors

[src]

Get a statistics object to inspect solver statistics.

Statistics are updated after a solve call.

Attention: The level of detail of the statistics depends on the stats option (which can be set using Configuration or passed as an option when creating the control object). The default level zero only provides basic statistics, level one provides extended and accumulated statistics, and level two provides per-thread statistics.

Errors

[src]

Interrupt the active solve call (or the following solve call right at the beginning).

[src]

Get a configuration object to change the solver configuration.

[src]

Get a configuration object to change the solver configuration.

[src]

Configure how learnt constraints are handled during enumeration.

If the enumeration assumption is enabled, then all information learnt from the solver's various enumeration modes is removed after a solve call. This includes enumeration of cautious or brave consequences, enumeration of answer sets with or without projection, or finding optimal models, as well as clauses added with clingo_solve_control_add_clause().

Attention: For practical purposes, this option is only interesting for single-shot solving or before the last solve call to squeeze out a tiny bit of performance. Initially, the enumeration assumption is enabled.

Arguments

  • enable - whether to enable the assumption

[src]

Return the symbol for a constant definition of form: #const name = symbol.

Arguments

  • name - the name of the constant if it exists

[src]

Check if there is a constant definition for the given constant.

Arguments

  • name - the name of the constant

See: Part::get_const()

[src]

Get an object to inspect symbolic atoms (the relevant Herbrand base) used for grounding.

[src]

Get an object to inspect theory atoms that occur in the grounding.

[src]

Register a program observer with the control object.

Arguments

  • observer - the observer to register
  • replace - just pass the grounding to the observer but not the solver

Returns whether the call was successful

[src]

Get an object to add ground directives to the program.

Errors

[src]

Get an object to add non-ground directives to the program.

Trait Implementations

impl Debug for Control
[src]

[src]

Formats the value using the given formatter. Read more

impl Drop for Control
[src]

[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl Send for Control

impl Sync for Control