Clingo C API
C API for clingo providing high level functions to control grounding and solving.
Typedefs | Functions
Asynchronous Solving

Detailed Description

Solve in the background and notify about new models.

Clingo provides two additional ways to handle solving: Iterative Solving and Asynchronous Solving. With asynchronous solving, the solving process is executed in the background, and each newly found model is signalled via a model callback.

For an example, see solve-async.c.

Typedefs

typedef struct clingo_solve_async clingo_solve_async_t
 Search handle to an asynchronous solve call. More...
 

Functions

bool clingo_solve_async_get (clingo_solve_async_t *handle, clingo_solve_result_bitset_t *result)
 Get the solve result. More...
 
bool clingo_solve_async_wait (clingo_solve_async_t *handle, double timeout, bool *result)
 Wait for the specified amount of time to check if the search has finished. More...
 
bool clingo_solve_async_cancel (clingo_solve_async_t *handle)
 Stop the running search. More...
 

Typedef Documentation

typedef struct clingo_solve_async clingo_solve_async_t

Search handle to an asynchronous solve call.

See also
clingo_control_solve_async()

Function Documentation

bool clingo_solve_async_cancel ( clingo_solve_async_t handle)

Stop the running search.

Blocks until the search is stopped.

Parameters
[in]handlethe target
Returns
whether the call was successful; might set one of the following error codes:
bool clingo_solve_async_get ( clingo_solve_async_t handle,
clingo_solve_result_bitset_t result 
)

Get the solve result.

Blocks until the search is completed.

Parameters
[in]handlethe target
[out]resultthe solve result
Returns
whether the call was successful; might set one of the following error codes:
Examples:
solve-async.c.
bool clingo_solve_async_wait ( clingo_solve_async_t handle,
double  timeout,
bool *  result 
)

Wait for the specified amount of time to check if the search has finished.

If the time is set to zero, this function can be used to poll if the search is still running.

Parameters
[in]handlethe target
[in]timeoutthe maximum time to wait
[out]resultwhether the search is still running
Returns
whether the call was successful; might set one of the following error codes: