ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
CaDiCaL::Solver Class Reference

#include <cadical.hpp>

Classes

struct  CubesWithStatus
 

Public Member Functions

 Solver ()
 
 ~Solver ()
 
void add (int lit)
 
void clause (int)
 
void clause (int, int)
 
void clause (int, int, int)
 
void clause (int, int, int, int)
 
void clause (int, int, int, int, int)
 
void clause (const std::vector< int > &)
 
void clause (const int *, size_t)
 
bool inconsistent ()
 
void assume (int lit)
 
int solve ()
 
int val (int lit)
 
bool flip (int lit)
 
bool flippable (int lit)
 
bool failed (int lit)
 
void connect_terminator (Terminator *terminator)
 
void disconnect_terminator ()
 
void connect_learner (Learner *learner)
 
void disconnect_learner ()
 
void connect_fixed_listener (FixedAssignmentListener *fixed_listener)
 
void disconnect_fixed_listener ()
 
void connect_external_propagator (ExternalPropagator *propagator)
 
void disconnect_external_propagator ()
 
void add_observed_var (int var)
 
void remove_observed_var (int var)
 
void reset_observed_vars ()
 
bool is_decision (int lit)
 
void force_backtrack (size_t new_level)
 
void constrain (int lit)
 
bool constraint_failed ()
 
int propagate ()
 
void implied (std::vector< int > &implicants)
 
int lookahead (void)
 
CubesWithStatus generate_cubes (int, int min_depth=0)
 
void reset_assumptions ()
 
void reset_constraint ()
 
const Statestate () const
 
int status () const
 
void copy (Solver &other) const
 
int vars ()
 
void reserve (int min_max_var)
 
int reserve_difference (int number_of_vars)
 
int get (const char *name)
 
void prefix (const char *verbose_message_prefix)
 
bool set (const char *name, int val)
 
bool set_long_option (const char *arg)
 
bool configure (const char *)
 
void optimize (int val)
 
bool limit (const char *arg, int val)
 
bool is_valid_limit (const char *arg)
 
int active () const
 
int64_t redundant () const
 
int64_t irredundant () const
 
int simplify (int rounds=3)
 
void terminate ()
 
bool frozen (int lit) const
 
void freeze (int lit)
 
void melt (int lit)
 
int fixed (int lit) const
 
void phase (int lit)
 
void unphase (int lit)
 
bool trace_proof (FILE *file, const char *name)
 
bool trace_proof (const char *path)
 
void flush_proof_trace (bool print=false)
 
void close_proof_trace (bool print=false)
 
void connect_proof_tracer (Tracer *tracer, bool antecedents, bool finalize_clauses=false)
 
void connect_proof_tracer (InternalTracer *tracer, bool antecedents, bool finalize_clauses=false)
 
void connect_proof_tracer (StatTracer *tracer, bool antecedents, bool finalize_clauses=false)
 
void connect_proof_tracer (FileTracer *tracer, bool antecedents, bool finalize_clauses=false)
 
void conclude ()
 
bool disconnect_proof_tracer (Tracer *tracer)
 
bool disconnect_proof_tracer (StatTracer *tracer)
 
bool disconnect_proof_tracer (FileTracer *tracer)
 
void statistics ()
 
void resources ()
 
void options ()
 
bool traverse_clauses (ClauseIterator &) const
 
bool traverse_witnesses_backward (WitnessIterator &) const
 
bool traverse_witnesses_forward (WitnessIterator &) const
 
const char * read_dimacs (FILE *file, const char *name, int &vars, int strict=1)
 
const char * read_dimacs (const char *path, int &vars, int strict=1)
 
const char * read_dimacs (FILE *file, const char *name, int &vars, int strict, bool &incremental, std::vector< int > &cubes)
 
const char * read_dimacs (const char *path, int &vars, int strict, bool &incremental, std::vector< int > &cubes)
 
const char * write_dimacs (const char *path, int min_max_var=0)
 
const char * write_extension (const char *path)
 

Static Public Member Functions

static const char * signature ()
 
static const char * version ()
 
static bool is_valid_option (const char *name)
 
static bool is_preprocessing_option (const char *name)
 
static bool is_valid_long_option (const char *arg)
 
static bool is_valid_configuration (const char *)
 
static void usage ()
 
static void configurations ()
 
static void build (FILE *file, const char *prefix="c ")
 

Friends

class Testing
 
class App
 
class Mobical
 
class Parser
 
struct DumpCall
 
struct LemmaCall
 
struct ObserveCall
 
struct DisconnectCall
 
class MockPropagator
 

Detailed Description

Definition at line 230 of file cadical.hpp.

Constructor & Destructor Documentation

◆ Solver()

CaDiCaL::Solver::Solver ( )

Definition at line 326 of file cadical_solver.cpp.

326 {
327
328#ifndef CADICAL_NTRACING
329 const char *path = getenv ("CADICAL_API_TRACE");
330 if (!path)
331 path = getenv ("CADICALAPITRACE");
332 if (path) {
333 if (tracing_api_calls_through_environment_variable_method)
334 FATAL ("can not trace API calls of two solver instances "
335 "using environment variable 'CADICAL_API_TRACE'");
336 if (!(trace_api_file = fopen (path, "w")))
337 FATAL ("failed to open file '%s' to trace API calls "
338 "using environment variable 'CADICAL_API_TRACE'",
339 path);
340 close_trace_api_file = true;
341 tracing_api_calls_through_environment_variable_method = true;
342 } else {
343 tracing_api_calls_through_environment_variable_method = false;
344 close_trace_api_file = false;
345 trace_api_file = 0;
346 }
347#endif
348
349 adding_clause = false;
350 adding_constraint = false;
351 _state = INITIALIZING;
352 internal = new Internal ();
353 DeferDeletePtr<Internal> delete_internal (internal);
354 TRACE ("init");
355 external = new External (internal);
356 DeferDeletePtr<External> delete_external (external);
358#ifndef CADICAL_NTRACING
359 if (tracing_api_calls_through_environment_variable_method)
360 message ("tracing API calls to '%s'", path);
361#endif
362
363 const char *lidrup_path = getenv ("CADICAL_LIDRUP_TRACE");
364 if (!lidrup_path)
365 lidrup_path = getenv ("CADICALLIDRUPTRACE");
366 if (lidrup_path) {
367
368 // if (tracing_nb_lidrup_env_var_method)
369 // FATAL ("can not trace LIDRUP of two solver instances "
370 // "using environment variable 'CADICAL_LIDRUP_TRACE'");
371 // Here we use the solver interface to setup non-binary IDRUP tracing to
372 // the defined file. Options set by the user can and will overwrite
373 // these settings if neeed be.
374 set ("lidrup", 1);
375 set ("binary", 0);
376 trace_proof (lidrup_path);
377 tracing_nb_lidrup_env_var_method = true;
378 } else {
379 tracing_nb_lidrup_env_var_method = false;
380 }
381
382 delete_internal.release ();
383 delete_external.release ();
384}
#define STATE(S)
#define TRACE(...)
bool set(const char *name, int val)
bool trace_proof(FILE *file, const char *name)
#define FATAL
Definition message.hpp:64
@ INITIALIZING
Definition cadical.hpp:187
@ CONFIGURING
Definition cadical.hpp:188
char * getenv()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~Solver()

