ben_jose API declaration. More...
Go to the source code of this file.
Macros | |
#define | RES_UNKNOWN_STR "unknown" |
String to print a bjr_unknown_satisf result. | |
#define | bj_solver_is_null(bjs) (bjs == NULL) |
Checks if a ben-jose solver object is NULL. | |
Typedefs | |
typedef void * | bj_solver_t |
A ben-jose solver object is of this tyoe. | |
Enumerations |
ben_jose API declaration.
DO NOT free any pointer returned by these functions. They are pointers to the internal structure of a solver. A solver is an opaque structure to the user represented by objects of type obj_solver_t.
void bj_init_output | ( | bj_output_t * | the_out | ) |
Init a bj_output_t structure
the_out | A pointer to the structure to be initialized |
bj_solver_t bj_solver_create | ( | const char * | bjs_dir_path | ) |
Create a solver object to solve one or more CNFs
bjs_dir_path | A C string that represents the path of the database of CNFs. |
void bj_solver_release | ( | bj_solver_t | bjs | ) |
Release a solver object created with bj_solver_create
bjs | The solver object to be released. |
void bj_set_param_char | ( | bj_solver_t | bjs, |
bj_param_t | prm, | ||
char | val | ||
) |
Set an input parameter in the solver
bjs | The solver object to be used. |
prm | The parameter. |
val | The value. For boolen values it is 0 (false) or not 0 (true) |
char bj_get_param_char | ( | bj_solver_t | bjs, |
bj_param_t | prm | ||
) |
Get the value of a previusly set (with bj_set_param_char) input parameter.
bjs | The solver object to be used. |
prm | The parameter. |
const char* bj_get_database_path | ( | bj_solver_t | bjs | ) |
Get the value of a previusly set database path (with bj_solver_create).
bjs | The solver object to be used. |
bj_satisf_val_t bj_solve_file | ( | bj_solver_t | bjs, |
const char * | f_path | ||
) |
Solve a CNF given the DIMACS formated file path of the CNF.
bjs | The solver object to be used. |
f_path | The CNF file path. It must be in DIMACS format. |
bj_satisf_val_t bj_solve_data | ( | bj_solver_t | bjs, |
long | dat_sz, | ||
const char * | dat | ||
) |
Solve a CNF given a DIMACS formated C ASCII characters array.
bjs | The solver object to be used. |
dat_sz | The number of ASCII characters in dat. |
dat | The DIMACS formated C ASCII characters array. It can be the exact contents read of a valid DIMACS file. |
bj_satisf_val_t bj_solve_literals | ( | bj_solver_t | bjs, |
long | num_vars, | ||
long | num_cls, | ||
long | lits_sz, | ||
long * | lits | ||
) |
Solve a CNF given the DIMACS values of a CNF.
bjs | The solver object to be used. |
num_vars | The number of variables in used in lits. It is the value as read in a cnf declaration of a DIMACS file. |
num_cls | The number of clauses found in lits. It is the value as read in a cnf declaration of a DIMACS file. |
lits_sz | The size of the lits parameter. |
lits | THe array containing a set of clauses separated by zeros. Ej: [1 2 0 3 4 5 0] representes two clauses: [1 2] and [3 4 5]. |
bj_satisf_val_t bj_get_result | ( | bj_solver_t | bjs | ) |
Get the result of a solving process. A bj_solve_ function must have been previusly called.
bjs | The solver object to be used. |
bj_output_t bj_get_output | ( | bj_solver_t | bjs | ) |
Get all the output a solving process. A bj_solve_ function must have been previusly called.
bjs | The solver object to be used. |
const char* bj_get_solve_file_path | ( | bj_solver_t | bjs | ) |
Returns the value passed to bj_solve_file. A bj_solve_ function must have been previusly called.
bjs | The solver object to be used. |
const long* bj_get_assig | ( | bj_solver_t | bjs | ) |
Get the assignation to variables that satisfies the CNF. A bj_solve_ function must have been previusly called.
bjs | The solver object to be used. |
'assig' always ends with a 0.
No memory after that 0 should be accessed.
Let vv = assig[ii]. Then:
Example: [-20 4 -12 6 9 0]
Means:
And that assignation satisfies the whole CNF (it might have more than 20 variables).
const char* bj_get_last_proof_path | ( | bj_solver_t | bjs | ) |
Returns the last written proof path. A bj_solve_ function must have been previusly called.
bjs | The solver object to be used. |
NULL is returned if the parameter bjp_write_proofs was not used before calling a bj_solve_ function.
const char* bj_get_error_stack_str | ( | bj_solver_t | bjs | ) |
Get the stack when the error ocurred. A bj_solve_ function must have been previusly called.
bjs | The solver object to be used. |
Funtion for debugging purposes. Only returns a valid value if an error has ocurred during solving.
const char* bj_get_error_assert_str | ( | bj_solver_t | bjs | ) |
Get the assert that failed. A bj_solve_ function must have been previusly called.
bjs | The solver object to be used. |
Funtion for debugging purposes. Only returns a valid value if an assert has failed.
const char* bj_get_result_titles_string | ( | bj_solver_t | bjs | ) |
Get a string with the titles of a result string fields.
bjs | The solver object to be used. |
Funtion for testing purposes.
const char* bj_get_result_string | ( | bj_solver_t | bjs | ) |
Get a string with the result string. A bj_solve_ function must have been previusly called.
bjs | The solver object to be used. |
Funtion for testing purposes. It contains a concatenation of the string representation of some fields obtained otherwise with the bj_get_output funtion.
void bj_parse_result_string | ( | bj_solver_t | bjs, |
const char * | rslt_str | ||
) |
Sets internal values in the solver with a result string previusly returned by bj_get_result_string.
bjs | The solver object to be used. |
rslt_str | A string with the result string. |
Funtion for testing purposes. It sets internal values in the solver so that a call to bj_get_output will return the parsed values.
void bj_restart | ( | bj_solver_t | bjs | ) |
Resets all internal values in the solver.
bjs | The solver object to be used. |
void bj_print_paths | ( | bj_solver_t | bjs | ) |
Prints all paths used by the solver.
bjs | The solver object to be used. |
const char* bj_error_str | ( | bj_error_t | bje | ) |
Gets a string representing the error. A bj_solve_ function must have been previusly called.
bjs | The solver object to be used. |