Clingo
Loading...
Searching...
No Matches
CppClingo::Control::EventHandler Class Reference

The event handler interface. More...

#include <solver.hh>

Public Member Functions

auto on_model (Model &mdl) -> bool
 Callback to intercept models.
 
void on_stats (Potassco::AbstractStatistics &stats)
 Callback to update statistics.
 
void on_unsat (Clasp::SumView bound)
 Callback to intercept lower bounds.
 
void on_core (Potassco::LitSpan core)
 The unsatisfiable core of the current problem.
 
void on_finish (SolveResult result)
 Callback to inform that the search has finished.
 

Detailed Description

The event handler interface.

Member Function Documentation

◆ on_core()

void CppClingo::Control::EventHandler::on_core ( Potassco::LitSpan  core)
inline

The unsatisfiable core of the current problem.

Parameters
corethe core
See also
SolveHandle::core()

◆ on_finish()

void CppClingo::Control::EventHandler::on_finish ( SolveResult  result)
inline

Callback to inform that the search has finished.

Note that this function is not called from the main thread when solving asynchronously to allow for thread synchronization.

Parameters
resultthe solve result

◆ on_model()

auto CppClingo::Control::EventHandler::on_model ( Model mdl) -> bool
inline

Callback to intercept models.

The function can return false to stop search.

Parameters
mdlthe model
Returns
whether to continue or stop search

◆ on_stats()

void CppClingo::Control::EventHandler::on_stats ( Potassco::AbstractStatistics &  stats)
inline

Callback to update statistics.

Applications can add user defined statistics here. Statistics should be added under keys "user_step" and "user_accu" to appear in the text output.

Parameters
statsa handle to the statistics

◆ on_unsat()

void CppClingo::Control::EventHandler::on_unsat ( Clasp::SumView  bound)
inline

Callback to intercept lower bounds.

Whenever a (sub)problem is unsatisfiable during optimization, the current bound is reported as a lower bound.

Parameters
boundthe lower bound

The documentation for this class was generated from the following file: