idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
131,200
private static < T , U > void shrinkMap ( final Map < T , U > map , int newSize ) { if ( ! ( map instanceof LinkedHashMap ) ) throw new IllegalStateException ( "Cannot shrink a map which is not of type LinkedHashMap" ) ; if ( newSize > map . size ( ) ) throw new IllegalStateException ( "Cannot shrink a map of size " + ...
Shrinks a given map to a given size
131,201
private static < T > void shrinkSet ( final Set < T > set , int newSize ) { if ( ! ( set instanceof LinkedHashSet ) ) throw new IllegalStateException ( "Cannot shrink a set which is not of type LinkedHashSet" ) ; if ( newSize > set . size ( ) ) throw new IllegalStateException ( "Cannot shrink a set of size " + set . si...
Shrinks a given set to a given size
131,202
public FormulaFactoryState save ( ) { int [ ] state = new int [ 18 ] ; state [ 0 ] = this . posLiterals . size ( ) ; state [ 1 ] = this . negLiterals . size ( ) ; state [ 2 ] = this . generatedVariables . size ( ) ; state [ 3 ] = this . nots . size ( ) ; state [ 4 ] = this . implications . size ( ) ; state [ 5 ] = this...
Saves the FormulaFactoryState to be loaded later .
131,203
public void load ( final FormulaFactoryState state ) { int index = - 1 ; for ( int i = validStates . size ( ) - 1 ; i >= 0 && index == - 1 ; i -- ) if ( validStates . get ( i ) == state . id ( ) ) index = i ; if ( index == - 1 ) throw new IllegalArgumentException ( "The given formula factory state is not valid anymore....
Loads a previously saved FormulaFactoryState . All formula factory states saved after the loaded one become invalid .
131,204
private void clearCaches ( ) { for ( Formula formula : this . posLiterals . values ( ) ) formula . clearCaches ( ) ; for ( Formula formula : this . negLiterals . values ( ) ) formula . clearCaches ( ) ; for ( Formula formula : this . generatedVariables ) formula . clearCaches ( ) ; for ( Formula formula : this . nots ....
Clears the caches of every cached Formula .
131,205
public static void write ( final String fileName , Formula formula , boolean writeMapping ) throws IOException { File file = new File ( fileName . endsWith ( ".cnf" ) ? fileName : fileName + ".cnf" ) ; SortedMap < Variable , Long > var2id = new TreeMap < > ( ) ; long i = 1 ; for ( Variable var : new TreeSet < > ( formu...
Writes a given formula s internal data structure as a dimacs file . Must only be called with a formula which is in CNF .
131,206
public boolean contains ( int element ) { return element >= 0 && this . imported ( element ) && this . pos . get ( Math . abs ( element ) ) >= 0 ; }
Returns whether a given element is already imported and present in the queue or not .
131,207
public void push ( int element ) { if ( element < 0 ) throw new IllegalArgumentException ( "Cannot add negative integers to the priority queue" ) ; assert ! this . contains ( element ) ; this . doImport ( element ) ; this . pos . set ( element , this . heap . size ( ) ) ; this . heap . push ( element ) ; assert this . ...
Pushes a new positive element to the queue .
131,208
public void update ( int element , double priority ) { this . doImport ( element ) ; final double q = this . prior . get ( element ) ; if ( Double . compare ( q , priority ) == 0 ) return ; this . prior . set ( element , priority ) ; if ( this . pos . get ( element ) < 0 ) return ; if ( priority < q ) this . down ( ele...
Updated the priority of a given element .
131,209
public void pop ( int element ) { assert this . contains ( element ) ; int i = this . pos . get ( element ) ; this . pos . set ( element , - 1 ) ; int last = this . heap . back ( ) ; this . heap . pop ( ) ; int j = this . heap . size ( ) ; if ( i == j ) return ; assert i < j ; this . pos . set ( last , i ) ; this . hea...
Removes a given element from the priority queue . Its priority is kept as is .
131,210
public void rescore ( double factor ) { for ( int i = 0 ; i < this . prior . size ( ) ; i ++ ) this . prior . set ( i , this . prior . get ( i ) * factor ) ; }
Rescores all priorities by multiplying them with the same factor .
131,211
private void up ( int element ) { int epos = this . pos . get ( element ) ; while ( epos > 0 ) { int ppos = parent ( epos ) ; int p = this . heap . get ( ppos ) ; if ( ! this . less ( p , element ) ) break ; this . heap . set ( epos , p ) ; this . heap . set ( ppos , element ) ; this . pos . set ( p , epos ) ; epos = p...
Bubbles a given element up .
131,212
private void down ( int element ) { assert this . contains ( element ) ; int epos = this . pos . get ( element ) ; int size = this . heap . size ( ) ; while ( true ) { int cpos = left ( epos ) ; if ( cpos >= size ) break ; int c = this . heap . get ( cpos ) ; int o ; int opos = right ( epos ) ; if ( ! this . less ( ele...
Bubbles a given element down .
131,213
private static Formula read ( final File file , final FormulaParser parser ) throws IOException , ParserException { try ( final BufferedReader br = new BufferedReader ( new FileReader ( file ) ) ) { final LinkedHashSet < Formula > ops = new LinkedHashSet < > ( ) ; while ( br . ready ( ) ) ops . add ( parser . parse ( b...
Internal read function .
131,214
public static MaxSATSolver linearSU ( ) { return new MaxSATSolver ( new MaxSATConfig . Builder ( ) . cardinality ( MaxSATConfig . CardinalityEncoding . MTOTALIZER ) . build ( ) , Algorithm . LINEAR_SU ) ; }
Returns a new MaxSAT solver using LinearSU as algorithm with the default configuration .
131,215
public static MaxSATSolver wmsu3 ( ) { return new MaxSATSolver ( new MaxSATConfig . Builder ( ) . incremental ( MaxSATConfig . IncrementalStrategy . ITERATIVE ) . build ( ) , Algorithm . WMSU3 ) ; }
Returns a new MaxSAT solver using weighted MSU3 as algorithm with the default configuration .
131,216
public void reset ( ) { this . result = UNDEF ; this . var2index = new TreeMap < > ( ) ; this . index2var = new TreeMap < > ( ) ; switch ( this . algorithm ) { case WBO : this . solver = new WBO ( this . configuration ) ; break ; case INC_WBO : this . solver = new IncWBO ( this . configuration ) ; break ; case LINEAR_S...
Resets the solver .
131,217
public void addSoftFormula ( final Formula formula , int weight ) { if ( this . result != UNDEF ) throw new IllegalStateException ( "The MaxSAT solver does currently not support an incremental interface. Reset the solver." ) ; if ( weight < 1 ) throw new IllegalArgumentException ( "The weight of a formula must be > 0"...
Adds a new soft formula to the solver .
131,218
private void addClause ( final Formula formula , int weight ) { this . result = UNDEF ; final LNGIntVector clauseVec = new LNGIntVector ( ( int ) formula . numberOfAtoms ( ) ) ; for ( Literal lit : formula . literals ( ) ) { Integer index = this . var2index . get ( lit . variable ( ) ) ; if ( index == null ) { index = ...
Adds a clause to the solver .
131,219
public MaxSAT . MaxSATResult solve ( final MaxSATHandler handler ) { if ( this . result != UNDEF ) return this . result ; if ( this . solver . currentWeight ( ) == 1 ) this . solver . setProblemType ( MaxSAT . ProblemType . UNWEIGHTED ) ; else this . solver . setProblemType ( MaxSAT . ProblemType . WEIGHTED ) ; this . ...
Solves the formula on the solver and returns the result .
131,220
public Assignment model ( ) { if ( this . result == UNDEF ) throw new IllegalStateException ( "Cannot get a model as long as the formula is not solved. Call 'solve' first." ) ; return this . result != UNSATISFIABLE ? this . createAssignment ( this . solver . model ( ) ) : null ; }
Returns the model of the current result .
131,221
private void addUnitClause ( final MiniSatStyleSolver s , int a , int blocking ) { assert this . clause . size ( ) == 0 ; assert a != LIT_UNDEF ; assert var ( a ) < s . nVars ( ) ; this . clause . push ( a ) ; if ( blocking != LIT_UNDEF ) this . clause . push ( blocking ) ; s . addClause ( this . clause , null ) ; this...
Adds a unit clause to the given SAT solver .
131,222
void addBinaryClause ( final MiniSatStyleSolver s , int a , int b ) { this . addBinaryClause ( s , a , b , LIT_UNDEF ) ; }
Adds a binary clause to the given SAT solver .
131,223
void addTernaryClause ( final MiniSatStyleSolver s , int a , int b , int c ) { this . addTernaryClause ( s , a , b , c , LIT_UNDEF ) ; }
Adds a ternary clause to the given SAT solver .
131,224
void buildAMK ( final EncodingResult result , final Variable [ ] vars , int rhs ) { final LNGVector < Variable > cardinalityOutvars = this . initializeConstraint ( result , vars ) ; this . incData = new CCIncrementalData ( result , CCConfig . AMK_ENCODER . TOTALIZER , rhs , cardinalityOutvars ) ; this . toCNF ( cardina...
Builds an at - most - k constraint .
131,225
void buildALK ( final EncodingResult result , final Variable [ ] vars , int rhs ) { final LNGVector < Variable > cardinalityOutvars = this . initializeConstraint ( result , vars ) ; this . incData = new CCIncrementalData ( result , CCConfig . ALK_ENCODER . TOTALIZER , rhs , vars . length , cardinalityOutvars ) ; this ....
Builds an at - least - k constraint .
131,226
void buildEXK ( final EncodingResult result , final Variable [ ] vars , int rhs ) { final LNGVector < Variable > cardinalityOutvars = this . initializeConstraint ( result , vars ) ; this . toCNF ( cardinalityOutvars , rhs , Bound . BOTH ) ; assert this . cardinalityInvars . size ( ) == 0 ; for ( int i = 0 ; i < rhs ; i...
Builds an exactly - k constraint .
131,227
private LNGVector < Variable > initializeConstraint ( final EncodingResult result , final Variable [ ] vars ) { result . reset ( ) ; this . result = result ; this . cardinalityInvars = new LNGVector < > ( vars . length ) ; final LNGVector < Variable > cardinalityOutvars = new LNGVector < > ( vars . length ) ; for ( fin...
Initializes the constraint .
131,228
private static String latexName ( 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 ) + "_{" + matcher . group ( 2 ) + "}" ; }
Returns the latex string for a variable name
131,229
public < T extends Proposition > UNSATCore < T > computeMUS ( final List < T > propositions , final FormulaFactory f ) { return this . computeMUS ( propositions , f , new MUSConfig . Builder ( ) . build ( ) ) ; }
Computes a MUS for the given propositions with the default algorithm and the default configuration .
131,230
public < T extends Proposition > UNSATCore < T > computeMUS ( final List < T > propositions , final FormulaFactory f , final MUSConfig config ) { if ( propositions . isEmpty ( ) ) throw new IllegalArgumentException ( "Cannot generate a MUS for an empty list of propositions" ) ; switch ( config . algorithm ) { case PLAI...
Computes a MUS for the given propositions and the given configuration of the MUS generation .
131,231
public void reset ( ) { this . state = State . FREE ; this . level = Integer . MAX_VALUE ; this . mark = 0 ; this . reason = null ; }
Resets this variable s members .
131,232
public ImmutableFormulaList encode ( final PBConstraint constraint ) { if ( constraint . isCC ( ) ) return this . ccEncoder . encode ( constraint ) ; final Formula normalized = constraint . normalize ( ) ; switch ( normalized . type ( ) ) { case TRUE : return new ImmutableFormulaList ( FType . AND ) ; case FALSE : retu...
Encodes a pseudo - Boolean constraint and returns its CNF encoding .
131,233
public void addSet ( final SortedSet < T > set ) { SortedMap < T , UBNode < T > > nodes = rootNodes ; UBNode < T > node = null ; for ( T element : set ) { node = nodes . get ( element ) ; if ( node == null ) { node = new UBNode < > ( element ) ; nodes . put ( element , node ) ; } nodes = node . children ( ) ; } if ( no...
Adds a set of comparable objects to this UBTree .
131,234
public SortedSet < T > firstSubset ( SortedSet < T > set ) { if ( this . rootNodes . isEmpty ( ) || set == null || set . isEmpty ( ) ) { return null ; } return firstSubset ( set , this . rootNodes ) ; }
Returns the first subset of a given set in this UBTree .
131,235
public Set < SortedSet < T > > allSubsets ( final SortedSet < T > set ) { final Set < SortedSet < T > > subsets = new LinkedHashSet < > ( ) ; allSubsets ( set , this . rootNodes , subsets ) ; return subsets ; }
Returns all subsets of a given set in this UBTree .
131,236
public Set < SortedSet < T > > allSupersets ( final SortedSet < T > set ) { final Set < SortedSet < T > > supersets = new LinkedHashSet < > ( ) ; allSupersets ( set , this . rootNodes , supersets ) ; return supersets ; }
Returns all supersets of a given set in this UBTree .
131,237
public Set < SortedSet < T > > allSets ( ) { final List < UBNode < T > > allEndOfPathNodes = getAllEndOfPathNodes ( this . rootNodes ) ; final Set < SortedSet < T > > allSets = new LinkedHashSet < > ( ) ; for ( UBNode < T > endOfPathNode : allEndOfPathNodes ) { allSets . add ( endOfPathNode . set ( ) ) ; } return allSe...
Returns all sets in this UBTree .
131,238
public void clear ( ) { this . posLiterals = new HashMap < > ( ) ; this . negLiterals = new HashMap < > ( ) ; this . generatedVariables = new HashSet < > ( ) ; this . nots = new HashMap < > ( ) ; this . implications = new HashMap < > ( ) ; this . equivalences = new HashMap < > ( ) ; this . ands2 = new HashMap < > ( ) ;...
Removes all formulas from the factory cache .
131,239
public Formula binaryOperator ( final FType type , final Formula left , final Formula right ) { switch ( type ) { case IMPL : return this . implication ( left , right ) ; case EQUIV : return this . equivalence ( left , right ) ; default : throw new IllegalArgumentException ( "Cannot create a binary formula with operato...
Creates a new binary operator with a given type and two operands .
131,240
public Formula implication ( final Formula left , final Formula right ) { if ( left . type ( ) == FALSE || right . type ( ) == TRUE ) return this . verum ( ) ; if ( left . type ( ) == TRUE ) return right ; if ( right . type ( ) == FALSE ) return this . not ( left ) ; if ( left . equals ( right ) ) return this . verum (...
Creates a new implication .
131,241
public Formula equivalence ( final Formula left , final Formula right ) { if ( left . type ( ) == TRUE ) return right ; if ( right . type ( ) == TRUE ) return left ; if ( left . type ( ) == FALSE ) return this . not ( right ) ; if ( right . type ( ) == FALSE ) return this . not ( left ) ; if ( left . equals ( right ) )...
Creates a new equivalence .
131,242
public Formula and ( final Formula ... operands ) { final LinkedHashSet < Formula > ops = new LinkedHashSet < > ( operands . length ) ; Collections . addAll ( ops , operands ) ; return this . constructAnd ( ops ) ; }
Creates a new conjunction from an array of formulas .
131,243
private Formula constructAnd ( final LinkedHashSet < ? extends Formula > operands ) { And tempAnd = null ; Map < LinkedHashSet < ? extends Formula > , And > opAndMap = this . andsN ; if ( operands . size ( ) > 1 ) { switch ( operands . size ( ) ) { case 2 : opAndMap = this . ands2 ; break ; case 3 : opAndMap = this . a...
Creates a new conjunction .
131,244
private Formula constructCNF ( final LinkedHashSet < ? extends Formula > clauses ) { if ( clauses . isEmpty ( ) ) return this . verum ( ) ; if ( clauses . size ( ) == 1 ) return clauses . iterator ( ) . next ( ) ; Map < LinkedHashSet < ? extends Formula > , And > opAndMap = this . andsN ; switch ( clauses . size ( ) ) ...
Creates a new CNF .
131,245
public Formula or ( final Formula ... operands ) { final LinkedHashSet < Formula > ops = new LinkedHashSet < > ( operands . length ) ; Collections . addAll ( ops , operands ) ; return this . constructOr ( ops ) ; }
Creates a new disjunction from an array of formulas .
131,246
private Formula constructOr ( final LinkedHashSet < ? extends Formula > operands ) { Or tempOr = null ; Map < LinkedHashSet < ? extends Formula > , Or > opOrMap = this . orsN ; if ( operands . size ( ) > 1 ) { switch ( operands . size ( ) ) { case 2 : opOrMap = this . ors2 ; break ; case 3 : opOrMap = this . ors3 ; bre...
Creates a new disjunction .
131,247
private Formula constructClause ( final LinkedHashSet < Literal > literals ) { if ( literals . isEmpty ( ) ) return this . falsum ( ) ; if ( literals . size ( ) == 1 ) return literals . iterator ( ) . next ( ) ; Map < LinkedHashSet < ? extends Formula > , Or > opOrMap = this . orsN ; switch ( literals . size ( ) ) { ca...
Creates a new clause .
131,248
public Variable variable ( final String name ) { Variable var = this . posLiterals . get ( name ) ; if ( var == null ) { var = new Variable ( name , this ) ; this . posLiterals . put ( name , var ) ; } return var ; }
Creates a new literal instance with a given name and positive phase .
131,249
public PBConstraint cc ( final CType comparator , final int rhs , final Collection < Variable > variables ) { final int [ ] coefficients = new int [ variables . size ( ) ] ; Arrays . fill ( coefficients , 1 ) ; final Variable [ ] vars = new Variable [ variables . size ( ) ] ; int count = 0 ; for ( final Variable var : ...
Creates a new cardinality constraint .
131,250
private LinkedHashSet < Formula > condenseOperandsOr ( final Collection < ? extends Formula > operands ) { final LinkedHashSet < Formula > ops = new LinkedHashSet < > ( ) ; this . cnfCheck = true ; for ( final Formula form : operands ) if ( form . type ( ) == OR ) { for ( final Formula f : ( ( NAryOperator ) form ) . o...
Returns a condensed array of operands for a given n - ary disjunction .
131,251
private LinkedHashSet < Formula > condenseOperandsAnd ( final Collection < ? extends Formula > operands ) { final LinkedHashSet < Formula > ops = new LinkedHashSet < > ( ) ; this . cnfCheck = true ; for ( final Formula form : operands ) if ( form . type ( ) == AND ) { for ( final Formula f : ( ( NAryOperator ) form ) ....
Returns a condensed array of operands for a given n - ary conjunction .
131,252
public Formula importFormula ( final Formula formula ) { if ( this . importer == null ) { this . importer = new FormulaFactoryImporter ( this ) ; } final Formula imported = formula . transform ( this . importer ) ; adjustCounters ( imported ) ; return imported ; }
Imports a formula from another formula factory into this factory and returns it . If the current factory of the formula is already this formula factory the same instance will be returned .
131,253
public FormulaFactoryStatistics statistics ( ) { final FormulaFactoryStatistics statistics = new FormulaFactoryStatistics ( ) ; statistics . name = this . name ; statistics . positiveLiterals = this . posLiterals . size ( ) ; statistics . negativeLiterals = this . negLiterals . size ( ) ; statistics . negations = this ...
Returns the statistics for this formula factory .
131,254
protected static long luby ( final long i ) { long res = 0 ; long k ; for ( k = 1 ; res == 0 && k < 64 ; k ++ ) { if ( i == ( 1L << k ) - 1 ) { res = 1L << ( k - 1 ) ; } } k = 1 ; while ( res == 0 ) { if ( ( 1L << ( k - 1 ) ) <= i && i < ( 1L << k ) - 1 ) { res = luby ( i - ( 1L << ( k - 1 ) ) + 1 ) ; } k ++ ; } return...
Returns the next number in the luby sequence .
131,255
protected void importLit ( final int lit ) { final int idx = Math . abs ( lit ) ; assert lit != 0 ; int newIdx ; while ( idx >= ( newIdx = this . vars . size ( ) ) ) { this . vars . push ( new CLVar ( ) ) ; this . vals . push ( ( byte ) 0 ) ; this . phases . push ( ( byte ) 1 ) ; this . watches . push ( new LNGVector <...
Imports a given literal .
131,256
protected CLVar var ( final int lit ) { final int idx = Math . abs ( lit ) ; assert 0 < idx && idx < this . vars . size ( ) ; return this . vars . get ( idx ) ; }
Returns the variable for a given literal .
131,257
protected byte val ( final int lit ) { byte res = this . vals . get ( Math . abs ( lit ) ) ; if ( lit < 0 ) { res = ( byte ) - res ; } return res ; }
Returns the value for a given literal .
131,258
protected void mark ( final int lit ) { final CLVar v = var ( lit ) ; assert v . mark ( ) == 0 ; v . setMark ( sign ( lit ) ) ; this . seen . push ( lit ) ; }
Marks a given literal .
131,259
protected void unmark ( final int level ) { assert level <= this . seen . size ( ) ; while ( level < this . seen . size ( ) ) { final int lit = this . seen . back ( ) ; this . seen . pop ( ) ; final CLVar v = var ( lit ) ; assert v . mark ( ) == sign ( lit ) ; v . setMark ( 0 ) ; } }
Unmarks all variables up to a given level
131,260
protected void addWatch ( final int lit , final int blit , final boolean binary , final CLClause clause ) { watches ( lit ) . push ( new CLWatch ( blit , binary , clause ) ) ; }
Adds a new watcher for a given literal .
131,261
protected boolean markFrame ( final int lit ) { final int currentlevel = var ( lit ) . level ( ) ; final CLFrame frame = this . control . get ( currentlevel ) ; if ( frame . mark ( ) ) { return false ; } frame . setMark ( true ) ; this . frames . push ( currentlevel ) ; return true ; }
Marks the frame for a given literal s decision level .
131,262
protected int unmarkFrames ( ) { final int res = this . frames . size ( ) ; while ( ! this . frames . empty ( ) ) { final CLFrame f = this . control . get ( this . frames . back ( ) ) ; this . frames . pop ( ) ; assert f . mark ( ) ; f . setMark ( false ) ; } return res ; }
Unmarks all frames .
131,263
protected void backtrack ( final int newLevel ) { assert 0 <= newLevel && newLevel <= this . level ; if ( newLevel == this . level ) { return ; } CLFrame f = this . control . back ( ) ; while ( f . level ( ) > newLevel ) { assert f . level ( ) == this . level ; assert f . trail ( ) < this . trail . size ( ) ; while ( f...
Backtracks to a given level
131,264
protected void rescore ( ) { double maxScore = this . scoreIncrement ; for ( int idx = 1 ; idx < this . vars . size ( ) ; idx ++ ) { final double p = this . decisions . priority ( idx ) ; if ( p > maxScore ) { maxScore = p ; } } final double factor = 1 / maxScore ; this . decisions . rescore ( factor ) ; this . scoreIn...
Rescores all variables .
131,265
protected void bumpLit ( final int lit ) { final double maxPriority = 1e300 ; final int idx = Math . abs ( lit ) ; double oldPriority ; if ( this . scoreIncrement > maxPriority || ( oldPriority = this . decisions . priority ( idx ) ) > maxPriority ) { rescore ( ) ; oldPriority = this . decisions . priority ( idx ) ; } ...
Bump a literal s activity .
131,266
protected boolean pullLit ( final int lit ) { if ( val ( lit ) == VALUE_TRUE ) { return false ; } if ( marked ( lit ) != 0 ) { return false ; } mark ( lit ) ; bumpLit ( lit ) ; if ( var ( lit ) . level ( ) == this . level ) { return true ; } markFrame ( lit ) ; this . addedlits . push ( lit ) ; return false ; }
Analyzes a given literal .
131,267
protected boolean minimizeLit ( final int root ) { assert marked ( root ) != 0 ; CLClause reason = var ( root ) . reason ( ) ; if ( reason == null ) { return false ; } final int oldSeenSize = this . seen . size ( ) ; int nextSeen = oldSeenSize ; boolean res = true ; int lit = root ; while ( true ) { int other ; for ( i...
Minimize the first UIP clause by trying to remove a given literal .
131,268
protected void newRestartLimit ( ) { final long newInterval = this . config . restartint * luby ( this . stats . restartsCount + 1 ) ; if ( newInterval > this . limits . maxRestartInterval ) { this . limits . maxRestartInterval = newInterval ; } this . limits . restart = this . stats . conflicts + newInterval ; }
Computes a new restart limit .
131,269
protected void assume ( final int decision ) { assert propagated ( ) ; this . level ++ ; final int height = this . trail . size ( ) ; this . control . push ( new CLFrame ( decision , this . level , height ) ) ; assert this . level + 1 == this . control . size ( ) ; assign ( decision , null ) ; }
Assumes a given decision .
131,270
protected boolean decide ( ) { assert propagated ( ) ; int decision = 0 ; while ( decision == 0 && ! this . decisions . empty ( ) ) { final int lit = this . decisions . top ( ) ; this . decisions . pop ( lit ) ; if ( val ( lit ) == 0 ) { decision = lit ; } } if ( decision == 0 ) { return false ; } assert decision > 0 ;...
Checks if there are unassigned literals left .
131,271
public LNGIntVector upZeroLiterals ( ) { final LNGIntVector upZeroLiterals = new LNGIntVector ( ) ; for ( int i = 0 ; i < this . trail . size ( ) ; ++ i ) { final int lit = this . trail . get ( i ) ; if ( var ( lit ) . level ( ) > 0 ) { break ; } else { upZeroLiterals . push ( lit ) ; } } return upZeroLiterals ; }
Returns the unit propagated literals on level zero .
131,272
public static void write ( final String fileName , final BDD bdd ) throws IOException { write ( new File ( fileName . endsWith ( ".dot" ) ? fileName : fileName + ".dot" ) , bdd ) ; }
Writes a given BDD as a dot file .
131,273
public void encode ( final MiniSatStyleSolver s , final LNGIntVector lits , int rhs ) { assert lits . size ( ) > 0 ; hasEncoding = false ; this . cardinalityUpoutlits . clear ( ) ; this . cardinalityLwoutlits . clear ( ) ; if ( rhs == 0 ) { for ( int i = 0 ; i < lits . size ( ) ; i ++ ) addUnitClause ( s , not ( lits ....
Encodes a cardinality constraint .
131,274
public void update ( final MiniSatStyleSolver s , int rhs ) { assert this . currentCardinalityRhs != - 1 ; assert hasEncoding ; this . encodeOutput ( s , rhs ) ; this . currentCardinalityRhs = rhs + 1 ; }
Updates the right hand side of the current constraint .
131,275
public void push ( long x ) { if ( this . queueSize == this . maxSize ) { assert this . last == this . first ; this . sumOfQueue -= this . elems . get ( this . last ) ; if ( ( ++ this . last ) == this . maxSize ) this . last = 0 ; } else this . queueSize ++ ; this . sumOfQueue += x ; this . elems . set ( this . first ,...
Pushes a new element to the queue .
131,276
public static Backbone compute ( final Collection < Formula > formulas , final Collection < Variable > variables , final BackboneType type ) { solver . reset ( ) ; solver . add ( formulas ) ; return solver . compute ( variables , type ) ; }
Computes the backbone for a given collection of formulas w . r . t . a collection of variables and a backbone type .
131,277
public static Backbone compute ( final Collection < Formula > formulas , final Collection < Variable > variables ) { return compute ( formulas , variables , BackboneType . POSITIVE_AND_NEGATIVE ) ; }
Computes the complete backbone for a given collection of formulas w . r . t . a collection of variables and a backbone type .
131,278
public static Backbone compute ( final Collection < Formula > formulas , final BackboneType type ) { return compute ( formulas , allVariablesInFormulas ( formulas ) , type ) ; }
Computes the backbone for a given collection of formulas w . r . t . a given backbone type .
131,279
public static Backbone compute ( final Collection < Formula > formulas ) { return compute ( formulas , allVariablesInFormulas ( formulas ) , BackboneType . POSITIVE_AND_NEGATIVE ) ; }
Computes the complete backbone for a given collection of formulas .
131,280
public static Backbone compute ( final Formula formula , final Collection < Variable > variables , final BackboneType type ) { return compute ( Collections . singletonList ( formula ) , variables , type ) ; }
Computes the backbone for a given formula w . r . t . a collection of variables and a backbone type .
131,281
public static Backbone compute ( final Formula formula , final Collection < Variable > variables ) { return compute ( formula , variables , BackboneType . POSITIVE_AND_NEGATIVE ) ; }
Computes the complete backbone for a given formula w . r . t . a collection of variables and a backbone type .
131,282
public static Backbone compute ( final Formula formula , final BackboneType type ) { return compute ( formula , formula . variables ( ) , type ) ; }
Computes the backbone for a given formula w . r . t . a given backbone type .
131,283
public static Backbone compute ( final Formula formula ) { return compute ( formula , formula . variables ( ) , BackboneType . POSITIVE_AND_NEGATIVE ) ; }
Computes the complete backbone for a given formula .
131,284
public static Backbone computePositive ( final Collection < Formula > formulas , final Collection < Variable > variables ) { return compute ( formulas , variables , BackboneType . ONLY_POSITIVE ) ; }
Computes the positive backbone variables for a given collection of formulas w . r . t . a collection of variables .
131,285
public static Backbone computePositive ( final Collection < Formula > formulas ) { return compute ( formulas , allVariablesInFormulas ( formulas ) , BackboneType . ONLY_POSITIVE ) ; }
Computes the positive backbone variables for a given collection of formulas .
131,286
public static Backbone computePositive ( final Formula formula , final Collection < Variable > variables ) { return compute ( formula , variables , BackboneType . ONLY_POSITIVE ) ; }
Computes the positive backbone allVariablesInFormulas for a given formula w . r . t . a collection of variables .
131,287
public static Backbone computePositive ( final Formula formula ) { return compute ( formula , formula . variables ( ) , BackboneType . ONLY_POSITIVE ) ; }
Computes the positive backbone variables for a given formula .
131,288
public static Backbone computeNegative ( final Collection < Formula > formulas , final Collection < Variable > variables ) { return compute ( formulas , variables , BackboneType . ONLY_NEGATIVE ) ; }
Computes the negative backbone variables for a given collection of formulas w . r . t . a collection of variables .
131,289
public static Backbone computeNegative ( final Collection < Formula > formulas ) { return compute ( formulas , allVariablesInFormulas ( formulas ) , BackboneType . ONLY_NEGATIVE ) ; }
Computes the negative backbone variables for a given collection of formulas .
131,290
public static Backbone computeNegative ( final Formula formula , final Collection < Variable > variables ) { return compute ( formula , variables , BackboneType . ONLY_NEGATIVE ) ; }
Computes the negative backbone variables for a given formula w . r . t . a collection of variables .
131,291
public static Backbone computeNegative ( final Formula formula ) { return compute ( formula , formula . variables ( ) , BackboneType . ONLY_NEGATIVE ) ; }
Computes the negative backbone variables for a given formula .
131,292
public void push ( final T element ) { int newSize = this . size + 1 ; this . ensure ( newSize ) ; this . elements [ this . size ++ ] = element ; }
Pushes an element at the end of the vector .
131,293
public void shrinkTo ( int newSize ) { if ( newSize < this . size ) { for ( int i = this . size ; i > newSize ; i -- ) this . elements [ i - 1 ] = null ; this . size = newSize ; } }
Shrinks the vector to a given size if the new size is less then the current size . Otherwise the size remains the same .
131,294
@ SuppressWarnings ( "unchecked" ) public void replaceInplace ( final LNGVector < ? extends T > other ) { if ( this == other ) throw new IllegalArgumentException ( "cannot replace a vector in-place with itself" ) ; this . elements = ( T [ ] ) new Object [ other . size ( ) ] ; for ( int i = 0 ; i < other . size ( ) ; i ...
Replaces the contents of this vector with the contents of another vector in - place .
131,295
private void selectionSort ( final T [ ] array , int start , int end , Comparator < T > lt ) { int i ; int j ; int bestI ; T tmp ; for ( i = start ; i < end ; i ++ ) { bestI = i ; for ( j = i + 1 ; j < end ; j ++ ) { if ( lt . compare ( array [ j ] , array [ bestI ] ) < 0 ) bestI = j ; } tmp = array [ i ] ; array [ i ]...
Selection sort implementation for a given array .
131,296
private void sort ( final T [ ] array , int start , int end , Comparator < T > lt ) { if ( start == end ) return ; if ( ( end - start ) <= 15 ) this . selectionSort ( array , start , end , lt ) ; else { final T pivot = array [ start + ( ( end - start ) / 2 ) ] ; T tmp ; int i = start - 1 ; int j = end ; while ( true ) ...
Merge sort implementation for a given array .
131,297
public void growTo ( int size , boolean pad ) { if ( this . size >= size ) return ; this . ensure ( size ) ; for ( int i = this . size ; i < size ; i ++ ) this . elements [ i ] = pad ; this . size = size ; }
Grows the vector to a new size and initializes the new elements with a given value .
131,298
public void reverseInplace ( ) { for ( int i = 0 ; i < this . size / 2 ; i ++ ) { boolean temp = this . elements [ i ] ; this . elements [ i ] = this . elements [ this . size - i - 1 ] ; this . elements [ this . size ( ) - i - 1 ] = temp ; } }
Reverses the content of this vector in - place .
131,299
public EmbeddedMongoDB withVersion ( Version . Main version ) { Objects . requireNonNull ( version , "version can not be null" ) ; this . version = version ; return this ; }
Sets the version for the EmbeddedMongoDB instance