CaDiCaL::Solver::~Solver ( )

Definition at line 386 of file cadical_solver.cpp.

386 {
387
388 TRACE ("reset");
390 STATE (DELETING);
391
392 tracing_nb_lidrup_env_var_method = false;
393
394#ifdef LOGGING
395 //
396 // After deleting 'internal' logging does not work anymore.
397 //
398 bool logging = internal->opts.log;
399 int level = internal->level;
400 string prefix = internal->prefix;
401#endif
402
403 delete internal;
404 delete external;
405
406#ifndef CADICAL_NTRACING
407 if (close_trace_api_file) {
408 close_trace_api_file = false;
409 CADICAL_assert (trace_api_file);
410 CADICAL_assert (tracing_api_calls_through_environment_variable_method);
411 fclose (trace_api_file);
412 tracing_api_calls_through_environment_variable_method = false;
413 }
414#endif
415
416#ifdef LOGGING
417 //
418 // Need to log success of this API call manually.
419 //
420 if (logging) {
421 printf ("%s%sLOG %s%d%s API call %s'reset ()'%s succeeded%s\n",
422 prefix.c_str (), tout.log_code (), tout.emph_code (), level,
423 tout.log_code (), tout.api_code (), tout.log_code (),
424 tout.normal_code ());
425 fflush (stdout);
426 }
427#endif
428}
#define CADICAL_assert(ignore)
Definition global.h:14
void prefix(const char *verbose_message_prefix)
const char * normal_code()
Definition terminal.hpp:80
#define REQUIRE_VALID_OR_SOLVING_STATE()
Definition contract.hpp:126
Terminal tout(stdout)
Definition terminal.hpp:97
Here is the call graph for this function:

Member Function Documentation

◆ active()

int CaDiCaL::Solver::active ( ) const

Definition at line 1069 of file cadical_solver.cpp.

1069 {
1070 TRACE ("active");
1072 int res = internal->active ();
1073 LOG_API_CALL_RETURNS ("active", res);
1074 return res;
1075}
#define LOG_API_CALL_RETURNS(...)
#define REQUIRE_VALID_STATE()
Definition contract.hpp:120

◆ add()

void CaDiCaL::Solver::add ( int lit)

Definition at line 577 of file cadical_solver.cpp.

577 {
578 TRACE ("add", lit);
580 if (lit)
582 transition_to_steady_state ();
583 external->add (lit);
584 adding_clause = lit;
585 if (adding_clause)
586 STATE (ADDING);
587 else if (!adding_constraint)
588 STATE (STEADY);
589 LOG_API_CALL_END ("add", lit);
590}
#define LOG_API_CALL_END(...)
#define REQUIRE_VALID_LIT(...)
Definition contract.hpp:129
int lit
Definition satVec.h:130
Here is the caller graph for this function:

◆ add_observed_var()

void CaDiCaL::Solver::add_observed_var ( int var)

Definition at line 1044 of file cadical_solver.cpp.

1044 {
1045 TRACE ("observe", idx);
1047 REQUIRE_VALID_LIT (idx);
1048 external->add_observed_var (idx);
1049 LOG_API_CALL_END ("observe", idx);
1050}

◆ assume()

void CaDiCaL::Solver::assume ( int lit)

Definition at line 664 of file cadical_solver.cpp.

664 {
665 TRACE ("assume", lit);
668 transition_to_steady_state ();
669 external->assume (lit);
670 LOG_API_CALL_END ("assume", lit);
671}

◆ build()

void CaDiCaL::Solver::build ( FILE * file,
const char * prefix = "c " )
static

Definition at line 1266 of file cadical_solver.cpp.

1266 {
1267
1268 CADICAL_assert (file == stdout || file == stderr);
1269
1270 Terminal *terminal;
1271
1272 if (file == stdout)
1273 terminal = &tout;
1274 else if (file == stderr)
1275 terminal = &terr;
1276 else
1277 terminal = 0;
1278
1279 const char *v = CaDiCaL::version ();
1280 const char *i = identifier ();
1281 const char *c = compiler ();
1282 const char *b = date ();
1283 const char *f = flags ();
1284
1285 CADICAL_assert (v);
1286
1287 fputs (prefix, file);
1288 if (terminal)
1289 terminal->magenta ();
1290 fputs ("Version ", file);
1291 if (terminal)
1292 terminal->normal ();
1293 fputs (v, file);
1294 if (i) {
1295 if (terminal)
1296 terminal->magenta ();
1297 fputc (' ', file);
1298 fputs (i, file);
1299 if (terminal)
1300 terminal->normal ();
1301 }
1302 fputc ('\n', file);
1303
1304 if (c) {
1305 fputs (prefix, file);
1306 if (terminal)
1307 terminal->magenta ();
1308 fputs (c, file);
1309 if (f) {
1310 fputc (' ', file);
1311 fputs (f, file);
1312 }
1313 if (terminal)
1314 terminal->normal ();
1315 fputc ('\n', file);
1316 }
1317
1318 if (b) {
1319 fputs (prefix, file);
1320 if (terminal)
1321 terminal->magenta ();
1322 fputs (b, file);
1323 if (terminal)
1324 terminal->normal ();
1325 fputc ('\n', file);
1326 }
1327
1328 fflush (file);
1329}
struct file file
Definition file.h:21
const char * version()
const char * date()
const char * identifier()
Terminal terr(stderr)
Definition terminal.hpp:98
const char * flags()
const char * compiler()
Here is the call graph for this function:

◆ clause() [1/7]

void CaDiCaL::Solver::clause ( const int * lits,
size_t size )

Definition at line 627 of file cadical_solver.cpp.

627 {
628 REQUIRE (!size || lits,
629 "first argument 'lits' zero while second argument 'size' not");
630 const int *end = lits + size;
631 for (const int *p = lits; p != end; p++) {
632 const int lit = *p;
634 add (lit);
635 }
636 add (0);
637}
void add(int lit)
#define REQUIRE(...)
Definition contract.hpp:114
Cube * p
Definition exorList.c:222
unsigned long long size
Definition giaNewBdd.h:39
Here is the call graph for this function:

◆ clause() [2/7]

void CaDiCaL::Solver::clause ( const std::vector< int > & lits)

Definition at line 639 of file cadical_solver.cpp.

639 {
640 for (auto lit : lits) {
642 add (lit);
643 }
644 add (0);
645}
Here is the call graph for this function:

◆ clause() [3/7]

void CaDiCaL::Solver::clause ( int a)

Definition at line 592 of file cadical_solver.cpp.

592 {
594 add (a), add (0);
595}
Here is the call graph for this function:

◆ clause() [4/7]

void CaDiCaL::Solver::clause ( int a,
int b )

Definition at line 597 of file cadical_solver.cpp.

597 {
600 add (a), add (b), add (0);
601}
Here is the call graph for this function:

◆ clause() [5/7]

void CaDiCaL::Solver::clause ( int a,
int b,
int c )

Definition at line 603 of file cadical_solver.cpp.

603 {
607 add (a), add (b), add (c), add (0);
608}
Here is the call graph for this function:

◆ clause() [6/7]

void CaDiCaL::Solver::clause ( int a,
int b,
int c,
int d )

Definition at line 610 of file cadical_solver.cpp.

610 {
615 add (a), add (b), add (c), add (d), add (0);
616}
Here is the call graph for this function:

◆ clause() [7/7]

void CaDiCaL::Solver::clause ( int a,
int b,
int c,
int d,
int e )

Definition at line 618 of file cadical_solver.cpp.

618 {
624 add (a), add (b), add (c), add (d), add (e), add (0);
625}
Here is the call graph for this function:

◆ close_proof_trace()

void CaDiCaL::Solver::close_proof_trace ( bool print = false)

Definition at line 1162 of file cadical_solver.cpp.

1162 {
1163 TRACE ("close_proof_trace");
1165 REQUIRE (!internal->file_tracers.empty (), "proof is not traced");
1166 REQUIRE (!internal->file_tracers.back ()->closed (),
1167 "proof trace already closed");
1168 internal->close_trace (print_statistics_unless_quiet);
1169 LOG_API_CALL_END ("close_proof_trace");
1170}

◆ conclude()

void CaDiCaL::Solver::conclude ( )

Definition at line 1247 of file cadical_solver.cpp.

1247 {
1248 TRACE ("conclude");
1250 REQUIRE (state () == UNSATISFIED || state () == SATISFIED ||
1251 state () == INCONCLUSIVE,
1252 "can only conclude in satisfied, unsatisfied or inconclusive state");
1253 if (state () == UNSATISFIED)
1254 internal->conclude_unsat ();
1255 else if (state () == SATISFIED)
1256 external->conclude_sat ();
1257 else if (state () == INCONCLUSIVE)
1258 external->conclude_unknown ();
1260 state () == INCONCLUSIVE);
1261 LOG_API_CALL_END ("conclude");
1262}
const State & state() const
Definition cadical.hpp:529
@ SATISFIED
Definition cadical.hpp:192
@ INCONCLUSIVE
Definition cadical.hpp:195
@ UNSATISFIED
Definition cadical.hpp:193
Here is the call graph for this function:

◆ configurations()

void CaDiCaL::Solver::configurations ( )
static

Definition at line 1342 of file cadical_solver.cpp.

1342{ Config::usage (); }
static void usage()
Here is the call graph for this function:

◆ configure()

bool CaDiCaL::Solver::configure ( const char * name)

Definition at line 563 of file cadical_solver.cpp.

563 {
564 TRACE ("configure", name);
565 LOG_API_CALL_BEGIN ("configure", name);
568 "can only set configuration '%s' right after initialization",
569 name);
570 bool res = Config::set (internal->opts, name);
571 LOG_API_CALL_END ("configure", name, res);
572 return res;
573}
#define LOG_API_CALL_BEGIN(...)
char * name
Definition main.h:24
static bool set(Options &, const char *)
Here is the call graph for this function:

◆ connect_external_propagator()

void CaDiCaL::Solver::connect_external_propagator ( ExternalPropagator * propagator)

Definition at line 1004 of file cadical_solver.cpp.

1004 {
1005 LOG_API_CALL_BEGIN ("connect_external_propagator");
1007 REQUIRE (propagator, "can not connect zero propagator");
1008#ifdef LOGGING
1009 if (external->propagator)
1010 LOG ("connecting new external propagator (disconnecting previous one)");
1011 else
1012 LOG ("connecting new external propagator (no previous one)");
1013#endif
1014 if (external->propagator)
1016
1017 external->propagator = propagator;
1018 internal->connect_propagator ();
1019 internal->external_prop = true;
1020 internal->external_prop_is_lazy = propagator->is_lazy;
1021 LOG_API_CALL_END ("connect_external_propagator");
1022}
#define LOG(...)
void disconnect_external_propagator()
Here is the call graph for this function:

◆ connect_fixed_listener()

void CaDiCaL::Solver::connect_fixed_listener ( FixedAssignmentListener * fixed_listener)

Definition at line 965 of file cadical_solver.cpp.

966 {
967 LOG_API_CALL_BEGIN ("connect_fixed_listener");
969 REQUIRE (fixed_listener, "can not connect zero fixed listener");
970
971#ifdef LOGGING
972 if (external->fixed_listener)
973 LOG ("connecting new listener of fixed assignments (disconnecting "
974 "previous one)");
975 else
976 LOG ("connecting new listener of fixed assigments (no previous one)");
977#endif
978 if (external->fixed_listener)
980 external->fixed_listener = fixed_listener;
981 // Listeners are treated as real-time listeners, thus previously found
982 // fixed assignments are not sent out (would be rather expensive to
983 // recover it retrospect, see external_propagate.cpp/get_fixed_literals ()
984 // function).
985 LOG_API_CALL_END ("connect_fixed_listener");
986}
void disconnect_fixed_listener()
Here is the call graph for this function:

◆ connect_learner()

void CaDiCaL::Solver::connect_learner ( Learner * learner)

Definition at line 936 of file cadical_solver.cpp.

936 {
937 LOG_API_CALL_BEGIN ("connect_learner");
939 REQUIRE (learner, "can not connect zero learner");
940#ifdef LOGGING
941 if (external->learner)
942 LOG ("connecting new learner (disconnecting previous one)");
943 else
944 LOG ("connecting new learner (no previous one)");
945#endif
946 external->learner = learner;
947 LOG_API_CALL_END ("connect_learner");
948}
Here is the caller graph for this function:

◆ connect_proof_tracer() [1/4]

void CaDiCaL::Solver::connect_proof_tracer ( FileTracer * tracer,
bool antecedents,
bool finalize_clauses = false )

Definition at line 1207 of file cadical_solver.cpp.

1208 {
1209 LOG_API_CALL_BEGIN ("connect proof tracer with file");
1211 REQUIRE (state () == CONFIGURING,
1212 "can only start proof tracing right after initialization");
1213 REQUIRE (tracer, "can not connect zero tracer");
1214 internal->connect_proof_tracer (tracer, antecedents, finalize_clauses);
1215 LOG_API_CALL_END ("connect proof tracer with file");
1216}
Here is the call graph for this function:

◆ connect_proof_tracer() [2/4]

void CaDiCaL::Solver::connect_proof_tracer ( InternalTracer * tracer,
bool antecedents,
bool finalize_clauses = false )

Definition at line 1185 of file cadical_solver.cpp.

