#include <stdio.h>#include <stdlib.h>#include <string.h>#include <assert.h>#include <math.h>#include "misc/util/abc_global.h"#include "msat.h"

Go to the source code of this file.
Classes | |
| struct | Msat_SolverStats_t_ |
| struct | Msat_SearchParams_t_ |
| struct | Msat_Solver_t_ |
| struct | Msat_ClauseVec_t_ |
| struct | Msat_IntVec_t_ |
Macros | |
| #define | MSAT_VAR_UNASSIGNED (-1) |
| #define | MSAT_LIT_UNASSIGNED (-2) |
| #define | MSAT_ORDER_UNKNOWN (-3) |
| #define | L_IND "%-*d" |
| #define | L_ind Msat_SolverReadDecisionLevel(p)*3+3,Msat_SolverReadDecisionLevel(p) |
| #define | L_LIT "%s%d" |
| #define | L_lit(Lit) |
Typedefs | |
| typedef typedefABC_NAMESPACE_HEADER_START struct Msat_Clause_t_ | Msat_Clause_t |
| INCLUDES ///. | |
| typedef struct Msat_Queue_t_ | Msat_Queue_t |
| typedef struct Msat_Order_t_ | Msat_Order_t |
| typedef struct Msat_MmFixed_t_ | Msat_MmFixed_t |
| typedef struct Msat_MmFlex_t_ | Msat_MmFlex_t |
| typedef struct Msat_MmStep_t_ | Msat_MmStep_t |
| typedef int | Msat_Lit_t |
| typedef int | Msat_Var_t |
| typedef struct Msat_SolverStats_t_ | Msat_SolverStats_t |
| typedef struct Msat_SearchParams_t_ | Msat_SearchParams_t |
| #define L_ind Msat_SolverReadDecisionLevel(p)*3+3,Msat_SolverReadDecisionLevel(p) |
| #define L_lit | ( | Lit | ) |
| typedef typedefABC_NAMESPACE_HEADER_START struct Msat_Clause_t_ Msat_Clause_t |
INCLUDES ///.
CFile****************************************************************
FileName [msatInt.c]
PackageName [A C version of SAT solver MINISAT, originally developed in C++ by Niklas Een and Niklas Sorensson, Chalmers University of Technology, Sweden: http://www.cs.chalmers.se/~een/Satzoo.]
Synopsis [Internal definitions of the solver.]
Author [Alan Mishchenko alanm.nosp@m.i@ee.nosp@m.cs.be.nosp@m.rkel.nosp@m.ey.ed.nosp@m.u]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - January 1, 2004.]
Revision [
] PARAMETERS /// STRUCTURE DEFINITIONS ///
| typedef int Msat_Lit_t |
| typedef struct Msat_MmFixed_t_ Msat_MmFixed_t |
| typedef struct Msat_MmFlex_t_ Msat_MmFlex_t |
| typedef struct Msat_MmStep_t_ Msat_MmStep_t |
| typedef struct Msat_Order_t_ Msat_Order_t |
| typedef struct Msat_Queue_t_ Msat_Queue_t |
| typedef struct Msat_SearchParams_t_ Msat_SearchParams_t |
| typedef struct Msat_SolverStats_t_ Msat_SolverStats_t |
| typedef int Msat_Var_t |
|
extern |
Function*************************************************************
Synopsis [Computes reason of conflict in the given clause.]
Description [If the literal is unassigned, finds the reason by complementing literals in the given cluase (pC). If the literal is assigned, makes sure that this literal is the first one in the clause and computes the complement of all other literals in the clause. Returns the reason in the given array (vLits_out). If the clause is learned, bumps its activity.]
SideEffects []
SeeAlso []
Definition at line 418 of file msatClause.c.

|
extern |
|
extern |
FUNCTION DEFINITIONS ///.
Function*************************************************************
Synopsis [Creates a new clause.]
Description [Returns FALSE if top-level conflict detected (must be handled); TRUE otherwise. 'pClause_out' may be set to NULL if clause is already satisfied by the top-level assignment.]
SideEffects []
SeeAlso []
Definition at line 58 of file msatClause.c.


|
extern |
|
extern |
|
extern |
Function*************************************************************
Synopsis [Deallocates the clause.]
Description []
SideEffects []
SeeAlso []
Definition at line 223 of file msatClause.c.


|
extern |
Function*************************************************************
Synopsis [Checks whether the learned clause is locked.]
Description [The clause may be locked if it is the reason of a recent conflict. Such clause cannot be removed from the database.]
SideEffects []
SeeAlso []
Definition at line 278 of file msatClause.c.


|
extern |
Function*************************************************************
Synopsis [Prints the given clause.]
Description []
SideEffects []
SeeAlso []
Definition at line 468 of file msatClause.c.


|
extern |
Function*************************************************************
Synopsis [Prints the given clause.]
Description []
SideEffects []
SeeAlso []
Definition at line 515 of file msatClause.c.

|
extern |
Function*************************************************************
Synopsis [Propages the assignment.]
Description [The literal that has become true (Lit) is given to this procedure. The array of current variable assignments is given for efficiency. The output literal (pLit_out) can be the second watched literal (if TRUE is returned) or the conflict literal (if FALSE is returned). This messy interface is used to improve performance. This procedure accounts for ~50% of the runtime of the solver.]
SideEffects []
SeeAlso []
Definition at line 335 of file msatClause.c.

|
extern |
Function*************************************************************
Synopsis [Reads the activity of the given clause.]
Description []
SideEffects []
SeeAlso []
Definition at line 295 of file msatClause.c.


|
extern |
Function*************************************************************
Synopsis [Access the data field of the clause.]
Description []
SideEffects []
SeeAlso []
Definition at line 255 of file msatClause.c.
|
extern |
Definition at line 257 of file msatClause.c.
|
extern |
Definition at line 258 of file msatClause.c.
|
extern |
Definition at line 259 of file msatClause.c.
|
extern |
Definition at line 256 of file msatClause.c.
|
extern |
Definition at line 260 of file msatClause.c.
|
extern |
Function*************************************************************
Synopsis [Removes the given clause from the watched list.]
Description []
SideEffects []
SeeAlso []
Definition at line 444 of file msatClause.c.


|
extern |
Definition at line 262 of file msatClause.c.
|
extern |
Definition at line 263 of file msatClause.c.

|
extern |
Definition at line 264 of file msatClause.c.

|
extern |
Function*************************************************************
Synopsis [Simplifies the clause.]
Description [Assumes everything has been propagated! (esp. watches in clauses are NOT unsatisfied)]
SideEffects []
SeeAlso []
Definition at line 374 of file msatClause.c.


|
extern |
DECLARATIONS ///.
CFile****************************************************************
FileName [msatClauseVec.c]
PackageName [A C version of SAT solver MINISAT, originally developed in C++ by Niklas Een and Niklas Sorensson, Chalmers University of Technology, Sweden: http://www.cs.chalmers.se/~een/Satzoo.]
Synopsis [Procedures working with arrays of SAT clauses.]
Author [Alan Mishchenko alanm.nosp@m.i@ee.nosp@m.cs.be.nosp@m.rkel.nosp@m.ey.ed.nosp@m.u]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - January 1, 2004.]
Revision [
] FUNCTION DEFINITIONS /// Function*************************************************************
Synopsis [Allocates a vector with the given capacity.]
Description []
SideEffects []
SeeAlso []
Definition at line 45 of file msatClauseVec.c.

|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 153 of file msatClauseVec.c.

|
extern |
|
extern |
Function*************************************************************
Synopsis [Resizes the vector to the given capacity.]
Description []
SideEffects []
SeeAlso []
Definition at line 117 of file msatClauseVec.c.

|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 192 of file msatClauseVec.c.

|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 169 of file msatClauseVec.c.


|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 85 of file msatClauseVec.c.

|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 225 of file msatClauseVec.c.

|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 101 of file msatClauseVec.c.

|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 136 of file msatClauseVec.c.

|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 208 of file msatClauseVec.c.
|
extern |
Function*************************************************************
Synopsis [Sets the activity of the clause.]
Description []
SideEffects []
SeeAlso []
Definition at line 314 of file msatClause.c.


|
extern |
Function*************************************************************
Synopsis [Writes the given clause in a file in DIMACS format.]
Description []
SideEffects []
SeeAlso []
Definition at line 494 of file msatClause.c.

|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 161 of file msatMem.c.

|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 212 of file msatMem.c.

|
extern |
|
extern |
Function*************************************************************
Synopsis []
Description [Relocates all the memory except the first chunk.]
SideEffects []
SeeAlso []
Definition at line 232 of file msatMem.c.
|
extern |
FUNCTION DEFINITIONS ///.
Function*************************************************************
Synopsis [Allocates memory pieces of fixed size.]
Description [The size of the chunk is computed as the minimum of 1024 entries and 64K. Can only work with entry size at least 4 byte long.]
SideEffects []
SeeAlso []
Definition at line 93 of file msatMem.c.


|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 132 of file msatMem.c.

|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 349 of file msatMem.c.
|
extern |
|
extern |
Function*************************************************************
Synopsis [Allocates entries of flexible size.]
Description [Can only work with entry size at least 4 byte long.]
SideEffects []
SeeAlso []
Definition at line 288 of file msatMem.c.

|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 320 of file msatMem.c.
|
extern |
Function*************************************************************
Synopsis [Creates the entry.]
Description []
SideEffects []
SeeAlso []
Definition at line 479 of file msatMem.c.


|
extern |
Function*************************************************************
Synopsis [Recycles the entry.]
Description []
SideEffects []
SeeAlso []
Definition at line 503 of file msatMem.c.


|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
|
extern |
Function*************************************************************
Synopsis [Starts the hierarchical memory manager.]
Description [This manager can allocate entries of any size. Iternally they are mapped into the entries with the number of bytes equal to the power of 2. The smallest entry size is 8 bytes. The next one is 16 bytes etc. So, if the user requests 6 bytes, he gets 8 byte entry. If we asks for 25 bytes, he gets 32 byte entry etc. The input parameters "nSteps" says how many fixed memory managers are employed internally. Calling this procedure with nSteps equal to 10 results in 10 hierarchically arranged internal memory managers, which can allocate up to 4096 (1Kb) entries. Requests for larger entries are handed over to malloc() and then ABC_FREE()ed.]
SideEffects []
SeeAlso []
Definition at line 423 of file msatMem.c.


|
extern |
|
extern |
FUNCTION DEFINITIONS ///.
Function*************************************************************
Synopsis [Allocates the ordering structure.]
Description []
SideEffects []
SeeAlso []
Definition at line 78 of file msatOrderH.c.


|
extern |
Function*************************************************************
Synopsis [Checks that the J-boundary is okay.]
Description []
SideEffects []
SeeAlso []
Definition at line 147 of file msatOrderH.c.

|
extern |
Function*************************************************************
Synopsis [Cleans the ordering structure.]
Description []
SideEffects []
SeeAlso []
Definition at line 120 of file msatOrderH.c.

|
extern |
Function*************************************************************
Synopsis [Frees the ordering structure.]
Description []
SideEffects []
SeeAlso []
Definition at line 163 of file msatOrderH.c.


|
extern |
Function*************************************************************
Synopsis [Sets the bound of the ordering structure.]
Description [Should be called whenever the SAT solver is resized.]
SideEffects []
SeeAlso []
Definition at line 101 of file msatOrderH.c.


|
extern |
Function*************************************************************
Synopsis [Updates the order after a variable changed weight.]
Description []
SideEffects []
SeeAlso []
Definition at line 257 of file msatOrderH.c.

|
extern |
Function*************************************************************
Synopsis [Updates J-boundary when the variable is assigned.]
Description []
SideEffects []
SeeAlso []
Definition at line 220 of file msatOrderH.c.

|
extern |
Function*************************************************************
Synopsis [Selects the next variable to assign.]
Description []
SideEffects []
SeeAlso []
Definition at line 183 of file msatOrderH.c.

|
extern |
Function*************************************************************
Synopsis [Updates the order after a variable is unassigned.]
Description []
SideEffects []
SeeAlso []
Definition at line 235 of file msatOrderH.c.
|
extern |
FUNCTION DEFINITIONS ///.
Function*************************************************************
Synopsis [Allocates the variable propagation queue.]
Description []
SideEffects []
SeeAlso []
Definition at line 53 of file msatQueue.c.


|
extern |
Function*************************************************************
Synopsis [Resets the queue.]
Description []
SideEffects []
SeeAlso []
Definition at line 149 of file msatQueue.c.

|
extern |
Function*************************************************************
Synopsis [Extracts an entry from the queue.]
Description []
SideEffects []
SeeAlso []
Definition at line 131 of file msatQueue.c.

|
extern |
Function*************************************************************
Synopsis [Deallocate the variable propagation queue.]
Description []
SideEffects []
SeeAlso []
Definition at line 74 of file msatQueue.c.

|
extern |
Function*************************************************************
Synopsis [Insert an entry into the queue.]
Description []
SideEffects []
SeeAlso []
Definition at line 107 of file msatQueue.c.

|
extern |
Function*************************************************************
Synopsis [Reads the queue size.]
Description []
SideEffects []
SeeAlso []
Definition at line 91 of file msatQueue.c.

|
extern |
FUNCTION DEFINITIONS ///.
Function*************************************************************
Synopsis [Makes the next assumption (Lit).]
Description [Returns FALSE if immediate conflict.]
SideEffects []
SeeAlso []
Definition at line 51 of file msatSolverSearch.c.


|
extern |
Function*************************************************************
Synopsis [Reverts to the state at given level.]
Description []
SideEffects []
SeeAlso []
Definition at line 128 of file msatSolverSearch.c.


|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 105 of file msatActivity.c.


|
extern |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 128 of file msatActivity.c.

|
extern |
Function*************************************************************
Synopsis [Divide all constraint activities by 1e20.]
Description []
SideEffects []
SeeAlso []
Definition at line 144 of file msatActivity.c.


|
extern |
Definition at line 65 of file msatSolverApi.c.
|
extern |
Definition at line 67 of file msatSolverApi.c.
|
extern |
Definition at line 64 of file msatSolverApi.c.
|
extern |
Definition at line 66 of file msatSolverApi.c.
|
extern |
Function*************************************************************
Synopsis [Enqueues one variable assignment.]
Description [Puts a new fact on the propagation queue and immediately updates the variable value. Should a conflict arise, FALSE is returned. Otherwise returns TRUE.]
SideEffects []
SeeAlso []
Definition at line 173 of file msatSolverSearch.c.


|
extern |
|
extern |
Function*************************************************************
Synopsis [Returns search-space coverage. Not extremely reliable.]
Description []
SideEffects []
SeeAlso []
Definition at line 88 of file msatSolverCore.c.

|
extern |
Function*************************************************************
Synopsis [Propagates the assignments in the queue.]
Description [Propagates all enqueued facts. If a conflict arises, the conflicting clause is returned, otherwise NULL.]
SideEffects [The propagation queue is empty, even if there was a conflict.]
SeeAlso []
Definition at line 217 of file msatSolverSearch.c.


|
extern |
Function*************************************************************
Synopsis [Reads the clause with the given number.]
Description []
SideEffects []
SeeAlso []
Definition at line 83 of file msatSolverApi.c.

|
extern |
Definition at line 50 of file msatSolverApi.c.


|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Definition at line 53 of file msatSolverApi.c.
|
extern |
|
extern |
Function*************************************************************
Synopsis [The search procedure called between the restarts.]
Description [Search for a satisfying solution as long as the number of conflicts does not exceed the limit (nConfLimit) while keeping the number of learnt clauses below the provided limit (nLearnedLimit). NOTE! Use negative value for nConfLimit or nLearnedLimit to indicate infinity.]
SideEffects []
SeeAlso []
Definition at line 535 of file msatSolverSearch.c.


|
extern |
FUNCTION DEFINITIONS ///.
Function*************************************************************
Synopsis [Msat_SolverSort the learned clauses in the increasing order of activity.]
Description []
SideEffects []
SeeAlso []
Definition at line 61 of file msatSort.c.

|
extern |
DECLARATIONS ///.
CFile****************************************************************
FileName [msatActivity.c]
PackageName [A C version of SAT solver MINISAT, originally developed in C++ by Niklas Een and Niklas Sorensson, Chalmers University of Technology, Sweden: http://www.cs.chalmers.se/~een/Satzoo.]
Synopsis [Procedures controlling activity of variables and clauses.]
Author [Alan Mishchenko alanm.nosp@m.i@ee.nosp@m.cs.be.nosp@m.rkel.nosp@m.ey.ed.nosp@m.u]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - January 1, 2004.]
Revision [
] FUNCTION DEFINITIONS /// Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 45 of file msatActivity.c.


|
extern |
GLOBAL VARIABLES ///.
MACRO DEFINITIONS /// FUNCTION DECLARATIONS ///
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 69 of file msatActivity.c.

|
extern |
Function*************************************************************
Synopsis [Divide all variable activities by 1e100.]
Description []
SideEffects []
SeeAlso []
Definition at line 86 of file msatActivity.c.
