idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
131,100 | public static CleaneLing full ( final FormulaFactory f ) { return new CleaneLing ( f , SolverStyle . FULL , new CleaneLingConfig . Builder ( ) . build ( ) ) ; } | Returns a new full CleaneLing solver . |
131,101 | public static CleaneLing full ( final FormulaFactory f , final CleaneLingConfig config ) { return new CleaneLing ( f , SolverStyle . FULL , config ) ; } | Returns a new full CleaneLing solver with a given configuration . |
131,102 | private void addClause ( final Collection < Literal > literals ) { for ( final Literal lit : literals ) { Integer index = this . name2idx . get ( lit . variable ( ) . name ( ) ) ; if ( index == null ) { index = this . name2idx . size ( ) + 1 ; this . name2idx . put ( lit . variable ( ) . name ( ) , index ) ; this . idx... | Adds a collection of literals to the solver . |
131,103 | public int getOrCreateVarIndex ( final Variable var ) { Integer index = this . name2idx . get ( var . name ( ) ) ; if ( index == null ) { index = this . name2idx . size ( ) + 1 ; this . name2idx . put ( var . name ( ) , index ) ; this . idx2name . put ( index , var . name ( ) ) ; } return index ; } | Returns the existing internal solver index for a variable or creates a new one if the variable is yet unknown . |
131,104 | public String createNewVariableOnSolver ( final String prefix ) { final int index = this . name2idx . size ( ) + 1 ; final String varName = prefix + "_" + index ; this . name2idx . put ( varName , index ) ; this . idx2name . put ( index , varName ) ; return varName ; } | Creates a new variable on the solver and returns its name . |
131,105 | private LinkedHashSet < Formula > gatherAppliedOperands ( final NAryOperator operator ) { final LinkedHashSet < Formula > applied = new LinkedHashSet < > ( ) ; for ( final Formula operand : operator ) { applied . add ( apply ( operand , false ) ) ; } return applied ; } | Gather the operands of an n - ary operator and returns its applied operands . |
131,106 | public void setNumberOfVars ( final int num ) { if ( this . varnum != 0 ) throw new UnsupportedOperationException ( "Variable number is already set. Resetting it is not supported" ) ; if ( num < 1 || num > MAXVAR ) throw new IllegalArgumentException ( "Invalid variable number: " + num ) ; this . vars = new int [ num * ... | Sets the number of variables to use . It may be called more than one time but only to increase the number of variables . |
131,107 | private void delRef ( final int root ) { if ( root < 2 ) return ; if ( root >= this . nodesize ) throw new IllegalStateException ( "Cannot dereference a variable > varnum" ) ; if ( this . low ( root ) == - 1 ) throw new IllegalStateException ( "Cannot dereference variable -1" ) ; if ( ! this . hasref ( root ) ) throw n... | Deletes a reference for a given node . |
131,108 | public List < byte [ ] > allSat ( final int r ) { final byte [ ] allsatProfile = new byte [ this . varnum ] ; for ( int v = level ( r ) - 1 ; v >= 0 ; -- v ) allsatProfile [ this . level2var [ v ] ] = - 1 ; initRef ( ) ; final List < byte [ ] > allSat = new LinkedList < > ( ) ; allSatRec ( r , allSat , allsatProfile ) ... | Returns all models for a given BDD . |
131,109 | private void initializeGlucose ( ) { this . initializeGlucoseConfig ( ) ; this . watchesBin = new LNGVector < > ( ) ; this . permDiff = new LNGIntVector ( ) ; this . lastDecisionLevel = new LNGIntVector ( ) ; this . lbdQueue = new LNGBoundedLongQueue ( ) ; this . trailQueue = new LNGBoundedIntQueue ( ) ; this . assump ... | Initializes the additional parameters . |
131,110 | private void initializeGlucoseConfig ( ) { this . lbLBDMinimizingClause = glucoseConfig . lbLBDMinimizingClause ; this . lbLBDFrozenClause = glucoseConfig . lbLBDFrozenClause ; this . lbSizeMinimizingClause = glucoseConfig . lbSizeMinimizingClause ; this . firstReduceDB = glucoseConfig . firstReduceDB ; this . specialI... | Initializes the glucose configuration . |
131,111 | private long computeLBD ( final LNGIntVector lits , int e ) { int end = e ; long nblevels = 0 ; myflag ++ ; if ( incremental ) { if ( end == - 1 ) end = lits . size ( ) ; long nbDone = 0 ; for ( int i = 0 ; i < lits . size ( ) ; i ++ ) { if ( nbDone >= end ) break ; if ( isSelector ( var ( lits . get ( i ) ) ) ) contin... | Computes the LBD for a given vector of literals . |
131,112 | private long computeLBD ( final MSClause c ) { long nblevels = 0 ; myflag ++ ; if ( incremental ) { long nbDone = 0 ; for ( int i = 0 ; i < c . size ( ) ; i ++ ) { if ( nbDone >= c . sizeWithoutSelectors ( ) ) break ; if ( isSelector ( var ( c . get ( i ) ) ) ) continue ; nbDone ++ ; int l = v ( c . get ( i ) ) . level... | Computes the LBD for a given clause |
131,113 | private void minimisationWithBinaryResolution ( final LNGIntVector outLearnt ) { long lbd = computeLBD ( outLearnt , - 1 ) ; int p = not ( outLearnt . get ( 0 ) ) ; if ( lbd <= lbLBDMinimizingClause ) { myflag ++ ; for ( int i = 1 ; i < outLearnt . size ( ) ; i ++ ) permDiff . set ( var ( outLearnt . get ( i ) ) , myfl... | A special clause minimization by binary resolution for small clauses . |
131,114 | private int buildRec ( final Formula formula ) { switch ( formula . type ( ) ) { case FALSE : return BDDKernel . BDD_FALSE ; case TRUE : return BDDKernel . BDD_TRUE ; case LITERAL : final Literal lit = ( Literal ) formula ; Integer idx = this . var2idx . get ( lit . variable ( ) ) ; if ( idx == null ) { idx = this . va... | Recursive build procedure for the BDD . |
131,115 | public void setVariableOrder ( final Variable ... varOrder ) { this . kernel . setNumberOfVars ( varOrder . length ) ; for ( final Variable lit : varOrder ) { final int idx = this . var2idx . size ( ) ; this . var2idx . put ( lit . variable ( ) , idx ) ; this . idx2var . put ( idx , lit . variable ( ) ) ; } } | Sets the variable order for this factory manually . In this case the number of variables has not to be set manually . |
131,116 | public BigDecimal modelCount ( final BDD bdd , final int unimportantVars ) { return modelCount ( bdd ) . divide ( BigDecimal . valueOf ( ( int ) Math . pow ( 2 , unimportantVars ) ) ) ; } | Returns the model count of a given BDD with a given number of unimportant variables . |
131,117 | public List < Assignment > enumerateAllModels ( final BDD bdd , final Collection < Variable > variables ) { final Set < Assignment > res = new HashSet < > ( ) ; final List < byte [ ] > models = this . kernel . allSat ( bdd . index ( ) ) ; final SortedSet < Integer > temp ; if ( variables == null ) temp = new TreeSet < ... | Enumerates all models of a given BDD wrt . a given set of variables . |
131,118 | public Formula cnf ( final BDD bdd ) { final List < byte [ ] > unsatPaths = this . kernel . allUnsat ( bdd . index ( ) ) ; final List < Formula > clauses = new LinkedList < > ( ) ; List < Formula > literals ; for ( final byte [ ] path : unsatPaths ) { literals = new LinkedList < > ( ) ; for ( int i = 0 ; i < path . len... | Returns a CNF formula for a given BDD . |
131,119 | public Formula dnf ( final BDD bdd ) { final List < Formula > ops = new LinkedList < > ( ) ; for ( final Assignment ass : this . enumerateAllModels ( bdd ) ) ops . add ( ass . formula ( this . f ) ) ; return ops . isEmpty ( ) ? this . f . falsum ( ) : this . f . or ( ops ) ; } | Returns a DNF formula for a given BDD . |
131,120 | public SortedSet < Variable > support ( final BDD bdd ) { final int supportBDD = this . kernel . support ( bdd . index ( ) ) ; final Assignment assignment = createAssignment ( supportBDD ) ; assert assignment == null || assignment . negativeLiterals ( ) . isEmpty ( ) ; return assignment == null ? new TreeSet < Variable... | Returns all the variables that a given BDD depends on . |
131,121 | private Assignment createAssignment ( final int modelBDD ) { if ( modelBDD == BDDKernel . BDD_FALSE ) return null ; if ( modelBDD == BDDKernel . BDD_TRUE ) return new Assignment ( ) ; final List < int [ ] > nodes = this . kernel . allNodes ( modelBDD ) ; final Assignment assignment = new Assignment ( ) ; for ( final in... | Creates an assignment from a BDD . |
131,122 | public SortedMap < Variable , Integer > variableProfile ( final BDD bdd ) { final int [ ] varProfile = this . kernel . varProfile ( bdd . index ( ) ) ; final SortedMap < Variable , Integer > profile = new TreeMap < > ( ) ; for ( int i = 0 ; i < varProfile . length ; i ++ ) { profile . put ( this . idx2var . get ( i ) ,... | Returns how often each variable occurs in the given BDD . |
131,123 | public BDDNode toLngBdd ( final int bdd ) { final BDDConstant falseNode = BDDConstant . getFalsumNode ( this . f ) ; final BDDConstant trueNode = BDDConstant . getVerumNode ( this . f ) ; if ( bdd == BDDKernel . BDD_FALSE ) return falseNode ; if ( bdd == BDDKernel . BDD_TRUE ) return trueNode ; final List < int [ ] > n... | Returns a LogicNG internal BDD data structure of a given BDD . |
131,124 | public Formula formula ( final FormulaFactory f ) { if ( this . operator != FType . AND && this . operator != FType . OR ) throw new IllegalStateException ( "Illegal operator for formula list formula construction: " + this . operator ) ; if ( this . formula == null ) { if ( this . operator == FType . AND ) this . formu... | Returns this formula list as a formula if there is an operator . |
131,125 | public Formula get ( final int i ) { if ( i < 0 || i >= this . formulas . length ) throw new IllegalArgumentException ( "Illegal formula index: " + i ) ; return this . formulas [ i ] ; } | Returns the i - th formula of this formula list . |
131,126 | public SortedSet < Variable > variables ( ) { if ( this . variables == null ) { this . variables = new TreeSet < > ( ) ; for ( final Formula f : this . formulas ) this . variables . addAll ( f . variables ( ) ) ; } return this . variables ; } | Returns all variables occurring in this formula list . |
131,127 | public SortedSet < Literal > getCompleteBackbone ( ) { final SortedSet < Literal > completeBackbone = new TreeSet < > ( ) ; if ( hasPositiveBackboneResult ( ) ) { completeBackbone . addAll ( this . positiveBackbone ) ; } if ( hasNegativeBackboneResult ( ) ) { for ( final Variable var : this . negativeBackbone ) { compl... | Returns all literals of the backbone . Positive backbone variables have positive polarity negative backbone variables have negative polarity . |
131,128 | public Node < T > node ( T content ) { final Node < T > search = nodes . get ( content ) ; if ( search != null ) return search ; final Node < T > n = new Node < > ( content , this ) ; nodes . put ( content , n ) ; return n ; } | Returns the node with a given content . If such a node does not exist it is created and added to the graph . |
131,129 | public void encodeAMO ( final MiniSatStyleSolver s , final LNGIntVector lits ) { switch ( this . amoEncoding ) { case LADDER : this . ladder . encode ( s , lits ) ; break ; default : throw new IllegalStateException ( "Unknown AMO encoding: " + this . amoEncoding ) ; } } | Encodes an AMO constraint in the given solver . |
131,130 | public void encodeCardinality ( final MiniSatStyleSolver s , final LNGIntVector lits , int rhs ) { switch ( this . cardinalityEncoding ) { case TOTALIZER : this . totalizer . build ( s , lits , rhs ) ; if ( this . totalizer . hasCreatedEncoding ( ) ) this . totalizer . update ( s , rhs ) ; break ; case MTOTALIZER : thi... | Encodes a cardinality constraint in the given solver . |
131,131 | public void updateCardinality ( final MiniSatStyleSolver s , int rhs ) { switch ( this . cardinalityEncoding ) { case TOTALIZER : this . totalizer . update ( s , rhs ) ; break ; case MTOTALIZER : this . mtotalizer . update ( s , rhs ) ; break ; default : throw new IllegalStateException ( "Unknown cardinality encoding: ... | Updates the cardinality constraint . |
131,132 | public void buildCardinality ( final MiniSatStyleSolver s , final LNGIntVector lits , int rhs ) { assert this . incrementalStrategy != IncrementalStrategy . NONE ; switch ( this . cardinalityEncoding ) { case TOTALIZER : this . totalizer . build ( s , lits , rhs ) ; break ; default : throw new IllegalStateException ( "... | Manages the building of cardinality encodings . Currently is only used for incremental solving . |
131,133 | public void incUpdateCardinality ( final MiniSatStyleSolver s , final LNGIntVector join , final LNGIntVector lits , int rhs , final LNGIntVector assumptions ) { assert this . incrementalStrategy == IncrementalStrategy . ITERATIVE ; switch ( this . cardinalityEncoding ) { case TOTALIZER : if ( join . size ( ) > 0 ) this... | Manages the incremental update of cardinality constraints . |
131,134 | public void encodePB ( final MiniSatStyleSolver s , final LNGIntVector lits , final LNGIntVector coeffs , int rhs ) { switch ( this . pbEncoding ) { case SWC : this . swc . encode ( s , lits , coeffs , rhs ) ; break ; default : throw new IllegalStateException ( "Unknown pseudo-Boolean encoding: " + this . pbEncoding ) ... | Encodes a pseudo - Boolean constraint . |
131,135 | public void updatePB ( final MiniSatStyleSolver s , int rhs ) { switch ( this . pbEncoding ) { case SWC : this . swc . update ( s , rhs ) ; break ; default : throw new IllegalStateException ( "Unknown pseudo-Boolean encoding: " + this . pbEncoding ) ; } } | Updates a pseudo - Boolean encoding . |
131,136 | public void incEncodePB ( final MiniSatStyleSolver s , final LNGIntVector lits , final LNGIntVector coeffs , int rhs , final LNGIntVector assumptions , int size ) { assert this . incrementalStrategy == IncrementalStrategy . ITERATIVE ; switch ( this . pbEncoding ) { case SWC : this . swc . encode ( s , lits , coeffs , ... | Incrementally encodes a pseudo - Boolean constraint . |
131,137 | public void incUpdatePB ( final MiniSatStyleSolver s , final LNGIntVector lits , final LNGIntVector coeffs , int rhs ) { assert this . incrementalStrategy == IncrementalStrategy . ITERATIVE ; switch ( this . pbEncoding ) { case SWC : this . swc . updateInc ( s , rhs ) ; this . swc . join ( s , lits , coeffs ) ; break ;... | Manages the incremental update of pseudo - Boolean encodings . |
131,138 | public void incUpdatePBAssumptions ( final LNGIntVector assumptions ) { assert this . incrementalStrategy == IncrementalStrategy . ITERATIVE ; switch ( this . pbEncoding ) { case SWC : this . swc . updateAssumptions ( assumptions ) ; break ; default : throw new IllegalStateException ( "Unknown pseudo-Boolean encoding: ... | Manages the incremental update of assumptions . |
131,139 | private void growTo ( int size ) { this . elems . growTo ( size , 0 ) ; this . first = 0 ; this . maxSize = size ; this . queueSize = 0 ; this . last = 0 ; } | Grows this queue to a given size . |
131,140 | void setLexerAndParser ( final Lexer lexer , final ParserWithFormula parser ) { this . lexer = lexer ; this . parser = parser ; this . parser . setFormulaFactory ( this . f ) ; this . lexer . removeErrorListeners ( ) ; this . parser . removeErrorListeners ( ) ; this . parser . setErrorHandler ( new BailErrorStrategy ( ... | Sets the internal lexer and the parser . |
131,141 | public Formula parse ( final InputStream inputStream ) throws ParserException { if ( inputStream == null ) { return this . f . verum ( ) ; } try { final CharStream input = CharStreams . fromStream ( inputStream ) ; this . lexer . setInputStream ( input ) ; final CommonTokenStream tokens = new CommonTokenStream ( this .... | Parses and returns a given input stream . |
131,142 | public Formula parse ( final String in ) throws ParserException { if ( in == null || in . isEmpty ( ) ) { return this . f . verum ( ) ; } try { final CharStream input = CharStreams . fromString ( in ) ; this . lexer . setInputStream ( input ) ; final CommonTokenStream tokens = new CommonTokenStream ( this . lexer ) ; t... | Parses and returns a given string . |
131,143 | private void encodeNonRecursive ( final LNGVector < Literal > literals ) { if ( literals . size ( ) > 1 ) for ( int i = 0 ; i < literals . size ( ) ; i ++ ) for ( int j = i + 1 ; j < literals . size ( ) ; j ++ ) this . result . addClause ( literals . get ( i ) . negate ( ) , literals . get ( j ) . negate ( ) ) ; } | Internal non recursive encoding . |
131,144 | public void update ( final MiniSatStyleSolver s , int rhs ) { final LNGIntVector assumptions = new LNGIntVector ( ) ; this . update ( s , rhs , assumptions ) ; } | Updates the right hand side . |
131,145 | void join ( final MiniSatStyleSolver s , final LNGIntVector lits , int rhs ) { assert this . incrementalStrategy == MaxSATConfig . IncrementalStrategy . ITERATIVE ; final LNGIntVector leftCardinalityOutlits = new LNGIntVector ( this . cardinalityOutlits ) ; int oldCardinality = this . currentCardinalityRhs ; if ( lits ... | Joins two constraints . The given constraint is added to the current one . |
131,146 | public Formula encode ( final Formula formula ) { switch ( this . config ( ) . algorithm ) { case FACTORIZATION : if ( this . factorization == null ) this . factorization = new CNFFactorization ( ) ; return formula . transform ( this . factorization ) ; case TSEITIN : if ( this . tseitin == null || this . currentAtomBo... | Encodes a formula to CNF . |
131,147 | private Formula advancedEncoding ( final Formula formula ) { if ( formula . type ( ) == FType . AND ) { final List < Formula > operands = new ArrayList < > ( formula . numberOfOperands ( ) ) ; for ( final Formula op : formula ) operands . add ( singleAdvancedEncoding ( op ) ) ; return this . f . and ( operands ) ; } re... | Encodes the given formula to CNF by first trying to use Factorization for the single sub - formulas . When certain user - provided boundaries are met the method is switched to Tseitin or Plaisted & Greenbaum . |
131,148 | private static Map < Literal , Integer > nonCachingLiteralProfile ( final Formula formula ) { final SortedMap < Literal , Integer > map = new TreeMap < > ( ) ; nonCachingRecursion ( formula , map ) ; return map ; } | The non - caching implementation of the literal profile computation . In this case the result map is only constructed once and results are just added to it . |
131,149 | public void printSolverState ( final PrintStream output ) { output . println ( "level=" + this . level ) ; output . println ( "next=" + this . next ) ; output . println ( "ignore=" + this . ignore ) ; output . println ( "empty=" + this . empty ) ; output . println ( "vars=" + this . vars ) ; output . println ( "vals=" ... | Prints the current solver state to a given output stream . |
131,150 | public void add ( final Formula formula ) { final Formula cnf = formula . cnf ( ) ; switch ( cnf . type ( ) ) { case TRUE : break ; case FALSE : case LITERAL : case OR : this . addClause ( generateClauseVector ( cnf ) , null ) ; break ; case AND : for ( final Formula op : cnf ) { this . addClause ( generateClauseVector... | Adds an arbitrary formula to the solver . |
131,151 | private List < Integer > getRelevantVarIndices ( final Collection < Variable > variables ) { final List < Integer > relevantVarIndices = new ArrayList < > ( variables . size ( ) ) ; for ( final Variable var : variables ) { final Integer idx = this . name2idx . get ( var . name ( ) ) ; if ( idx != null ) { relevantVarIn... | Returns a list of relevant variable indices . A relevant variable is known by the solver . |
131,152 | private Backbone buildBackbone ( final Collection < Variable > variables ) { final SortedSet < Variable > posBackboneVars = isBothOrPositiveType ( ) ? new TreeSet < Variable > ( ) : null ; final SortedSet < Variable > negBackboneVars = isBothOrNegativeType ( ) ? new TreeSet < Variable > ( ) : null ; final SortedSet < V... | Builds the backbone object from the computed backbone literals . |
131,153 | public Backbone compute ( final Collection < Variable > variables , final BackboneType type ) { final boolean sat = solve ( null ) == Tristate . TRUE ; Backbone backbone = null ; if ( sat ) { final List < Integer > relevantVarIndices = getRelevantVarIndices ( variables ) ; init ( relevantVarIndices , type ) ; compute (... | Computes the backbone of the given variables with respect to the formulas added to the solver . |
131,154 | private boolean isUnit ( final int lit , final MSClause clause ) { for ( int i = 0 ; i < clause . size ( ) ; ++ i ) { final int clauseLit = clause . get ( i ) ; if ( lit != clauseLit && this . model . get ( var ( clauseLit ) ) != sign ( clauseLit ) ) { return false ; } } return true ; } | Tests the given literal whether it is unit in the given clause . |
131,155 | private boolean isRotatable ( final int lit ) { if ( v ( var ( lit ) ) . reason ( ) != null ) { return false ; } for ( final MSWatcher watcher : this . watches . get ( not ( lit ) ) ) { if ( isUnit ( lit , watcher . clause ( ) ) ) { return false ; } } return true ; } | Tests the given literal whether it is rotatable in the current model . |
131,156 | private void addBackboneLiteral ( final int lit ) { this . backboneMap . put ( var ( lit ) , sign ( lit ) ? Tristate . FALSE : Tristate . TRUE ) ; this . assumptions . push ( lit ) ; } | Adds the given literal to the backbone result and optionally adds the literal to the solver . |
131,157 | private Stack < Integer > createInitialCandidates ( final List < Integer > variables ) { for ( final Integer var : variables ) { if ( isUPZeroLit ( var ) ) { final int backboneLit = mkLit ( var , ! this . model . get ( var ) ) ; addBackboneLiteral ( backboneLit ) ; } else { final boolean modelPhase = this . model . get... | Creates the initial candidate literals for the backbone computation . |
131,158 | private boolean solve ( final int lit ) { this . assumptions . push ( not ( lit ) ) ; final boolean sat = solve ( null , this . assumptions ) == Tristate . TRUE ; this . assumptions . pop ( ) ; return sat ; } | Tests the given literal with the formula on the solver for satisfiability . |
131,159 | private void compute ( final List < Integer > variables ) { final Stack < Integer > candidates = createInitialCandidates ( variables ) ; while ( candidates . size ( ) > 0 ) { final int lit = candidates . pop ( ) ; if ( solve ( lit ) ) { refineUpperBound ( ) ; } else { addBackboneLiteral ( lit ) ; } } } | Computes the backbone for the given variables . |
131,160 | private LNGIntVector generateClauseVector ( final Formula clause ) { final LNGIntVector clauseVec = new LNGIntVector ( clause . numberOfOperands ( ) ) ; for ( final Literal lit : clause . literals ( ) ) { int index = this . idxForName ( lit . name ( ) ) ; if ( index == - 1 ) { index = this . newVar ( false , true ) ; t... | Generates a solver vector of a clause . |
131,161 | private void biasPhases ( ) { final double [ ] score = new double [ 2 * ( maxvar ( ) + 1 ) ] ; for ( final CLClause c : this . clauses ) { if ( c . redundant ( ) || c . satisfied ( ) ) { continue ; } double inc = 1 ; for ( int size = c . size ( ) ; size > 0 ; size -- ) { inc /= 2.0 ; } for ( int i = 0 ; i < c . lits ( ... | Initializes the initial phases of literals . |
131,162 | private void touch ( final int l ) { int lit = l ; if ( lit < 0 ) { lit = - lit ; } final long newPriority = ( long ) occs ( lit ) . count ( ) + occs ( - lit ) . count ( ) ; if ( ! var ( lit ) . free ( ) ) { return ; } final LNGLongPriorityQueue queue = currentCands ( ) ; queue . update ( lit , - newPriority ) ; if ( t... | Updates and pushes a literal as candidate to simplify . |
131,163 | private void touchFixed ( ) { assert this . dense ; assert this . level == 0 ; assert this . schedule ; while ( this . touched < this . trail . size ( ) ) { final int lit = this . trail . get ( this . touched ++ ) ; assert val ( lit ) > 0 ; assert var ( lit ) . level ( ) == 0 ; final CLOccs os = occs ( lit ) ; for ( fi... | Touches literals in newly top - level satisfied clauses using the literals not touched yet . |
131,164 | private void addOcc ( final int lit , final CLClause c ) { assert this . dense ; occs ( lit ) . add ( c ) ; touch ( lit ) ; } | Adds a clause to a literal s occurrence list . |
131,165 | private void connectOccs ( final CLClause c ) { assert this . dense ; for ( int i = 0 ; i < c . lits ( ) . size ( ) ; i ++ ) { addOcc ( c . lits ( ) . get ( i ) , c ) ; } } | Connects a clause through a full occurrence list . |
131,166 | private void connectOccs ( ) { assert ! this . dense ; this . dense = true ; for ( final CLClause c : this . clauses ) { if ( ! c . redundant ( ) ) { connectOccs ( c ) ; } } } | Connects all clauses through full occurrence lists . |
131,167 | private void updateGlue ( final CLClause c ) { if ( ! this . config . glueupdate ) { return ; } if ( ! this . config . gluered ) { assert c . glue ( ) == 0 ; return ; } assert this . frames . empty ( ) ; for ( int i = 0 ; i < c . lits ( ) . size ( ) ; i ++ ) { markFrame ( c . lits ( ) . get ( i ) ) ; } final int newGlu... | Updates the glue value for a given clause . |
131,168 | private void dumpClause ( final CLClause c ) { if ( c . dumped ( ) ) { return ; } if ( c . redundant ( ) ) { assert this . stats . clausesRedundant > 0 ; this . stats . clausesRedundant -- ; } else { assert this . stats . clausesIrredundant > 0 ; this . stats . clausesIrredundant -- ; if ( this . dense ) { for ( int i ... | Dumps a given clause . |
131,169 | private void bumpClause ( final CLClause c ) { switch ( this . config . cbump ) { case INC : c . setActivity ( c . activity ( ) + 1 ) ; break ; case LRU : c . setActivity ( this . stats . conflicts ) ; break ; case AVG : c . setActivity ( ( this . stats . conflicts + c . activity ( ) ) / 2 ) ; break ; case NONE : defau... | Bumps a clause and increments it s activity . |
131,170 | private void reduce ( ) { this . stats . reductions ++ ; final LNGVector < CLClause > candidates = new LNGVector < > ( ) ; for ( final CLClause c : this . clauses ) { if ( c . redundant ( ) && ! c . important ( ) && ! c . forcing ( ) ) { candidates . push ( c ) ; } } final int keep = candidates . size ( ) / 2 ; candida... | Reduces the number of redundant clauses . |
131,171 | private int remainingVars ( ) { int res = maxvar ( ) ; res -= this . stats . varsFixed ; res -= this . stats . varsEquivalent ; res -= this . stats . varsEliminated ; return res ; } | Returns the number of remaining variables without fixed and eliminated . |
131,172 | private void strengthen ( final CLClause c , final int remove ) { if ( c . dumped ( ) || satisfied ( c ) ) { return ; } assert this . addedlits . empty ( ) ; for ( int i = 0 ; i < c . lits ( ) . size ( ) ; i ++ ) { final int lit = c . lits ( ) . get ( i ) ; if ( lit != remove && val ( lit ) == 0 ) { this . addedlits . ... | Removes a literal in a clause . |
131,173 | private int sizePenalty ( ) { long numClauses = ( long ) this . stats . clausesIrredundant / this . config . sizepen ; int logres = 0 ; while ( numClauses != 0 && logres < this . config . sizemaxpen ) { numClauses >>= 1 ; logres ++ ; } return 1 << logres ; } | Reduces simplification steps for large formulas . |
131,174 | private void backward ( final CLClause c , final int ignore ) { int minlit = 0 ; int minoccs = Integer . MAX_VALUE ; int litoccs ; this . stats . steps ++ ; for ( int i = 0 ; i < c . lits ( ) . size ( ) ; i ++ ) { final int lit = c . lits ( ) . get ( i ) ; if ( lit == ignore ) { continue ; } if ( val ( lit ) < 0 ) { co... | Backward subsumes from clause . |
131,175 | private void backward ( final int lit ) { assert this . level == 0 ; assert this . dense ; assert this . tostrengthen . empty ( ) ; final CLOccs os = occs ( lit ) ; for ( final CLClause c : os ) { assert ! c . redundant ( ) ; this . stats . steps ++ ; if ( c . dumped ( ) ) { continue ; } if ( c . size ( ) >= this . con... | Backward subsumes from clauses in the occurrence list of a given literal . |
131,176 | private boolean tryElim ( final int cand ) { assert var ( cand ) . free ( ) ; final CLOccs p = occs ( cand ) ; final CLOccs n = occs ( - cand ) ; long limit = ( long ) p . count ( ) + n . count ( ) ; for ( int i = 0 ; limit >= 0 && i < p . clauses ( ) . size ( ) ; i ++ ) { final CLClause c = p . clauses ( ) . get ( i )... | Tries bounded variable elimination on a candidate literal . |
131,177 | private void doResolve ( final CLClause c , final int pivot , final CLClause d ) { assert ! c . dumped ( ) && ! c . satisfied ( ) ; assert ! d . dumped ( ) && ! d . satisfied ( ) ; assert this . addedlits . empty ( ) ; this . stats . steps ++ ; for ( int i = 0 ; i < c . lits ( ) . size ( ) ; i ++ ) { final int lit = c ... | Performs resolution on two given clauses and a pivot literal . |
131,178 | private void pushExtension ( final CLClause c , final int blit ) { pushExtension ( 0 ) ; for ( int i = 0 ; i < c . lits ( ) . size ( ) ; i ++ ) { final int lit = c . lits ( ) . get ( i ) ; if ( lit != blit ) { pushExtension ( lit ) ; } } pushExtension ( blit ) ; } | Pushes and logs a clause and its blocking literal to the extension . |
131,179 | private void doElim ( final int cand ) { assert this . schedule ; assert var ( cand ) . free ( ) ; final CLOccs p = occs ( cand ) ; final CLOccs n = occs ( - cand ) ; for ( final CLClause c : p ) { this . stats . steps ++ ; if ( c . dumped ( ) || satisfied ( c ) ) { continue ; } for ( final CLClause d : n ) { this . st... | Performs blocking variable elimination on a candidate . |
131,180 | private void dumpEliminatedRedundant ( ) { for ( final CLClause c : this . clauses ) { if ( ! c . redundant ( ) || c . satisfied ( ) || c . dumped ( ) ) { continue ; } if ( containsEliminated ( c ) ) { dumpClause ( c ) ; } } } | Dumps redundant clauses with eliminated variables . |
131,181 | private void updateCands ( ) { if ( ! this . dense ) { connectOccs ( ) ; } assert ! this . schedule ; this . schedule = true ; if ( this . schedule = currentCands ( ) . empty ( ) ) { for ( int idx = 1 ; idx <= maxvar ( ) ; idx ++ ) { touch ( idx ) ; } } this . schedule = true ; touchFixed ( ) ; } | Updates the candidates priority queue for new rounds of simplification . |
131,182 | private void blockLit ( final int blit ) { final CLOccs os = occs ( blit ) ; for ( final CLClause c : os ) { assert ! c . redundant ( ) ; if ( ! blockClause ( c , blit ) ) { continue ; } this . stats . clausesBlocked ++ ; pushExtension ( c , blit ) ; dumpClause ( c ) ; } } | Finds and removes all blocked clauses blocked on a given blocking literal . |
131,183 | private void block ( ) { final long steps = this . limits . simpSteps ; assert this . level == 0 ; assert ! this . config . plain ; if ( ! this . config . block ) { return ; } if ( this . config . blkwait >= this . stats . simplifications ) { return ; } assert this . simplifier == Simplifier . TOPSIMP ; this . simplifi... | Blocked Clause Elimination . |
131,184 | private void disconnectClauses ( ) { this . limits . reduceImportant = 0 ; for ( int idx = 1 ; idx <= maxvar ( ) ; idx ++ ) { for ( int sign = - 1 ; sign <= 1 ; sign += 2 ) { final int lit = sign * idx ; watches ( lit ) . release ( ) ; occs ( lit ) . release ( ) ; } } this . dense = false ; } | Disconnects all clauses . |
131,185 | private CLClause reduceClause ( final CLClause c ) { int lit ; int i ; for ( i = 0 ; i < c . lits ( ) . size ( ) ; i ++ ) { lit = c . lits ( ) . get ( i ) ; if ( val ( lit ) < 0 ) { break ; } } if ( i == c . lits ( ) . size ( ) ) { return c ; } assert this . addedlits . empty ( ) ; for ( i = 0 ; i < c . lits ( ) . size... | Removes false literals from a given clause . |
131,186 | private Tristate simplify ( ) { assert this . simplifier == Simplifier . NOSIMP ; this . simplifier = Simplifier . TOPSIMP ; this . stats . simplifications ++ ; backtrack ( ) ; final int varsBefore = remainingVars ( ) ; if ( ! this . config . plain ) { if ( this . empty == null ) { distill ( ) ; } if ( this . empty == ... | Performs bounded inprocessing . |
131,187 | private void extend ( ) { while ( ! this . extension . empty ( ) ) { final int lit = this . extension . back ( ) ; int other ; boolean satisfied = false ; while ( ( other = this . extension . back ( ) ) != 0 ) { this . extension . pop ( ) ; if ( val ( other ) == VALUE_TRUE ) { satisfied = true ; } } this . extension . ... | Extends a partial to a full assignment . |
131,188 | public static < T > Set < Set < Node < T > > > compute ( final Graph < T > graph ) { final Set < Set < Node < T > > > connectedComponents = new LinkedHashSet < > ( ) ; final Set < Node < T > > unmarkedNodes = new LinkedHashSet < > ( graph . nodes ( ) ) ; while ( ! unmarkedNodes . isEmpty ( ) ) { Set < Node < T > > conn... | Computes the set of connected components of a graph where each component is represented by a set of nodes . |
131,189 | private void resize ( final int ns ) { final int size = BDDPrime . primeGTE ( ns ) ; this . table = new BDDCacheEntry [ size ] ; for ( int n = 0 ; n < size ; n ++ ) this . table [ n ] = new BDDCacheEntry ( ) ; } | Resizes the cache to a new number of entries . The old cache entries are removed in this process . |
131,190 | public static Tristate searchSATSolver ( final MiniSatStyleSolver s , final SATHandler handler , final LNGIntVector assumptions ) { return s . solve ( handler , assumptions ) ; } | Solves the formula that is currently loaded in the SAT solver with a set of assumptions . |
131,191 | public final MaxSATResult search ( final MaxSATHandler handler ) { this . handler = handler ; if ( handler != null ) handler . startedSolving ( ) ; final MaxSATResult result = search ( ) ; if ( handler != null ) handler . finishedSolving ( ) ; this . handler = null ; return result ; } | The main MaxSAT solving method . |
131,192 | public void addSoftClause ( int weight , final LNGIntVector lits ) { final LNGIntVector rVars = new LNGIntVector ( ) ; this . softClauses . push ( new MSSoftClause ( lits , weight , LIT_UNDEF , rVars ) ) ; this . nbSoft ++ ; } | Adds a new soft clause to the soft clause database . |
131,193 | public MiniSatStyleSolver newSATSolver ( ) { switch ( this . solverType ) { case GLUCOSE : return new GlucoseSyrup ( new MiniSatConfig . Builder ( ) . incremental ( true ) . build ( ) , new GlucoseConfig . Builder ( ) . build ( ) ) ; case MINISAT : return new MiniSat2Solver ( new MiniSatConfig . Builder ( ) . increment... | Creates an empty SAT Solver . |
131,194 | public void saveModel ( final LNGBooleanVector currentModel ) { assert nbInitialVariables != 0 ; assert currentModel . size ( ) != 0 ; this . model . clear ( ) ; for ( int i = 0 ; i < nbInitialVariables ; i ++ ) this . model . push ( currentModel . get ( i ) ) ; } | Saves the current model found by the SAT solver . |
131,195 | public int computeCostModel ( final LNGBooleanVector currentModel , int weight ) { assert currentModel . size ( ) != 0 ; int currentCost = 0 ; for ( int i = 0 ; i < nSoft ( ) ; i ++ ) { boolean unsatisfied = true ; for ( int j = 0 ; j < softClauses . get ( i ) . clause ( ) . size ( ) ; j ++ ) { if ( weight != Integer .... | Computes the cost of a given model . The cost of a model is the sum of the weights of the unsatisfied soft clauses . If a weight is specified then it only considers the sum of the weights of the unsatisfied soft clauses with the specified weight . |
131,196 | public boolean isBMO ( boolean cache ) { assert orderWeights . size ( ) == 0 ; boolean bmo = true ; final SortedSet < Integer > partitionWeights = new TreeSet < > ( ) ; final SortedMap < Integer , Integer > nbPartitionWeights = new TreeMap < > ( ) ; for ( int i = 0 ; i < nSoft ( ) ; i ++ ) { final int weight = softClau... | Tests if the MaxSAT formula has lexicographical optimization criterion . |
131,197 | private static String utf8Name ( final String name ) { final Matcher matcher = pattern . matcher ( name ) ; if ( ! matcher . matches ( ) ) return name ; if ( matcher . group ( 2 ) . isEmpty ( ) ) return matcher . group ( 1 ) ; return matcher . group ( 1 ) + getSubscript ( matcher . group ( 2 ) ) ; } | Returns the UTF8 string for a variable name |
131,198 | public List < Formula > newUpperBound ( int rhs ) { this . result . reset ( ) ; this . computeUBConstraint ( this . result , rhs ) ; return this . result . result ( ) ; } | Tightens the upper bound of an at - most - k constraint and returns the resulting formula . |
131,199 | public List < Formula > newLowerBound ( int rhs ) { this . result . reset ( ) ; this . computeLBConstraint ( this . result , rhs ) ; return this . result . result ( ) ; } | Tightens the lower bound of an at - least - k constraint and returns the resulting formula . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.