1186 {
1187 LOG_API_CALL_BEGIN ("connect proof tracer");
1189 REQUIRE (state () == CONFIGURING,
1190 "can only start proof tracing to right after initialization");
1191 REQUIRE (tracer, "can not connect zero tracer");
1192 internal->connect_proof_tracer (tracer, antecedents, finalize_clauses);
1193 LOG_API_CALL_END ("connect proof tracer");
1194}
Here is the call graph for this function:

◆ connect_proof_tracer() [3/4]

void CaDiCaL::Solver::connect_proof_tracer ( StatTracer * tracer,
bool antecedents,
bool finalize_clauses = false )

Definition at line 1196 of file cadical_solver.cpp.

1197 {
1198 LOG_API_CALL_BEGIN ("connect proof tracer with stats");
1200 REQUIRE (state () == CONFIGURING,
1201 "can only start proof tracing to right after initialization");
1202 REQUIRE (tracer, "can not connect zero tracer");
1203 internal->connect_proof_tracer (tracer, antecedents, finalize_clauses);
1204 LOG_API_CALL_END ("connect proof tracer with stats");
1205}
Here is the call graph for this function:

◆ connect_proof_tracer() [4/4]

void CaDiCaL::Solver::connect_proof_tracer ( Tracer * tracer,
bool antecedents,
bool finalize_clauses = false )

Definition at line 1174 of file cadical_solver.cpp.

1175 {
1176 LOG_API_CALL_BEGIN ("connect proof tracer");
1178 REQUIRE (state () == CONFIGURING,
1179 "can only start proof tracing to right after initialization");
1180 REQUIRE (tracer, "can not connect zero tracer");
1181 internal->connect_proof_tracer (tracer, antecedents, finalize_clauses);
1182 LOG_API_CALL_END ("connect proof tracer");
1183}
Here is the call graph for this function:

◆ connect_terminator()

void CaDiCaL::Solver::connect_terminator ( Terminator * terminator)

Definition at line 907 of file cadical_solver.cpp.

907 {
908 LOG_API_CALL_BEGIN ("connect_terminator");
910 REQUIRE (terminator, "can not connect zero terminator");
911#ifdef LOGGING
912 if (external->terminator)
913 LOG ("connecting new terminator (disconnecting previous one)");
914 else
915 LOG ("connecting new terminator (no previous one)");
916#endif
917 external->terminator = terminator;
918 LOG_API_CALL_END ("connect_terminator");
919}
Here is the caller graph for this function:

◆ constrain()

void CaDiCaL::Solver::constrain ( int lit)

Definition at line 649 of file cadical_solver.cpp.

649 {
650 TRACE ("constrain", lit);
652 if (lit)
654 transition_to_steady_state ();
655 external->constrain (lit);
656 adding_constraint = lit;
657 if (adding_constraint)
658 STATE (ADDING);
659 else if (!adding_clause)
660 STATE (STEADY);
661 LOG_API_CALL_END ("constrain", lit);
662}

◆ constraint_failed()

bool CaDiCaL::Solver::constraint_failed ( )

Definition at line 862 of file cadical_solver.cpp.

862 {
863 TRACE ("constraint_failed");
866 "can only determine if constraint failed in unsatisfied state");
867 bool res = external->failed_constraint ();
868 LOG_API_CALL_RETURNS ("constraint_failed", res);
870 return res;
871}
Here is the call graph for this function:

◆ copy()

void CaDiCaL::Solver::copy ( Solver & other) const

Definition at line 1691 of file cadical_solver.cpp.

1691 {
1693 REQUIRE (other.state () & CONFIGURING, "target solver already modified");
1694 internal->opts.copy (other.internal->opts);
1695 ClauseCopier clause_copier (other);
1696 traverse_clauses (clause_copier);
1697 WitnessCopier witness_copier (other.external);
1698 traverse_witnesses_forward (witness_copier);
1699 external->copy_flags (*other.external);
1700}
bool traverse_clauses(ClauseIterator &) const
bool traverse_witnesses_forward(WitnessIterator &) const
#define REQUIRE_READY_STATE()
Definition contract.hpp:123
Here is the call graph for this function:

◆ disconnect_external_propagator()

void CaDiCaL::Solver::disconnect_external_propagator ( )

Definition at line 1024 of file cadical_solver.cpp.

1024 {
1025 LOG_API_CALL_BEGIN ("disconnect_external_propagator");
1027
1028#ifdef LOGGING
1029 if (external->propagator)
1030 LOG ("disconnecting previous external propagator");
1031 else
1032 LOG ("ignoring to disconnect external propagator (no previous one)");
1033#endif
1034 if (external->propagator)
1035 external->reset_observed_vars ();
1036
1037 external->propagator = 0;
1038 internal->set_tainted_literal ();
1039 internal->external_prop = false;
1040 internal->external_prop_is_lazy = true;
1041 LOG_API_CALL_END ("disconnect_external_propagator");
1042}
Here is the caller graph for this function:

◆ disconnect_fixed_listener()

void CaDiCaL::Solver::disconnect_fixed_listener ( )

Definition at line 988 of file cadical_solver.cpp.

988 {
989 LOG_API_CALL_BEGIN ("disconnect_fixed_listener");
991#ifdef LOGGING
992 if (external->fixed_listener)
993 LOG ("disconnecting previous listener of fixed assignments");
994 else
995 LOG ("ignoring to disconnect listener of fixed assignments (no "
996 "previous one)");
997#endif
998 external->fixed_listener = 0;
999 LOG_API_CALL_END ("disconnect_fixed_listener");
1000}
Here is the caller graph for this function:

◆ disconnect_learner()

void CaDiCaL::Solver::disconnect_learner ( )

Definition at line 950 of file cadical_solver.cpp.

950 {
951 LOG_API_CALL_BEGIN ("disconnect_learner");
953#ifdef LOGGING
954 if (external->learner)
955 LOG ("disconnecting previous learner");
956 else
957 LOG ("ignoring to disconnect learner (no previous one)");
958#endif
959 external->learner = 0;
960 LOG_API_CALL_END ("disconnect_learner");
961}
Here is the caller graph for this function:

◆ disconnect_proof_tracer() [1/3]

bool CaDiCaL::Solver::disconnect_proof_tracer ( FileTracer * tracer)

Definition at line 1236 of file cadical_solver.cpp.

1236 {
1237 LOG_API_CALL_BEGIN ("disconnect proof tracer");
1239 REQUIRE (tracer, "can not disconnect zero tracer");
1240 bool res = internal->disconnect_proof_tracer (tracer);
1241 LOG_API_CALL_RETURNS ("disconnect proof tracer", res);
1242 return res;
1243}

◆ disconnect_proof_tracer() [2/3]

bool CaDiCaL::Solver::disconnect_proof_tracer ( StatTracer * tracer)

Definition at line 1227 of file cadical_solver.cpp.

