Clingo
Loading...
Searching...
No Matches
propagate.hh
1#pragma once
2
3#include <clingo/base.hh>
4#include <clingo/core.hh>
5
6#include <clingo/propagate.h>
7
8namespace Clingo {
9
14
22
28
35
44
52class Trail {
53 public:
57 using size_type = std::size_t;
59 using difference_type = std::ptrdiff_t;
63 using pointer = Detail::ArrowProxy<value_type>;
65 using iterator = Detail::RandomAccessIterator<Trail>;
66
72 explicit Trail(clingo_assignment_t const *assignment) : assignment_{assignment} {}
73
79 [[nodiscard]] auto at(size_type index) const -> value_type {
80 return Detail::call<clingo_assignment_trail_at>(assignment_, index);
81 }
82
84 [[nodiscard]] auto operator[](size_type index) const -> value_type { return at(index); }
85
89 [[nodiscard]] auto size() const -> size_type { return Detail::call<clingo_assignment_trail_size>(assignment_); }
90
94 [[nodiscard]] auto begin() const -> iterator { return iterator{*this, 0}; }
95
99 [[nodiscard]] auto end() const -> iterator { return iterator{*this, size()}; }
100
105 [[nodiscard]] auto begin(ProgramId level) const -> iterator {
106 return iterator{*this, Detail::call<clingo_assignment_trail_begin>(assignment_, level)};
107 }
108
113 [[nodiscard]] auto end(ProgramId level) const -> iterator {
114 return iterator{*this, Detail::call<clingo_assignment_trail_end>(assignment_, level)};
115 }
116
121 [[nodiscard]] auto level(ProgramId level) const { return std::ranges::subrange{begin(level), end(level)}; }
122
123 private:
124 clingo_assignment_t const *assignment_;
125};
126
141 public:
145 using size_type = std::size_t;
147 using difference_type = std::ptrdiff_t;
151 using pointer = Detail::ArrowProxy<value_type>;
153 using iterator = Detail::RandomAccessIterator<Assignment>;
154
156 explicit Assignment(clingo_assignment_t const *assignment) : assignment_(assignment) {}
159 [[nodiscard]] auto thread_id() const -> ProgramId { return Detail::call<clingo_assignment_thread_id>(assignment_); }
160
167 [[nodiscard]] auto size() const -> size_type { return Detail::call<clingo_assignment_size>(assignment_); }
168
173 [[nodiscard]] auto at(size_type size) const -> value_type {
174 return Detail::call<clingo_assignment_at>(assignment_, size);
175 }
176
178 [[nodiscard]] auto operator[](size_type size) const -> value_type { return at(size); }
179
184 [[nodiscard]] auto decision(ProgramId level) const -> SolverLiteral {
185 return Detail::call<clingo_assignment_decision>(assignment_, level);
186 }
187
191 [[nodiscard]] auto decision_level() const -> ProgramId {
192 return Detail::call<clingo_assignment_decision_level>(assignment_);
193 }
194
198 [[nodiscard]] auto has_conflict() const -> bool {
199 return Detail::call<clingo_assignment_has_conflict>(assignment_);
200 }
201
205 [[nodiscard]] auto contains(SolverLiteral lit) const -> bool {
206 return Detail::call<clingo_assignment_has_literal>(assignment_, lit);
207 }
208
213 [[nodiscard]] auto is_false(SolverLiteral lit) const -> bool {
214 return Detail::call<clingo_assignment_is_false>(assignment_, lit);
215 }
216
221 [[nodiscard]] auto is_fixed(SolverLiteral lit) const -> bool {
222 return Detail::call<clingo_assignment_is_fixed>(assignment_, lit);
223 }
224
229 [[nodiscard]] auto is_free(SolverLiteral lit) const -> bool {
230 return Detail::call<clingo_assignment_truth_value>(assignment_, lit) == clingo_truth_value_free;
231 }
232
237 [[nodiscard]] auto is_true(SolverLiteral lit) const -> bool {
238 return Detail::call<clingo_assignment_is_true>(assignment_, lit);
239 }
240
246 [[nodiscard]] auto is_total() const -> bool { return Detail::call<clingo_assignment_is_total>(assignment_); }
247
252 [[nodiscard]] auto level(SolverLiteral lit) const -> ProgramId {
253 return Detail::call<clingo_assignment_level>(assignment_, lit);
254 }
255
263 [[nodiscard]] auto value(SolverLiteral lit) const -> std::optional<bool> {
264 clingo_truth_value_t res = Detail::call<clingo_assignment_truth_value>(assignment_, lit);
265 switch (res) {
267 return true;
268 }
270 return false;
271 }
272 default: {
273 return std::nullopt;
274 }
275 }
276 }
277
284 [[nodiscard]] auto root_level() const -> ProgramId {
285 return Detail::call<clingo_assignment_root_level>(assignment_);
286 }
287
291 [[nodiscard]] auto trail() const -> Trail { return Trail{assignment_}; }
292
296 [[nodiscard]] auto begin() const -> iterator { return iterator{*this, 0}; }
297
301 [[nodiscard]] auto end() const -> iterator { return iterator{*this, size()}; }
302
303 private:
304 clingo_assignment_t const *assignment_;
305};
306
312 public:
316 explicit PropagateControl(clingo_propagate_control_t *ctl) : ctl_{ctl} {}
322
329 [[nodiscard]] auto add_literal(bool freeze = true) const -> SolverLiteral {
330 return Detail::call<clingo_propagate_control_add_literal>(ctl_, freeze);
331 }
332
341 [[nodiscard]] auto add_clause(SolverLiteralSpan literals, ClauseFlags flags = ClauseFlags::none) const -> bool {
342 return Detail::call<clingo_propagate_control_add_clause>(ctl_, literals.data(), literals.size(),
343 static_cast<clingo_clause_type_t>(flags));
344 }
345
354 [[nodiscard]] auto add_clause(SolverLiteralList literals, ClauseFlags flags = ClauseFlags::none) const -> bool {
355 return add_clause(SolverLiteralSpan{literals}, flags);
356 }
357
365 [[nodiscard]] auto add_weight_constraint(SolverLiteral literal, WeightedLiteralSpan literals, Weight bound,
366 WeightConstraintType type) const -> bool {
367 return Detail::call<clingo_propagate_control_add_weight_constraint>(ctl_, literal, literals.data(),
368 literals.size(), bound, type);
369 }
370
378 [[nodiscard]] auto add_nogood(SolverLiteralSpan literals, ClauseFlags flags = ClauseFlags::none) const -> bool {
379 return add_clause(Detail::transform(literals, [](auto const &lit) { return -lit; }), flags);
380 }
381
388 void add_watch(SolverLiteral literal) const {
389 Detail::handle_error(clingo_propagate_control_add_watch(ctl_, literal));
390 }
391
396 [[nodiscard]] auto has_watch(SolverLiteral literal) const -> bool {
397 return Detail::call<clingo_propagate_control_has_watch>(ctl_, literal);
398 }
399
403 void remove_watch(SolverLiteral lit) const {
404 Detail::handle_error(clingo_propagate_control_remove_watch(ctl_, lit));
405 }
406
414 [[nodiscard]] auto propagate() const -> bool { return Detail::call<clingo_propagate_control_propagate>(ctl_); }
415
416 private:
418};
419
435 public:
440
444 [[nodiscard]] auto library() const -> Library {
445 return Library{Detail::call<clingo_propagate_init_library>(init_), true};
446 }
447
451 [[nodiscard]] auto base() const -> Base { return Base{Detail::call<clingo_propagate_init_base>(init_)}; }
452
456 [[nodiscard]] auto check_mode() const -> PropagatorCheckMode {
457 return static_cast<PropagatorCheckMode>(Detail::call<clingo_propagate_init_get_check_mode>(init_));
458 }
459
464 Detail::handle_error(
466 }
467
471 [[nodiscard]] auto number_of_threads() const -> ProgramId {
472 return Detail::call<clingo_propagate_init_number_of_threads>(init_);
473 }
474
478 [[nodiscard]] auto undo_mode() const -> PropagatorUndoMode {
479 return static_cast<PropagatorUndoMode>(Detail::call<clingo_propagate_init_get_undo_mode>(init_));
480 }
481
485 void undo_mode(PropagatorUndoMode mode) const {
486 Detail::handle_error(
488 }
489
494 [[nodiscard]] auto solver_literal(ProgramLiteral literal) const -> SolverLiteral {
495 return Detail::call<clingo_propagate_init_solver_literal>(init_, literal);
496 }
497
503 void add_minimize(SolverLiteral literal, Weight weight, Weight priority) const {
504 Detail::handle_error(clingo_propagate_init_add_minimize(init_, literal, weight, priority));
505 }
506
512 void freeze_literal(SolverLiteral literal) const {
513 Detail::handle_error(clingo_propagate_init_freeze_literal(init_, literal));
514 }
515
516 private:
518};
519
522 public:
524 Propagator() = default;
526 Propagator(Propagator &&other) = delete;
528 auto operator=(Propagator &&other) -> Propagator & = delete;
530 virtual ~Propagator() = default;
531
536 void init(Assignment assignment, PropagateInit init) { do_init(assignment, init); }
543 void attach(Assignment assignment, PropagateControl ctl) { do_attach(assignment, ctl); }
544
557 do_propagate(assignment, ctl, changes);
558 }
559
570 void undo(Assignment assignment, ProgramLiteralSpan changes) { do_undo(assignment, changes); }
571
582 void check(Assignment assignment, PropagateControl ctl) { do_check(assignment, ctl); }
583
584 private:
585 virtual void do_init([[maybe_unused]] Assignment assignment, [[maybe_unused]] PropagateInit init) {}
586 virtual void do_attach([[maybe_unused]] Assignment assignment, [[maybe_unused]] PropagateControl ctl) {}
587 virtual void do_propagate([[maybe_unused]] Assignment assignment, [[maybe_unused]] PropagateControl ctl,
588 [[maybe_unused]] ProgramLiteralSpan changes) {}
589 virtual void do_undo([[maybe_unused]] Assignment assignment, [[maybe_unused]] ProgramLiteralSpan changes) {}
590 virtual void do_check([[maybe_unused]] Assignment assignment, [[maybe_unused]] PropagateControl ctl) {}
591};
592
594class Heuristic : public Propagator {
595 public:
597 Heuristic() = default;
598
607 auto decide(Assignment assignment, SolverLiteral literal) -> SolverLiteral {
608 return do_decide(assignment, literal);
609 }
610
611 private:
612 virtual auto do_decide([[maybe_unused]] Assignment assignment, clingo_literal_t literal) -> clingo_literal_t {
613 return literal;
614 }
615};
616
618
619namespace Detail {
620
621inline static constexpr auto c_propagator = clingo_propagator_t{
622 [](clingo_assignment_t const *assignment, clingo_propagate_init_t *init, void *data) -> bool {
623 auto &self = *static_cast<Propagator *>(data);
624 CLINGO_TRY {
625 self.init(Assignment{assignment}, PropagateInit{init});
626 }
627 CLINGO_CATCH;
628 },
629 [](clingo_assignment_t const *assignment, clingo_propagate_control_t *control, void *data) {
630 auto &self = *static_cast<Propagator *>(data);
631 CLINGO_TRY {
632 self.attach(Assignment{assignment}, PropagateControl{control});
633 }
634 CLINGO_CATCH;
635 },
636 [](clingo_assignment_t const *assignment, clingo_propagate_control_t *control, clingo_literal_t const *changes,
637 size_t size, void *data) -> bool {
638 auto &self = *static_cast<Propagator *>(data);
639 CLINGO_TRY {
640 self.propagate(Assignment{assignment}, PropagateControl{control}, SolverLiteralSpan{changes, size});
641 }
642 CLINGO_CATCH;
643 },
644 [](clingo_assignment_t const *assignment, clingo_literal_t const *changes, size_t size, void *data) {
645 auto &self = *static_cast<Propagator *>(data);
646 try {
647 self.undo(Assignment{assignment}, SolverLiteralSpan{changes, size});
648 } catch (std::exception const &e) {
649 printf("panic: %s\n", e.what());
650 std::abort();
651 }
652 },
653 [](clingo_assignment_t const *assignment, clingo_propagate_control_t *control, void *data) -> bool {
654 auto &self = *static_cast<Propagator *>(data);
655 CLINGO_TRY {
656 self.check(Assignment{assignment}, PropagateControl{control});
657 }
658 CLINGO_CATCH;
659 },
660 nullptr,
661 [](void *data) { std::ignore = std::unique_ptr<Propagator>(static_cast<Propagator *>(data)); },
662};
663
664inline static constexpr auto c_heuristic = clingo_propagator_t{
665 c_propagator.init,
666 c_propagator.attach,
667 c_propagator.propagate,
668 c_propagator.undo,
669 c_propagator.check,
670 [](clingo_assignment_t const *assignment, clingo_literal_t fallback, void *data,
671 clingo_literal_t *decision) -> bool {
672 auto &self = *static_cast<Propagator *>(data);
673 CLINGO_TRY {
674 // NOLINTBEGIN
675 *decision = static_cast<Heuristic &>(self).decide(Assignment{assignment}, fallback);
676 // NOLINTEND
677 }
678 CLINGO_CATCH;
679 },
680 c_propagator.free,
681};
682
683} // namespace Detail
684
685} // namespace Clingo
Represents a (partial) assignment of a particular solver.
Definition propagate.hh:140
value_type reference
The reference type, which simply refers to the value type.
Definition propagate.hh:149
auto has_conflict() const -> bool
Check if the assignment is conflicting.
Definition propagate.hh:198
SolverLiteral value_type
The value type, which is a solver literal.
Definition propagate.hh:143
auto contains(SolverLiteral lit) const -> bool
Check whether the assignment contains the given literal.
Definition propagate.hh:205
auto thread_id() const -> ProgramId
Get the id of the thread to which the assignment belongs.
Definition propagate.hh:159
auto is_free(SolverLiteral lit) const -> bool
Check if the truth value of the given literal is free.
Definition propagate.hh:229
auto begin() const -> iterator
Get an iterator to the beginning of the assignment.
Definition propagate.hh:296
auto trail() const -> Trail
Get the trail of the assignment.
Definition propagate.hh:291
auto size() const -> size_type
Get the size of the assignment.
Definition propagate.hh:167
auto decision(ProgramId level) const -> SolverLiteral
Get the decision literal for the given decision level.
Definition propagate.hh:184
auto is_fixed(SolverLiteral lit) const -> bool
Check if the truth value of the given literal is fixed.
Definition propagate.hh:221
auto value(SolverLiteral lit) const -> std::optional< bool >
Get the truth value of the given literal.
Definition propagate.hh:263
auto is_total() const -> bool
Check whether the assignment is total.
Definition propagate.hh:246
Assignment(clingo_assignment_t const *assignment)
Construct an assignment from the underlying C representation.
Definition propagate.hh:156
auto at(size_type size) const -> value_type
Get the literal at the given index in the assignment.
Definition propagate.hh:173
Detail::RandomAccessIterator< Assignment > iterator
The iterator type, which is a random access iterator over the assignment.
Definition propagate.hh:153
auto level(SolverLiteral lit) const -> ProgramId
Get the level on which the given literal was assigned.
Definition propagate.hh:252
std::ptrdiff_t difference_type
The difference type.
Definition propagate.hh:147
auto end() const -> iterator
Get an iterator to the end of the assignment.
Definition propagate.hh:301
auto decision_level() const -> ProgramId
Get the current decision level.
Definition propagate.hh:191
auto root_level() const -> ProgramId
Get the root level of the assignment.
Definition propagate.hh:284
auto is_true(SolverLiteral lit) const -> bool
Check if the given literal is true.
Definition propagate.hh:237
auto is_false(SolverLiteral lit) const -> bool
Check if the given literal is false.
Definition propagate.hh:213
std::size_t size_type
The size type.
Definition propagate.hh:145
auto operator[](size_type size) const -> value_type
Get the literal at the given index in the assignment.
Definition propagate.hh:178
Detail::ArrowProxy< value_type > pointer
The pointer type, which is a proxy to the value type.
Definition propagate.hh:151
A base that maps signatures to atom bases, and captures term and theory bases.
Definition base.hh:607
Interface for user-defined propagators with a decision heuristic.
Definition propagate.hh:594
Heuristic()=default
The default constructor.
auto decide(Assignment assignment, SolverLiteral literal) -> SolverLiteral
Callback to decide on the next literal to assign.
Definition propagate.hh:607
The main library class for managing global information and logging.
Definition core.hh:471
Class to control a user-defined propagator.
Definition propagate.hh:311
PropagateControl(clingo_propagate_init_t *init)
Constructor from the underlying C representation.
Definition propagate.hh:320
auto add_clause(SolverLiteralSpan literals, ClauseFlags flags=ClauseFlags::none) const -> bool
Add a clause to the solver.
Definition propagate.hh:341
auto add_clause(SolverLiteralList literals, ClauseFlags flags=ClauseFlags::none) const -> bool
Add a clause to the solver.
Definition propagate.hh:354
auto propagate() const -> bool
Propagate consequences of previously added clauses.
Definition propagate.hh:414
PropagateControl(clingo_propagate_control_t *ctl)
Constructor from the underlying C representation.
Definition propagate.hh:316
void remove_watch(SolverLiteral lit) const
Remove a watch for the given solver literal.
Definition propagate.hh:403
auto add_nogood(SolverLiteralSpan literals, ClauseFlags flags=ClauseFlags::none) const -> bool
Add a nogood to the solver.
Definition propagate.hh:378
void add_watch(SolverLiteral literal) const
Add a watch for the given solver literal.
Definition propagate.hh:388
auto add_literal(bool freeze=true) const -> SolverLiteral
Adds a literal to the problem or the active solver thread.
Definition propagate.hh:329
auto add_weight_constraint(SolverLiteral literal, WeightedLiteralSpan literals, Weight bound, WeightConstraintType type) const -> bool
Add a weight constraint to the solver.
Definition propagate.hh:365
auto has_watch(SolverLiteral literal) const -> bool
Check whether the given solver literal is watched in the current context.
Definition propagate.hh:396
Object to initialize a user-defined propagator before each solving step.
Definition propagate.hh:434
PropagateInit(clingo_propagate_init_t *init)
Constructor from the underlying C representation.
Definition propagate.hh:439
auto library() const -> Library
Get the library object associated with the propagator.
Definition propagate.hh:444
void freeze_literal(SolverLiteral literal) const
Freeze the given literal in the solver.
Definition propagate.hh:512
void add_minimize(SolverLiteral literal, Weight weight, Weight priority) const
Add a weighted literal to minimize to the solver.
Definition propagate.hh:503
auto check_mode() const -> PropagatorCheckMode
Get the check mode of the propagator.
Definition propagate.hh:456
void undo_mode(PropagatorUndoMode mode) const
Set the undo mode of the propagator.
Definition propagate.hh:485
auto solver_literal(ProgramLiteral literal) const -> SolverLiteral
Map a program literal to a solver literal.
Definition propagate.hh:494
auto undo_mode() const -> PropagatorUndoMode
Get the undo mode of the propagator.
Definition propagate.hh:478
auto base() const -> Base
Get the base object associated with the propagator.
Definition propagate.hh:451
void check_mode(PropagatorCheckMode mode)
Set the check mode of the propagator.
Definition propagate.hh:463
auto number_of_threads() const -> ProgramId
Get the number of threads used in subsequent solving.
Definition propagate.hh:471
Interface for user-defined propagators.
Definition propagate.hh:521
Propagator()=default
The default constructor.
void check(Assignment assignment, PropagateControl ctl)
Callback that is called on propagation fixpoints or total assignments.
Definition propagate.hh:582
Propagator(Propagator &&other)=delete
Disable copy and move operations.
void attach(Assignment assignment, PropagateControl ctl)
Callback to initialize/setup thread-specific data for the propagator.
Definition propagate.hh:543
auto operator=(Propagator &&other) -> Propagator &=delete
Disable copy and move operations.
virtual ~Propagator()=default
The destructor.
void propagate(Assignment assignment, PropagateControl ctl, ProgramLiteralSpan changes)
Callback to propagate consequences of the given literals.
Definition propagate.hh:556
void undo(Assignment assignment, ProgramLiteralSpan changes)
Called when the solver backtracks to a previous decision level.
Definition propagate.hh:570
void init(Assignment assignment, PropagateInit init)
Callback to initialize the propagator before each solving step.
Definition propagate.hh:536
A trail is a sequence of solver literals.
Definition propagate.hh:52
value_type reference
The reference type, which simply refers to the value type.
Definition propagate.hh:61
auto end(ProgramId level) const -> iterator
Get an iterator to the end of the given decision level.
Definition propagate.hh:113
Trail(clingo_assignment_t const *assignment)
Construct a trail from the underlying C representation.
Definition propagate.hh:72
Detail::RandomAccessIterator< Trail > iterator
The iterator type, which is a random access iterator over the trail.
Definition propagate.hh:65
auto size() const -> size_type
Get the size of the trail.
Definition propagate.hh:89
auto operator[](size_type index) const -> value_type
Get the literal at the given index in the trail.
Definition propagate.hh:84
auto level(ProgramId level) const
Get the subrange of the literals of the given decision level.
Definition propagate.hh:121
std::ptrdiff_t difference_type
The difference type.
Definition propagate.hh:59
Detail::ArrowProxy< value_type > pointer
The pointer type, which is a proxy to the value type.
Definition propagate.hh:63
auto begin() const -> iterator
Get an iterator to the beginning of the trail.
Definition propagate.hh:94
SolverLiteral value_type
The value type is a solver literal.
Definition propagate.hh:55
auto at(size_type index) const -> value_type
Get the literal at the given index in the trail.
Definition propagate.hh:79
auto begin(ProgramId level) const -> iterator
Get an iterator to the beginning of the given decision level.
Definition propagate.hh:105
std::size_t size_type
The size type.
Definition propagate.hh:57
auto end() const -> iterator
Get an iterator to the end of the trail.
Definition propagate.hh:99
int32_t clingo_literal_t
Signed integer type used for aspif and solver literals.
Definition core.h:73
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_add_watch(clingo_propagate_control_t *control, clingo_literal_t literal)
Add a watch for the solver literal in the given phase.
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_set_undo_mode(clingo_propagate_init_t *init, clingo_propagator_undo_mode_t mode)
Configure when to call the undo method of the propagator.
struct clingo_propagate_control clingo_propagate_control_t
This object can be used to add clauses and propagate literals while solving.
Definition propagate.h:242
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_remove_watch(clingo_propagate_control_t *control, clingo_literal_t literal)
Removes the watch (if any) for the given solver literal.
int clingo_weight_constraint_type_t
Corresponding type to clingo_weight_constraint_type_e.
Definition propagate.h:239
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_control(clingo_propagate_init_t const *init, clingo_propagate_control_t **control)
Get the underlying propagate control object.
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_add_minimize(clingo_propagate_init_t *init, clingo_literal_t solver_literal, clingo_weight_t weight, clingo_weight_t priority)
Add the given literal to minimize to the solver.
int clingo_propagator_undo_mode_t
Corresponding type to clingo_propagator_undo_mode_e.
Definition propagate.h:230
struct clingo_assignment clingo_assignment_t
Represents a (partial) assignment of a particular solver.
Definition propagate.h:46
struct clingo_propagate_init clingo_propagate_init_t
Object to initialize a user-defined propagator before each solving step.
Definition propagate.h:255
int clingo_propagator_check_mode_t
Corresponding type to clingo_propagator_check_mode_e.
Definition propagate.h:222
int clingo_truth_value_t
Corresponding type to clingo_truth_value_e.
Definition propagate.h:55
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_set_check_mode(clingo_propagate_init_t *init, clingo_propagator_check_mode_t mode)
Configure when to call the check method of the propagator.
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_freeze_literal(clingo_propagate_init_t *init, clingo_literal_t solver_literal)
Freeze the given solver literal.
int clingo_clause_type_t
Corresponding type to clingo_clause_type_e.
Definition propagate.h:374
@ clingo_propagator_check_mode_both
call clingo_propagator::check() on propagation fixpoints and total assignments
Definition propagate.h:218
@ clingo_propagator_check_mode_none
do not call clingo_propagator::check() at all
Definition propagate.h:215
@ clingo_propagator_check_mode_fixpoint
call clingo_propagator::check() on propagation fixpoints
Definition propagate.h:217
@ clingo_propagator_check_mode_total
call clingo_propagator::check() on total assignments
Definition propagate.h:216
@ clingo_truth_value_false
false
Definition propagate.h:52
@ clingo_truth_value_true
true
Definition propagate.h:51
@ clingo_truth_value_free
no truth value
Definition propagate.h:50
@ clingo_clause_type_learnt
clause is subject to the solvers deletion policy
Definition propagate.h:366
@ clingo_clause_type_volatile
like clingo_clause_type_learnt but the clause is deleted after a solving step
Definition propagate.h:368
@ clingo_clause_type_static
clause is not subject to the solvers deletion policy
Definition propagate.h:367
@ clingo_propagator_undo_mode_default
call clingo_propagator::undo() for non-empty change lists
Definition propagate.h:226
@ clingo_propagator_undo_mode_always
also call clingo_propagator::check() when check has been called
Definition propagate.h:227
@ clingo_weight_constraint_type_implication_right
the literal implies the weight constraint
Definition propagate.h:235
@ clingo_weight_constraint_type_implication_left
the weight constraint implies the literal
Definition propagate.h:234
@ clingo_weight_constraint_type_equivalence
the weight constraint is equivalent to the literal
Definition propagate.h:236
clingo_literal_t SolverLiteral
A solver literal.
Definition core.hh:399
std::initializer_list< SolverLiteral const > SolverLiteralList
A list of solver literals.
Definition core.hh:403
clingo_weight_t Weight
A weight used in sum aggregates and minimize constraints.
Definition core.hh:408
clingo_literal_t ProgramLiteral
A program literal.
Definition core.hh:392
std::span< SolverLiteral const > SolverLiteralSpan
A span of solver literals.
Definition core.hh:401
std::span< WeightedLiteral const > WeightedLiteralSpan
A span of weighted literals.
Definition core.hh:415
clingo_id_t ProgramId
A program id used for various kinds of indices.
Definition core.hh:382
std::span< ProgramLiteral const > ProgramLiteralSpan
A span of program literals.
Definition core.hh:394
@ level
Set the level of an atom.
@ init
Modify the initial VSIDS score of an atom.
WeightConstraintType
Enumeration of weight constraint types.
Definition propagate.hh:30
ClauseFlags
Enumeration of clause flags.
Definition propagate.hh:37
PropagatorCheckMode
Enumeration of propagator check modes.
Definition propagate.hh:16
PropagatorUndoMode
Enumeration of propagator undo modes.
Definition propagate.hh:24
@ equivalence
The weight constraint is equivalent to the literal.
Definition propagate.hh:33
@ implication_left
The weight constraint implies the literal.
Definition propagate.hh:31
@ implication_right
The literal implies the weight constraint.
Definition propagate.hh:32
@ lock
Exempt the clause from deletion.
Definition propagate.hh:39
@ tag
Delete the clause at the end of the current solving step.
Definition propagate.hh:40
@ none
The empty set of flags.
Definition propagate.hh:38
@ fixpoint
Call check on propagation fixpoints.
@ both
Call check on propagation fixpoints and total assignments.
@ total
Call check on total assignments.
@ default_
Call undo for non-empty change lists.
@ always
Also call undo for empty change lists.
#define CLINGO_ENABLE_BITSET_ENUM(E,...)
Opt-in macro for enabling bit operations for a given enum type.
Definition enum.hh:18
An instance of this struct has to be registered with a solver to implement a custom propagator.
Definition propagate.h:493