Clingo
Loading...
Searching...
No Matches
Clingo::Trail Class Reference

A trail is a sequence of solver literals. More...

#include <propagate.hh>

Public Types

using value_type = SolverLiteral
 The value type is a solver literal.
 
using size_type = std::size_t
 The size type.
 
using difference_type = std::ptrdiff_t
 The difference type.
 
using reference = value_type
 The reference type, which simply refers to the value type.
 
using pointer = Detail::ArrowProxy< value_type >
 The pointer type, which is a proxy to the value type.
 
using iterator = Detail::RandomAccessIterator< Trail >
 The iterator type, which is a random access iterator over the trail.
 

Public Member Functions

 Trail (clingo_assignment_t const *assignment)
 Construct a trail from the underlying C representation.
 
auto at (size_type index) const -> value_type
 Get the literal at the given index in the trail.
 
auto operator[] (size_type index) const -> value_type
 Get the literal at the given index in the trail.
 
auto size () const -> size_type
 Get the size of the trail.
 
auto begin () const -> iterator
 Get an iterator to the beginning of the trail.
 
auto end () const -> iterator
 Get an iterator to the end of the trail.
 
auto begin (ProgramId level) const -> iterator
 Get an iterator to the beginning of the given decision level.
 
auto end (ProgramId level) const -> iterator
 Get an iterator to the end of the given decision level.
 
auto level (ProgramId level) const
 Get the subrange of the literals of the given decision level.
 

Detailed Description

A trail is a sequence of solver literals.

Literals in the trail are ordered by decision levels, where the first literal with a larger level than the previous literals is a decision; the following literals with same level are implied by this decision literal. Each decision level up to and including the current decision level has a valid offset in the trail.

Constructor & Destructor Documentation

◆ Trail()

Clingo::Trail::Trail ( clingo_assignment_t const assignment)
inlineexplicit

Construct a trail from the underlying C representation.

For internal use.

Parameters
assignmentthe C representation of the assignment object

Member Function Documentation

◆ at()

auto Clingo::Trail::at ( size_type  index) const -> value_type
inline

Get the literal at the given index in the trail.

Parameters
indexthe index of the literal
Returns
the literal at the index

◆ begin() [1/2]

auto Clingo::Trail::begin ( ) const -> iterator
inline

Get an iterator to the beginning of the trail.

Returns
an iterator to the beginning of the trail

◆ begin() [2/2]

auto Clingo::Trail::begin ( ProgramId  level) const -> iterator
inline

Get an iterator to the beginning of the given decision level.

Parameters
levelthe decision level to get the literals for
Returns
the iterator pointing to the decision literal of the given level

◆ end() [1/2]

auto Clingo::Trail::end ( ) const -> iterator
inline

Get an iterator to the end of the trail.

Returns
an iterator to the end of the trail

◆ end() [2/2]

auto Clingo::Trail::end ( ProgramId  level) const -> iterator
inline

Get an iterator to the end of the given decision level.

Parameters
levelthe decision level to get the literals for
Returns
the iterator pointing to end of the literals of the given level

◆ level()

auto Clingo::Trail::level ( ProgramId  level) const
inline

Get the subrange of the literals of the given decision level.

Parameters
levelthe decision level to get the literals for
Returns
the subrange of the literals of the given level

◆ operator[]()

auto Clingo::Trail::operator[] ( size_type  index) const -> value_type
inline

Get the literal at the given index in the trail.

Parameters
indexthe index of the literal
Returns
the literal at the index

◆ size()

auto Clingo::Trail::size ( ) const -> size_type
inline

Get the size of the trail.

Returns
the size of the trail

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