1227 {
1228 LOG_API_CALL_BEGIN ("disconnect proof tracer");
1230 REQUIRE (tracer, "can not disconnect zero tracer");
1231 bool res = internal->disconnect_proof_tracer (tracer);
1232 LOG_API_CALL_RETURNS ("disconnect proof tracer", res);
1233 return res;
1234}

◆ disconnect_proof_tracer() [3/3]

bool CaDiCaL::Solver::disconnect_proof_tracer ( Tracer * tracer)

Definition at line 1218 of file cadical_solver.cpp.

1218 {
1219 LOG_API_CALL_BEGIN ("disconnect proof tracer");
1221 REQUIRE (tracer, "can not disconnect zero tracer");
1222 bool res = internal->disconnect_proof_tracer (tracer);
1223 LOG_API_CALL_RETURNS ("connect proof tracer", res);
1224 return res;
1225}

◆ disconnect_terminator()

void CaDiCaL::Solver::disconnect_terminator ( )

Definition at line 921 of file cadical_solver.cpp.

921 {
922 LOG_API_CALL_BEGIN ("disconnect_terminator");
924#ifdef LOGGING
925 if (external->terminator)
926 LOG ("disconnecting previous terminator");
927 else
928 LOG ("ignoring to disconnect terminator (no previous one)");
929#endif
930 external->terminator = 0;
931 LOG_API_CALL_END ("disconnect_terminator");
932}
Here is the caller graph for this function:

◆ failed()

bool CaDiCaL::Solver::failed ( int lit)

Definition at line 850 of file cadical_solver.cpp.

850 {
851 TRACE ("failed", lit);
855 "can only get failed assumptions in unsatisfied state");
856 bool res = external->failed (lit);
857 LOG_API_CALL_RETURNS ("failed", lit, res);
859 return res;
860}
Here is the call graph for this function:

◆ fixed()

int CaDiCaL::Solver::fixed ( int lit) const

Definition at line 873 of file cadical_solver.cpp.

873 {
874 TRACE ("fixed", lit);
877 int res = external->fixed (lit);
878 LOG_API_CALL_RETURNS ("fixed", lit, res);
879 return res;
880}

◆ flip()

bool CaDiCaL::Solver::flip ( int lit)

Definition at line 824 of file cadical_solver.cpp.

824 {
825 TRACE ("flip", lit);
828 REQUIRE (state () == SATISFIED, "can only flip value in satisfied state");
829 REQUIRE (!external->propagator,
830 "can only flip when no external propagator is present");
831 bool res = external->flip (lit);
832 LOG_API_CALL_RETURNS ("flip", lit, res);
834 return res;
835}
Here is the call graph for this function:

◆ flippable()

bool CaDiCaL::Solver::flippable ( int lit)

Definition at line 837 of file cadical_solver.cpp.

837 {
838 TRACE ("flippable", lit);
841 REQUIRE (state () == SATISFIED, "can only flip value in satisfied state");
842 REQUIRE (!external->propagator,
843 "can only flip when no external propagator is present");
844 bool res = external->flippable (lit);
845 LOG_API_CALL_RETURNS ("flippable", lit, res);
847 return res;
848}
Here is the call graph for this function:

◆ flush_proof_trace()

void CaDiCaL::Solver::flush_proof_trace ( bool print = false)

Definition at line 1152 of file cadical_solver.cpp.

1152 {
1153 TRACE ("flush_proof_trace");
1155 REQUIRE (!internal->file_tracers.empty (), "proof is not traced");
1156 REQUIRE (!internal->file_tracers.back ()->closed (),
1157 "proof trace already closed");
1158 internal->flush_trace (print_statistics_unless_quiet);
1159 LOG_API_CALL_END ("flush_proof_trace");
1160}
Here is the caller graph for this function:

◆ force_backtrack()

void CaDiCaL::Solver::force_backtrack ( size_t new_level)

Definition at line 1494 of file cadical_solver.cpp.

1494 {
1495 TRACE ("force_backtrack", new_level);
1497 external->force_backtrack (new_level);
1498}

◆ freeze()

void CaDiCaL::Solver::freeze ( int lit)

Definition at line 1095 of file cadical_solver.cpp.

1095 {
1096 TRACE ("freeze", lit);
1099 external->freeze (lit);
1100 LOG_API_CALL_END ("freeze", lit);
1101}

◆ frozen()

bool CaDiCaL::Solver::frozen ( int lit) const

Definition at line 1113 of file cadical_solver.cpp.

1113 {
1114 TRACE ("frozen", lit);
1117 bool res = external->frozen (lit);
1118 LOG_API_CALL_RETURNS ("frozen", lit, res);
1119 return res;
1120}

◆ generate_cubes()

Solver::CubesWithStatus CaDiCaL::Solver::generate_cubes ( int depth,
int min_depth = 0 )

Definition at line 681 of file cadical_solver.cpp.

681 {
682 TRACE ("lookahead_cubes");
684 auto cubes = external->generate_cubes (depth, min_depth);
685 TRACE ("lookahead_cubes");
686
687 CubesWithStatus cubes2;
688 cubes2.status = cubes.status;
689 cubes2.cubes = cubes.cubes;
690 return cubes2;
691}

◆ get()

int CaDiCaL::Solver::get ( const char * name)

Definition at line 493 of file cadical_solver.cpp.

493 {
495 return internal->opts.get (arg);
496}

◆ implied()

void CaDiCaL::Solver::implied ( std::vector< int > & implicants)

Definition at line 730 of file cadical_solver.cpp.

730 {
731 TRACE ("implied");
734 "can only get implied literals only in unknown state");
735 external->conclude_unknown ();
736 external->implied (entrailed);
737 if (tracing_nb_lidrup_env_var_method)
738 flush_proof_trace (true);
739 LOG_API_CALL_RETURNS ("implied", (int) entrailed.size ());
740}
void flush_proof_trace(bool print=false)
Here is the call graph for this function:

◆ inconsistent()

bool CaDiCaL::Solver::inconsistent ( )

Definition at line 647 of file cadical_solver.cpp.

647{ return internal->unsat; }

◆ irredundant()

int64_t CaDiCaL::Solver::irredundant ( ) const

Definition at line 1085 of file cadical_solver.cpp.

1085 {
1086 TRACE ("irredundant");
1088 int64_t res = internal->irredundant ();
1089 LOG_API_CALL_RETURNS ("irredundant", res);
1090 return res;
1091}

◆ is_decision()

bool CaDiCaL::Solver::is_decision ( int lit)

Definition at line 1485 of file cadical_solver.cpp.

1485 {
1486 TRACE ("is_decision", lit);
1489 bool res = external->is_decision (lit);
1490 LOG_API_CALL_RETURNS ("is_decision", lit, res);
1491 return res;
1492}

◆ is_preprocessing_option()

bool CaDiCaL::Solver::is_preprocessing_option ( const char * name)
static

Definition at line 483 of file cadical_solver.cpp.

483 {
485}
static bool is_preprocessing_option(const char *name)
Here is the call graph for this function:

◆ is_valid_configuration()

bool CaDiCaL::Solver::is_valid_configuration ( const char * name)
static

Definition at line 559 of file cadical_solver.cpp.

559 {
560 return Config::has (name);
561}
static bool has(const char *)
Here is the call graph for this function:

◆ is_valid_limit()

bool CaDiCaL::Solver::is_valid_limit ( const char * arg)

Definition at line 548 of file cadical_solver.cpp.

548 {
549 return Internal::is_valid_limit (arg);
550}
static bool is_valid_limit(const char *name)
Here is the call graph for this function:

◆ is_valid_long_option()

bool CaDiCaL::Solver::is_valid_long_option ( const char * arg)
static

Definition at line 487 of file cadical_solver.cpp.

487 {
488 string name;
489 int tmp;
490 return Options::parse_long_option (arg, name, tmp);
491}
static bool parse_long_option(const char *, string &, int &)
Here is the call graph for this function:

◆ is_valid_option()

bool CaDiCaL::Solver::is_valid_option ( const char * name)
static

Definition at line 479 of file cadical_solver.cpp.

479 {
480 return Options::has (name);
481}
static Option * has(const char *name)
Here is the call graph for this function:

◆ limit()

bool CaDiCaL::Solver::limit ( const char * arg,
int val )

Definition at line 540 of file cadical_solver.cpp.

540 {
541 TRACE ("limit", arg, val);
543 bool res = internal->limit (arg, val);
544 LOG_API_CALL_END ("limit", arg, val, res);
545 return res;
546}
Here is the call graph for this function:

◆ lookahead()

int CaDiCaL::Solver::lookahead ( void )

Definition at line 673 of file cadical_solver.cpp.

673 {
674 TRACE ("lookahead");
676 int lit = external->lookahead ();
677 TRACE ("lookahead");
678 return lit;
679}

◆ melt()

void CaDiCaL::Solver::melt ( int lit)

Definition at line 1103 of file cadical_solver.cpp.

1103 {
1104 TRACE ("melt", lit);
1107 REQUIRE (external->frozen (lit),
1108 "can not melt completely melted literal '%d'", lit);
1109 external->melt (lit);
1110 LOG_API_CALL_END ("melt", lit);
1111}

◆ optimize()

void CaDiCaL::Solver::optimize ( int val)

Definition at line 533 of file cadical_solver.cpp.

533 {
534 LOG_API_CALL_BEGIN ("optimize", arg);
536 internal->opts.optimize (arg);
537 LOG_API_CALL_END ("optimize", arg);
538}

◆ options()

void CaDiCaL::Solver::options ( )

Definition at line 1335 of file cadical_solver.cpp.

1335 {
1337 internal->opts.print ();
1338}

◆ phase()

void CaDiCaL::Solver::phase ( int lit)

Definition at line 882 of file cadical_solver.cpp.

882 {
883 TRACE ("phase", lit);
886 external->phase (lit);
887 LOG_API_CALL_END ("phase", lit);
888}

◆ prefix()

void CaDiCaL::Solver::prefix ( const char * verbose_message_prefix)

Definition at line 552 of file cadical_solver.cpp.

552 {
553 LOG_API_CALL_BEGIN ("prefix", str);
555 internal->prefix = str;
556 LOG_API_CALL_END ("prefix", str);
557}
Here is the caller graph for this function:

◆ propagate()

int CaDiCaL::Solver::propagate ( )

Definition at line 713 of file cadical_solver.cpp.

713 {
714 TRACE ("propagate_assumptions");
716 transition_to_steady_state ();
717 const int res = external->propagate_assumptions ();
718 if (tracing_nb_lidrup_env_var_method)
719 flush_proof_trace (true);
720 LOG_API_CALL_RETURNS ("propagate_assumptions", res);
721 if (res == 10)
723 else if (res == 20)
725 else
727 return res;
728}
Here is the call graph for this function:

◆ read_dimacs() [1/4]

const char * CaDiCaL::Solver::read_dimacs ( const char * path,
int & vars,
int strict,
bool & incremental,
std::vector< int > & cubes )
Here is the call graph for this function:

◆ read_dimacs() [2/4]

const char * CaDiCaL::Solver::read_dimacs ( const char * path,
int & vars,
int strict = 1 )

Definition at line 1389 of file cadical_solver.cpp.

1389 {
1390 LOG_API_CALL_BEGIN ("read_dimacs", path);
1392 REQUIRE (state () == CONFIGURING,
1393 "can only read DIMACS file right after initialization");
1394 File *file = File::read (internal, path);
1395 if (!file)
1396 return internal->error_message.init ("failed to read DIMACS file '%s'",
1397 path);
1398 const char *err = read_dimacs (file, vars, strict);
1399 delete file;
1400 LOG_API_CALL_RETURNS ("read_dimacs", path, err);
1401 return err;
1402}
static File * read(Internal *, FILE *f, const char *name)
const char * read_dimacs(FILE *file, const char *name, int &vars, int strict=1)
Here is the call graph for this function:

◆ read_dimacs() [3/4]

const char * CaDiCaL::Solver::read_dimacs ( FILE * file,
const char * name,
int & vars,
int strict,
bool & incremental,
std::vector< int > & cubes )
Here is the call graph for this function:

◆ read_dimacs() [4/4]

const char * CaDiCaL::Solver::read_dimacs ( FILE * file,
const char * name,
int & vars,
int strict = 1 )

Definition at line 1375 of file cadical_solver.cpp.

1376 {
1377 LOG_API_CALL_BEGIN ("read_dimacs", name);
1379 REQUIRE (state () == CONFIGURING,
1380 "can only read DIMACS file right after initialization");
1381 File *file = File::read (internal, external_file, name);
1383 const char *err = read_dimacs (file, vars, strict);
1384 delete file;
1385 LOG_API_CALL_RETURNS ("read_dimacs", name, err);
1386 return err;
1387}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ redundant()

int64_t CaDiCaL::Solver::redundant ( ) const

Definition at line 1077 of file cadical_solver.cpp.

1077 {
1078 TRACE ("redundant");
1080 int64_t res = internal->redundant ();
1081 LOG_API_CALL_RETURNS ("redundant", res);
1082 return res;
1083}

◆ remove_observed_var()

void CaDiCaL::Solver::remove_observed_var ( int var)

Definition at line 1052 of file cadical_solver.cpp.

1052 {
1053 TRACE ("unobserve", idx);
1055 REQUIRE_VALID_LIT (idx);
1056 external->remove_observed_var (idx);
1057 LOG_API_CALL_END ("unobserve", idx);
1058}

◆ reserve()

void CaDiCaL::Solver::reserve ( int min_max_var)

Definition at line 440 of file cadical_solver.cpp.

440 {
441 TRACE ("reserve", min_max_var);
443 transition_to_steady_state ();
444 external->reset_extended ();
445 external->init (min_max_var);
446 LOG_API_CALL_END ("reserve", min_max_var);
447}

◆ reserve_difference()

int CaDiCaL::Solver::reserve_difference ( int number_of_vars)

Definition at line 449 of file cadical_solver.cpp.

449 {
450 TRACE ("reserve_difference", number_of_vars);
452 transition_to_steady_state ();
453 external->reset_extended ();
454 int new_max_var = external->max_var + number_of_vars;
455 external->init (new_max_var);
456 LOG_API_CALL_END ("reserve_difference", number_of_vars);
457 return new_max_var;
458}

◆ reset_assumptions()

void CaDiCaL::Solver::reset_assumptions ( )

Definition at line 693 of file cadical_solver.cpp.

693 {
694 TRACE ("reset_assumptions");
696 transition_to_steady_state ();
697 external->reset_assumptions ();
698 external->reset_concluded ();
699 LOG_API_CALL_END ("reset_assumptions");
700}

◆ reset_constraint()

void CaDiCaL::Solver::reset_constraint ( )

Definition at line 702 of file cadical_solver.cpp.

702 {
703 TRACE ("reset_constraint");
705 transition_to_steady_state ();
706 external->reset_constraint ();
707 external->reset_concluded ();
708 LOG_API_CALL_END ("reset_constraint");
709}

◆ reset_observed_vars()

void CaDiCaL::Solver::reset_observed_vars ( )

Definition at line 1060 of file cadical_solver.cpp.

1060 {
1061 TRACE ("reset_observed_vars");
1063 external->reset_observed_vars ();
1064 LOG_API_CALL_END ("reset_observed_vars");
1065}

◆ resources()

void CaDiCaL::Solver::resources ( )

Definition at line 1353 of file cadical_solver.cpp.

1353 {
1354 if (state () == DELETING)
1355 return;
1356 TRACE ("resources");
1358 internal->print_resource_usage ();
1359 LOG_API_CALL_END ("resources");
1360}
Here is the call graph for this function:

◆ set()

bool CaDiCaL::Solver::set ( const char * name,
int val )

Definition at line 498 of file cadical_solver.cpp.

498 {
499 TRACE ("set", arg, val);
501 if (strcmp (arg, "log") && strcmp (arg, "quiet") &&
502 strcmp (arg, "report") && strcmp (arg, "verbose")) {
503 REQUIRE (
504 state () == CONFIGURING,
505 "can only set option 'set (\"%s\", %d)' right after initialization",
506 arg, val);
507 }
508 bool res = internal->opts.set (arg, val);
509 LOG_API_CALL_END ("set", arg, val, res);
510
511 return res;
512}
int strcmp()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_long_option()

bool CaDiCaL::Solver::set_long_option ( const char * arg)

Definition at line 514 of file cadical_solver.cpp.

514 {
515 LOG_API_CALL_BEGIN ("set", arg);
518 "can only set option '%s' right after initialization", arg);
519 bool res;
520 if (arg[0] != '-' || arg[1] != '-')
521 res = false;
522 else {
523 int val;
524 string name;
525 res = Options::parse_long_option (arg, name, val);
526 if (res)
527 set (name.c_str (), val);
528 }
529 LOG_API_CALL_END ("set", arg, res);
530 return res;
531}
Here is the call graph for this function:

◆ signature()

const char * CaDiCaL::Solver::signature ( )
static

Definition at line 1333 of file cadical_solver.cpp.

1333{ return CaDiCaL::signature (); }
const char * signature()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ simplify()

int CaDiCaL::Solver::simplify ( int rounds = 3)

Definition at line 796 of file cadical_solver.cpp.

796 {
797 TRACE ("simplify", rounds);
799 REQUIRE (rounds >= 0, "negative number of simplification rounds '%d'",
800 rounds);
801 internal->limit ("preprocessing", rounds);
802 const int res = call_external_solve_and_check_results (true);
803 LOG_API_CALL_RETURNS ("simplify", rounds, res);
804 return res;
805}

◆ solve()

int CaDiCaL::Solver::solve ( )

Definition at line 786 of file cadical_solver.cpp.

786 {
787 TRACE ("solve");
789 const int res = call_external_solve_and_check_results (false);
790 LOG_API_CALL_RETURNS ("solve", res);
791 if (tracing_nb_lidrup_env_var_method)
792 flush_proof_trace (true);
793 return res;
794}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ state()

const State & CaDiCaL::Solver::state ( ) const
inline

Definition at line 529 of file cadical.hpp.

529{ return _state; }
Here is the caller graph for this function:

◆ statistics()

void CaDiCaL::Solver::statistics ( )

Definition at line 1344 of file cadical_solver.cpp.

1344 {
1345 if (state () == DELETING)
1346 return;
1347 TRACE ("stats");
1349 internal->print_statistics ();
1350 LOG_API_CALL_END ("stats");
1351}
Here is the call graph for this function:

◆ status()

int CaDiCaL::Solver::status ( ) const
inline

Definition at line 534 of file cadical.hpp.

534 {
535 if (_state == SATISFIED)
536 return 10;
537 else if (_state == UNSATISFIED)
538 return 20;
539 else
540 return 0;
541 }

◆ terminate()

void CaDiCaL::Solver::terminate ( )

Definition at line 900 of file cadical_solver.cpp.

900 {
901 LOG_API_CALL_BEGIN ("terminate");
903 external->terminate ();
904 LOG_API_CALL_END ("terminate");
905}

◆ trace_proof() [1/2]

bool CaDiCaL::Solver::trace_proof ( const char * path)

Definition at line 1138 of file cadical_solver.cpp.

1138 {
1139 TRACE ("trace_proof", path);
1141 REQUIRE (
1142 state () == CONFIGURING,
1143 "can only start proof tracing to '%s' right after initialization",
1144 path);
1145 File *internal_file = File::write (internal, path);
1146 bool res = (internal_file != 0);
1147 internal->trace (internal_file);
1148 LOG_API_CALL_RETURNS ("trace_proof", path, res);
1149 return res;
1150}
static File * write(Internal *, FILE *, const char *name)
Here is the call graph for this function:

◆ trace_proof() [2/2]

bool CaDiCaL::Solver::trace_proof ( FILE * file,
const char * name )

Definition at line 1124 of file cadical_solver.cpp.

1124 {
1125 TRACE ("trace_proof", name);
1127 REQUIRE (
1128 state () == CONFIGURING,
1129 "can only start proof tracing to '%s' right after initialization",
1130 name);
1131 File *internal_file = File::write (internal, external_file, name);
1132 CADICAL_assert (internal_file);
1133 internal->trace (internal_file);
1134 LOG_API_CALL_RETURNS ("trace_proof", name, true);
1135 return true;
1136}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ traverse_clauses()

bool CaDiCaL::Solver::traverse_clauses ( ClauseIterator & it) const

Definition at line 1502 of file cadical_solver.cpp.

1502 {
1503 LOG_API_CALL_BEGIN ("traverse_clauses");
1505 bool res = external->traverse_all_frozen_units_as_clauses (it) &&
1506 internal->traverse_clauses (it) &&
1507 internal->traverse_constraint (it);
1508 LOG_API_CALL_RETURNS ("traverse_clauses", res);
1509 return res;
1510}
Here is the caller graph for this function:

◆ traverse_witnesses_backward()

bool CaDiCaL::Solver::traverse_witnesses_backward ( WitnessIterator & it) const

Definition at line 1512 of file cadical_solver.cpp.

1512 {
1513 LOG_API_CALL_BEGIN ("traverse_witnesses_backward");
1515 bool res = external->traverse_all_non_frozen_units_as_witnesses (it) &&
1516 external->traverse_witnesses_backward (it);
1517 LOG_API_CALL_RETURNS ("traverse_witnesses_backward", res);
1518 return res;
1519}
Here is the caller graph for this function:

◆ traverse_witnesses_forward()

bool CaDiCaL::Solver::traverse_witnesses_forward ( WitnessIterator & it) const

Definition at line 1521 of file cadical_solver.cpp.

1521 {
1522 LOG_API_CALL_BEGIN ("traverse_witnesses_forward");
1524 bool res = external->traverse_witnesses_forward (it) &&
1525 external->traverse_all_non_frozen_units_as_witnesses (it);
1526 LOG_API_CALL_RETURNS ("traverse_witnesses_forward", res);
1527 return res;
1528}
Here is the caller graph for this function:

◆ unphase()

void CaDiCaL::Solver::unphase ( int lit)

Definition at line 890 of file cadical_solver.cpp.

890 {
891 TRACE ("unphase", lit);
894 external->unphase (lit);
895 LOG_API_CALL_END ("unphase", lit);
896}

◆ usage()

void CaDiCaL::Solver::usage ( )
static

Definition at line 1340 of file cadical_solver.cpp.

1340{ Options::usage (); }
Here is the call graph for this function:

◆ val()

int CaDiCaL::Solver::val ( int lit)

Definition at line 809 of file cadical_solver.cpp.

809 {
810 TRACE ("val", lit);
813 REQUIRE (state () == SATISFIED, "can only get value in satisfied state");
814 if (!external->extended)
815 external->extend ();
816 external->conclude_sat ();
817 int res = external->ival (lit);
818 LOG_API_CALL_RETURNS ("val", lit, res);
820 CADICAL_assert (res == lit || res == -lit);
821 return res;
822}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vars()

int CaDiCaL::Solver::vars ( )

Definition at line 432 of file cadical_solver.cpp.

432 {
433 TRACE ("vars");
435 int res = external->max_var;
436 LOG_API_CALL_RETURNS ("vars", res);
437 return res;
438}
Here is the caller graph for this function:

◆ version()

const char * CaDiCaL::Solver::version ( )
static

Definition at line 1331 of file cadical_solver.cpp.

1331{ return CaDiCaL::version (); }
Here is the call graph for this function:

◆ write_dimacs()

const char * CaDiCaL::Solver::write_dimacs ( const char * path,
int min_max_var = 0 )

Definition at line 1565 of file cadical_solver.cpp.

1565 {
1566 LOG_API_CALL_BEGIN ("write_dimacs", path, min_max_var);
1568#ifndef CADICAL_QUIET
1569 const double start = internal->time ();
1570#endif
1571 internal->restore_clauses ();
1572 ClauseCounter counter;
1573 (void) traverse_clauses (counter);
1574 LOG ("found maximal variable %d and %" PRId64 " clauses", counter.vars,
1575 counter.clauses);
1576 File *file = File::write (internal, path);
1577 const char *res = 0;
1578 if (file) {
1579 int actual_max_vars = max (min_max_var, counter.vars);
1580 MSG ("writing %s'p cnf %d %" PRId64 "'%s header", tout.green_code (),
1581 actual_max_vars, counter.clauses, tout.normal_code ());
1582 file->put ("p cnf ");
1583 file->put (actual_max_vars);
1584 file->put (' ');
1585 file->put (counter.clauses);
1586 file->put ('\n');
1587 ClauseWriter writer (file);
1588 if (!traverse_clauses (writer))
1589 res = internal->error_message.init (
1590 "writing to DIMACS file '%s' failed", path);
1591 delete file;
1592 } else
1593 res = internal->error_message.init (
1594 "failed to open DIMACS file '%s' for writing", path);
1595#ifndef CADICAL_QUIET
1596 if (!res) {
1597 const double end = internal->time ();
1598 MSG ("wrote %" PRId64 " clauses in %.2f seconds %s time",
1599 counter.clauses, end - start,
1600 internal->opts.realtime ? "real" : "process");
1601 }
1602#endif
1603 LOG_API_CALL_RETURNS ("write_dimacs", path, min_max_var, res);
1604 return res;
1605}
const char * green_code()
Definition terminal.hpp:76
#define MSG(...)
Definition message.hpp:49
struct counter counter
Definition walk.c:18
Here is the call graph for this function:

◆ write_extension()

const char * CaDiCaL::Solver::write_extension ( const char * path)

Definition at line 1636 of file cadical_solver.cpp.

1636 {
1637 LOG_API_CALL_BEGIN ("write_extension", path);
1639 const char *res = 0;
1640#ifndef CADICAL_QUIET
1641 const double start = internal->time ();
1642#endif
1643 File *file = File::write (internal, path);
1644 WitnessWriter writer (file);
1645 if (file) {
1646 if (!traverse_witnesses_backward (writer))
1647 res = internal->error_message.init (
1648 "writing to DIMACS file '%s' failed", path);
1649 delete file;
1650 } else
1651 res = internal->error_message.init (
1652 "failed to open extension file '%s' for writing", path);
1653#ifndef CADICAL_QUIET
1654 if (!res) {
1655 const double end = internal->time ();
1656 MSG ("wrote %" PRId64 " witnesses in %.2f seconds %s time",
1657 writer.witnesses, end - start,
1658 internal->opts.realtime ? "real" : "process");
1659 }
1660#endif
1661 LOG_API_CALL_RETURNS ("write_extension", path, res);
1662 return res;
1663}
bool traverse_witnesses_backward(WitnessIterator &) const
Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ App

friend class App
friend

Definition at line 1068 of file cadical.hpp.

◆ DisconnectCall

friend struct DisconnectCall
friend

Definition at line 1163 of file cadical.hpp.

◆ DumpCall

friend struct DumpCall
friend

Definition at line 1150 of file cadical.hpp.

◆ LemmaCall

friend struct LemmaCall
friend

Definition at line 1161 of file cadical.hpp.

◆ Mobical

friend class Mobical
friend

Definition at line 1069 of file cadical.hpp.

◆ MockPropagator

friend class MockPropagator
friend

Definition at line 1164 of file cadical.hpp.

◆ ObserveCall

friend struct ObserveCall
friend

Definition at line 1162 of file cadical.hpp.

◆ Parser

friend class Parser
friend

Definition at line 1070 of file cadical.hpp.

◆ Testing

friend class Testing
friend

Definition at line 1034 of file cadical.hpp.


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