Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

vallstAPI.h

Go to the documentation of this file.
00001 /*!\file
00002   Vallst's API.
00003   Vallst is a boolean constraint solver.
00004 
00005   See \ref VallstApiFuncsGrouped for a list of all API functions grouped into
00006   categories.
00007 */
00008 // (A comment marked with '!' is a doxygen comment and '\x' is a doxygen
00009 //  command. This is for generating documentation.)
00010 
00011 
00012 
00013 /*
00014     Copyright (C) 2004-2005 Daniel Vallstrom. All rights reserved.
00015 
00016     Unless explicitly acquired and licensed from Licensor under a license
00017     other than the Reciprocal Public License ("RPL"), the contents of this
00018     file are subject to the RPL Version 1.1, or subsequent versions as
00019     allowed by the RPL, and You may not copy or use this file in either
00020     source code or executable form, except in compliance with the terms
00021     and conditions of the RPL.
00022 
00023     You should be able to find a copy of the RPL (the "License") in a file
00024     named LICENSE that should come along with this file; if not, write to
00025     vallst@gmail.com.
00026 
00027     All software distributed under the License is provided in the hope
00028     that it will be useful, but WITHOUT ANY WARRANTY; without even the
00029     implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00030     PURPOSE. See the License for more details.
00031 */
00032 
00033 
00034 
00035 /*! \page VallstApiFuncsGrouped API functions grouped
00036     Here is a list of all API functions grouped into categories.
00037 
00038 
00039 \section allocSec Allocation
00040 
00041  - vallst_deleteInstance()       -- Deletes a vallst instance.
00042  - vallst_extendNrOfVars()       -- Extends the number of variables ready to be
00043                                     used.
00044  - vallst_newInstance()          -- Creates a new vallst problem instance.
00045  - vallst_propagateNrOf3ClausesEstimate()
00046                                  -- Propagates value.
00047  - vallst_propagateNrOfLitOccsEstimate()
00048                                  -- Propagates value.
00049  - vallst_setFstNrOfLevelsAllocSize()
00050                                  -- Sets flag.
00051  - vallst_setMaxHashLoad()       -- Sets max load.
00052  - vallst_setNonAxChunkSizeAxDep()
00053                                  -- Sets value.
00054  - vallst_setNonAxChunkSizeConst()
00055                                  -- Sets value.
00056  - vallst_setNonAxChunkSizeVarDep()
00057                                  -- Sets value.
00058  - vallst_setNrOf3ClausesEstimate()
00059                                  -- Sets the number of ternary clauses
00060                                     estimate.
00061  - vallst_setNrOfFreeChunksCap() -- Sets cap.
00062  - vallst_setNrOfLitOccsEstimate()
00063                                  -- Sets estimate of the number of literal
00064                                     occurrences, modulo special accounting.
00065 
00066 
00067 \section formulasSec Formulas and variables
00068 
00069  - vallst_addAxiom()             -- Adds an axiom.
00070  - vallst_addConsequence()       -- Adds a formula that should be a consequence
00071                                     of the axioms since the formula might be
00072                                     removed.
00073  - vallst_addNamedAxiom()        -- Adds a named axiom.
00074  - vallst_alterAxiomIncMT()      -- Adds to the constant in a more-than* axiom.
00075  - vallst_alterAxiomIncMTMKeepAboves()
00076                                  -- Adds to the constant in a <*-axiom keeping
00077                                     "aboves".
00078  - vallst_extendNrOfVars()       -- Extends the number of variables ready to be
00079                                     used.
00080  - vallst_formulaType()          -- Returns the type given a formula name.
00081  - vallst_getConst()             -- Returns the constant in a constraint.
00082  - vallst_getFullLitValue()      -- Returns the full status of a literal.
00083  - vallst_getKeepAboves()        -- Returns the keep-aboves flag.
00084  - vallst_getLitValue()          -- Returns the status of a literal.
00085  - vallst_getNrOfVarsAllocated() -- Returns the number of vars allocated for.
00086  - vallst_getTotalSum()          -- Returns the sum of the literal constants in
00087                                     a more-than-mult (<*) formula.
00088  - vallst_isConstraint()         -- Returns true iff a name is a constraint.
00089  - vallst_lessThanEqMultToMoreThanMult()
00090                                  -- Tranforms a >=*-formula into a <*-formula.
00091  - vallst_lessThanEqToMoreThan() -- Tranforms a >=-formula  into a <-formula.
00092  - vallst_neg()                  -- Returns the negation of a literal.
00093  - vallst_newVar()               -- Returns a new variable ready to be used.
00094  - vallst_setKeepAboves()        -- Sets flag.
00095  - vallst_setStartConst()        -- Sets value.
00096  - vallst_sumOpenTrue()          -- Sums up true and open lits in a constraint.
00097  - vallst_sumTrue()              -- Sums up true          lits in a constraint.
00098 
00099 
00100 \section searchSec Search
00101 
00102  - vallst_getAbortThreshold()    -- Returns nr of vars set to abort value.
00103  - vallst_getLevel()             -- Returns the current search level.
00104  - vallst_getNoAbortTime()       -- Returns time limit for no aborts.
00105  - vallst_makeCurrentAssumptionsSuggestions()
00106                                  -- Sets suggestions.
00107  - vallst_makeSearchAssumption() -- Makes a search assumption.
00108  - vallst_moveToLevel0()         -- Moves the current search state to level 0.
00109  - vallst_removeAssumptions()    -- Removes all search assumptions.
00110  - vallst_removeLastAssumption() -- Removes the last search assumption.
00111  - vallst_search()               -- Searches for a proof of false or a model.
00112  - vallst_setAbortThreshold()    -- Sets nr of vars set to abort.
00113  - vallst_setBufferResetFrequency()
00114                                  -- Sets the frequency.
00115  - vallst_setBufferSizeConst()   -- Sets value.
00116  - vallst_setBufferSizeNonAxDep()
00117                                  -- Sets value.
00118  - vallst_setBufferSizeVarDep()  -- Sets value.
00119  - vallst_setCCLeeway()          -- Sets proof improvement leeway.
00120  - vallst_setCreatePhantomConflictClauses()
00121                                  -- Sets the create-phantom-conflict-clauses
00122                                     flag.
00123  - vallst_setFirstRestart()      -- Sets the base/initial restart size.
00124  - vallst_setFstNrOfLevelsAllocSize()
00125                                  -- Sets flag.
00126  - vallst_setGoodClauseSize()    -- Sets what's to be considered good.
00127  - vallst_setGoodLevel()         -- Sets what's to be considered good.
00128  - vallst_setHeurAxSize()        -- Sets size.
00129  - vallst_setImproveProofLevel() -- Sets level threshold.
00130  - vallst_setKeepCCMetaMetaThreshold()
00131                                  -- Sets threshold.
00132  - vallst_setKeepConflictClauseLengthThreshold()
00133                                  -- Sets threshold.
00134  - vallst_setLooseTheoryMetaSizeLeeway()
00135                                  -- Set meta leeway used in loose mode.
00136  - vallst_setLooseTheorySizeLeeway()
00137                                  -- Set meta meta leeway used in loose mode.
00138  - vallst_setLooseTheorySizeLeewayKeep()
00139                                  -- Set leeway used in loose mode.
00140  - vallst_setLooseTimeLimitBase()
00141                                  -- Sets mode limit parameter.
00142  - vallst_setLooseTimeLimitMod() -- Sets mode limit parameter.
00143  - vallst_setMaxSkippedSimps()   -- Sets max skipped search simplifications.
00144  - vallst_setMetaMetaPruneEnd()  -- Sets the value.
00145  - vallst_setMetaMetaPruneFrequency()
00146                                  -- Sets the frequency.
00147  - vallst_setMetaMetaPruneStart()
00148                                  -- Sets the value.
00149  - vallst_setMetaPruneEnd()      -- Sets the value.
00150  - vallst_setMetaPruneFrequency()
00151                                  -- Sets the frequency.
00152  - vallst_setMetaPruneStart()    -- Sets the value.
00153  - vallst_setNextBatchSizeConst()
00154                                  -- Sets value.
00155  - vallst_setNoAbortTime()       -- Sets time limit for no aborts.
00156  - vallst_setPositiveHeurAxSign()
00157                                  -- Sets value.
00158  - vallst_setPositiveSign()      -- Sets value.
00159  - vallst_setPruningFunction()   -- Sets the pruning function.
00160  - vallst_setRandomBranchSign()  -- Sets random sign choice likelihood.
00161  - vallst_setRandomFormulaLit()  -- Sets random formula lit choice likelihood.
00162  - vallst_setRemoveTmpCauses()   -- Sets this flag.
00163  - vallst_setResetBuffersBetweenSearches()
00164                                  -- Sets flag.
00165  - vallst_setRestartFunc()       -- Sets restart batch size function.
00166  - vallst_setRestartPredefFunc() -- Chooses a predef. restart batch size
00167                                     function.
00168  - vallst_setRestartProlongCap() -- Sets cap.
00169  - vallst_setRestartStart()      -- Sets the start phase size.
00170  - vallst_setStartWithBinFstBcp()
00171                                  -- Sets flag.
00172  - vallst_setStrengthLeeway()    -- Sets the heuristic strength leeway.
00173  - vallst_setStrengthLeewayFormula()
00174                                  -- Sets the heuristic strength leeway for
00175                                     formulas.
00176  - vallst_setStrengthLeewaySize()
00177                                  -- Sets a hard strength leeway space size cap.
00178  - vallst_setStrengthLeewaySizeFormula()
00179                                  -- Sets a hard strength leeway space size cap
00180                                     for formulas.
00181  - vallst_setTightCCLeeway()     -- Sets tight proof improvement leeway.
00182  - vallst_setTightKeepCCThreshold()
00183                                  -- Set value used in tight mode.
00184  - vallst_setTightMetaMetaPruneEnd()
00185                                  -- Set value used in tight mode.
00186  - vallst_setTightMetaMetaPruneStart()
00187                                  -- Set value used in tight mode.
00188  - vallst_setTightMetaPruneStart()
00189                                  -- Set value used in tight mode.
00190  - vallst_setTightTheoryMetaSizeLeeway()
00191                                  -- Set meta leeway used in tight mode.
00192  - vallst_setTightTheorySizeLeeway()
00193                                  -- Set meta meta leeway used in tight mode.
00194  - vallst_setTightTheorySizeLeewayKeep()
00195                                  -- Set leeway used in tight mode.
00196  - vallst_setTightTimeLimitBase()
00197                                  -- Sets mode limit parameter.
00198  - vallst_setTightTimeLimitMod() -- Sets mode limit parameter.
00199  - vallst_setUseDoppelganger()   -- Sets flag.
00200 
00201 
00202 \section simpSec Simplification
00203 
00204  - vallst_compactifyVars()       -- Removes gaps in the variables.
00205  - vallst_getSubstEqus()         -- Returns flag.
00206  - vallst_permuteVars()          -- Permute the variables moving related
00207                                     variables closer together.
00208  - vallst_pruneTheory()          -- Prunes the theory.
00209  - vallst_setConvert3ClausesIntoEqus()
00210                                  -- Sets the convert-3-clauses flag.
00211  - vallst_setSimpTimeLimitFast() -- Sets time limit for fast simplifications.
00212  - vallst_setSimpTimeLimitSlow() -- Sets time limit for slow simplifications.
00213  - vallst_setSimpSetting()       -- Setting for main bcp based fast
00214                                     simplification.
00215  - vallst_setSimpSettingSlow()   -- Setting for main bcp based slow
00216                                     simplification.
00217  - vallst_setSubstEqus()         -- Sets flag.
00218  - vallst_simplify()             -- Simplifies the problem fast. BCP based.
00219  - vallst_simplifySlow()         -- Simplifies the problem slow. BCP based.
00220  - vallst_substEqus()            -- Substitutes vars p<->a in equivalences.
00221 
00222 
00223 \section symSec Symmetry detection
00224 
00225  - vallst_symmetrySearch()       -- Searches for symmetries.
00226 
00227 
00228 \section parsingSec Parsing
00229 
00230  - vallst_closeInTheoryFile()    -- Closes the in-theory file.
00231  - vallst_getInTheoryFile()      -- Returns the in-theory file.
00232  - vallst_getInTheoryFileName()  -- Returns the in-theory file name.
00233  - vallst_setPBVarPrefixChar()   -- Sets flag.
00234  - vallst_getProblemType         -- Returns the problem type.
00235  - vallst_parseCommandLineOptions()
00236                                  -- Parses options.
00237  - vallst_readInTheoryBody()     -- Reads the body of the in-theory.
00238  - vallst_readInTheoryHead()     -- Reads the head (i.e. the prologue) of the
00239                                     in-theory.
00240  - vallst_setIgnorePrologue()    -- Sets the ignore-prologue flag.
00241  - vallst_setInTheoryFile()      -- Sets the in-theory file.
00242  - vallst_setInTheoryFileName()  -- Sets the in-theory file name.
00243  - vallst_setProblemType         -- Sets the problem type.
00244  - vallst_setVarMapFile()        -- Sets the pb variable map file.
00245  - vallst_setVarMapFileName()    -- Sets the pb variable map file name.
00246 
00247 
00248 \section printSec Printing
00249 
00250  - vallst_closeChangingSettingFile()
00251                                  -- Closes the changing-setting file.
00252  - vallst_closeOutTheoryFile()   -- Closes the out-theory file.
00253  - vallst_getChangingSettingFile()
00254                                  -- Returns the changing-setting file.
00255  - vallst_getChangingSettingFileName()
00256                                  -- Returns the changing-setting file name.
00257  - vallst_getCompleteModel()     -- Returns the complete-model flag.
00258  - vallst_getOutTheoryFile()     -- Returns the out-theory file.
00259  - vallst_getOutTheoryFileName() -- Returns the out-theory file name.
00260  - vallst_getPrintChangingSetting()
00261                                  -- Returns the print-changing-setting flag.
00262  - vallst_getPrintOutTheory()    -- Returns the print-out-theory flag.
00263  - vallst_getResultFile()        -- Returns the result file.
00264  - vallst_getResultFileName()    -- Returns the result file name.
00265  - vallst_getVerbosityVector()   -- Returns the verbosity vector.
00266  - vallst_hashStateCheck()       -- Prints detailed hash info.
00267  - vallst_printAllGgcditTours()  -- Prints all ggcdit tours.
00268  - vallst_printChangingSetting() -- Prints changing settings.
00269  - vallst_printChangingSettingToFile()
00270                                  -- Prints changing settings to supplied file.
00271  - vallst_printEstimatedPrologues()
00272                                  -- Prints estimated prologue values.
00273  - vallst_printGgcditTour()      -- Prints a tour.
00274  - vallst_printHashInfo()        -- Prints easily obtainable hash info.
00275  - vallst_printModel()           -- Prints the current value of variables.
00276  - vallst_printNrOfUncheckedVars()
00277                                  -- Prints nr of unchecked vars.
00278  - vallst_printNrOfVarsSet()     -- Prints nr of vars set.
00279  - vallst_printOpenTheory()      -- Prints the current theory but without the
00280                                     variable history.
00281  - vallst_printPrologues()       -- Prints hindsighted prologue values.
00282  - vallst_printSettings()        -- Prints option settings.
00283  - vallst_printTheory()          -- Prints the current theory.
00284  - vallst_printTheoryToFile()    -- Prints the theory to a supplied file.
00285  - vallst_printTimePassed()      -- Prints the cpu time used.
00286  - vallst_printVallstResult()    -- Prints a short string corresponding to a
00287                                     VallstResult.
00288  - vallst_printVarHistory()      -- Prints the variable history.
00289  - vallst_setChangingSettingFile()
00290                                  -- Sets the changing-setting file.
00291  - vallst_setChangingSettingFileName()
00292                                  -- Sets the changing-setting file name.
00293  - vallst_setCompleteModel()     -- Sets the complete-model flag.
00294  - vallst_setOutTheoryFile()     -- Sets the out-theory file.
00295  - vallst_setOutTheoryFileName() -- Sets the out-theory file name.
00296  - vallst_setPrintChangingSetting()
00297                                  -- Sets the print-changing-setting flag.
00298  - vallst_setPrintOutTheory()    -- Sets the print-out-theory flag.
00299  - vallst_setResultFile()        -- Sets the result file.
00300  - vallst_setResultFileName()    -- Sets the result file name.
00301  - vallst_setVerbosityLevel()    -- Sets the verbosity level.
00302  - vallst_setVerbosityVector()   -- Sets the verbosity vector.
00303 
00304 
00305 \section callbackSec Callback
00306 
00307  - vallst_setCallback()          -- Sets the callback function.
00308 
00309 
00310 \section nameAllocSec Formula name allocation
00311 
00312  - vallst_extendFormulaNameArray()
00313                                  -- Extends a name array.
00314  - vallst_newFormulaNameArray()  -- Returns a new formula name array.
00315 
00316 
00317 \section graphCodingSec Graph coding
00318 
00319  - vallst_ggcditEdgeToLit()      -- Maps an (i,j) edge to a vallst literal.
00320  - vallst_ggcditLitToEdge()      -- Maps a literal to the corresponding edge.
00321  - vallst_ggcditLitToEdgeFst()   -- Maps a literal to first node of edge.
00322 
00323 
00324 \section optimizationSec Optimization
00325 
00326  - vallst_getBreadthFstOptStrat()
00327                                  -- Returns the optimization strategy flag.
00328  - vallst_maxConstraints()       -- Maximizes constraint constants.
00329  - vallst_setBreadthFstOptStrat()
00330                                  -- Sets the optimization strategy flag.
00331 
00332 
00333 \section seedSec Seed
00334 
00335  - vallst_getSeed()              -- Gets the seed used.
00336  - vallst_setSeed()              -- Sets the seed.
00337 
00338 
00339 \section timerSec Timers
00340 
00341  - vallst_setTimeLimitInMilliSec()
00342                                  -- Sets the overall time limit in
00343                                     milliseconds.
00344  - vallst_setTimeLimitInSec()    -- Sets the overall time limit in seconds.
00345 
00346 
00347 */
00348 
00349 
00350 
00351 #ifndef vallstAPI_H
00352 #define vallstAPI_H
00353 
00354 
00355 #ifdef __cplusplus
00356 extern "C"
00357 {
00358 #endif
00359 
00360 
00361 #include <stdint.h>
00362 #include <stdbool.h>
00363 #include <limits.h>
00364 #include <stdio.h>
00365 #include <time.h>
00366 
00367 
00368 
00369 // Types. -------------------------------------------------------------
00370 
00371 
00372 //! The main structure containing everything.
00373 typedef struct VallstInstance_ VallstInstance;
00374 
00375 /*! The type for literals. 2, 3, 4, ... are literals.
00376 
00377       (If you want you can change this to e.g. uint16_t. See note in
00378     vallstTypes.h.)
00379 */
00380 typedef uint32_t VallstLiteral;
00381 
00382 //! The maximum value of the type VallstLiteral
00383 #define VallstLiteral_MAX UINT32_MAX
00384 
00385 //! A type for counting literals.
00386 typedef VallstLiteral VallstLiteralN;
00387 
00388 //! A type for counting formulas.
00389 typedef uint32_t VallstFormulaN;
00390 
00391 //! The maximum value of the type VallstFormulaN
00392 #define VallstFormulaN_MAX UINT32_MAX
00393 
00394 
00395 
00396 // Some special values with special meaning.
00397 
00398 //! No prologue nrOfVars was present. This is not treated as an error.
00399 #define VallstLiteralN_noPrologueNrOfVars (VallstLiteral_MAX)
00400 
00401 //! Parse error.
00402 #define VallstLiteralN_parseError         (VallstLiteral_MAX-1)
00403 
00404 //! File error.
00405 #define VallstLiteralN_fileError          (VallstLiteral_MAX-2)
00406 
00407 //! An undefined VallstFormulaN.
00408 #define VallstFormulaN_undef VallstFormulaN_MAX
00409 
00410 
00411 
00412 //! A result type used for various functions.
00413 typedef enum
00414 {
00415     VallstResult_proofOfFalse,       //!< A proof of false was found.
00416     VallstResult_model,              //!< A model was found.
00417     VallstResult_timeLimitExceeded,  //!< The time limit has been exceeded.
00418     VallstResult_interupt,           //!< An interupt signal was received.
00419     VallstResult_notEnoughMemory,    //!< Not enough memory could be allocated.
00420     VallstResult_fileError,          //!< Some file error occurred.
00421     VallstResult_parseError,         //!< A parse error occurred.
00422     //VallstResult_error,              // Other error. Not used.
00423 
00424     //! There is no model where the extra search assumptions are true as well.
00425     VallstResult_proofOfFalseGivenSearchAssumptions,
00426 
00427     //! Model where the extra search assumptions are true as well.
00428     VallstResult_modelOfSearchAssumptions,
00429 
00430     //! VallstResult_other* constants are for miscellaneous other results.
00431     VallstResult_other,
00432     // VallstResult_other1,
00433     // ...
00434     //! VallstResult_otherIntMax ensures that the VallstResult type is large.
00435     VallstResult_otherIntMax = INT_MAX
00436 
00437 } VallstResult;
00438 
00439 
00440 
00441 //! A type for formula formats.
00442 typedef VallstLiteralN VallstFormulaType;
00443 
00444 /*!\t
00445   For any formula a you can easily introduce a Tseitin name p for the
00446   formula such that p<=>a --- disregarding global types.
00447 
00448   Formulas of type >=* and >= aren't supported directly. Instead you have to
00449   transform them into <*- and <-formulas. See
00450   vallst_lessThanEqMultToMoreThanMult() and vallst_lessThanEqToMoreThan().
00451 
00452   (Negated) equivalences will be normalized so that all the literals in them
00453   are unnegated. E.g. <->{-p,-q,-r} will be turned into -<->{p,q,r} where
00454   p, q and r are variables.
00455 */ /*\{*/ /*!\u*/ //\{
00456 
00457 //! Arbitrary long disjunction, \/{...}.
00458 #define VallstFormulaType_clause          (VallstLiteral_MAX-1)
00459 
00460 
00461 /*! Arbitrary long equivalence, <->{...} (i.e p1<->p2<->p3<->p4<->...<->pn
00462    (saying that an even number of the literals are true if n is even and saying
00463    that an odd number of the literals are true if n is odd)).
00464 */
00465 #define VallstFormulaType_equivalence     (VallstLiteral_MAX-5)
00466 
00467 //! Arbitrary long negated equivalence (xor), -<->{...}
00468 //! (i.e -(p<->q<->r<->s<->...)).
00469 #define VallstFormulaType_negEquivalence  (VallstLiteral_MAX-4)
00470 
00471 
00472 /*! Arbitrary long constraint on the form c < p+q+r+..., where c is a constant.
00473     I.e. the formula says that at least c+1 of p,q,... should be true.
00474 
00475       With c=0, the formula is equivalent to a disjunction and it's slightly
00476     more efficient to use the clause form. Note though that there can be good
00477     reasons for using c=0, namely in cases where you later on might want to
00478     increase the constant.
00479 
00480       See vallst_lessThanEqToMoreThan() for transforming a >=-formula into a
00481     <-formula.
00482 */
00483 #define VallstFormulaType_moreThan        (VallstLiteral_MAX-6)
00484 
00485 /*!\v
00486     For formulas p\/a where a is of more-than type.
00487       With this type you can Tseitin name more-than formulas without using
00488     more-than-mult: Let a be c < q0 + .. + qn. Then p <=> a is equivalent to
00489     -p \/ a and p \/ -a where -a can be expressed as n-c < -q0 + ... + -qn.
00490       Having more-than-dis means that the more-than type isn't strictly
00491     necessary. However, using more-than rather than more-than-dis when
00492     possible is a little bit more efficient and transparent.
00493       Note that if you are looking for a p \/ /\{q0,...,qn} formula type
00494     you can use more-than-dis with c=n, i.e. p \/ n<q0+...+qn.\w
00495 */
00496 #define VallstFormulaType_moreThanDis     (VallstLiteral_MAX-7)
00497 
00498 /*! Arbitrary long constraint on the form c < d0*p0 + d1*p1 + ... where c and
00499     di are constants.
00500 
00501       A Tseitin name p for a more-than-mult formula a = c < +{di*pi} can be
00502     defined like this: q \/ a <=> c < +{di*pi} + (c+1)*q. Also,
00503     +{di} = +{di*pi} + +{di*-pi}. Hence, -a <=> c >= +{di*pi} <=>
00504     c >= +{di} - +{di*-pi} <=> +{di*-pi} >= +{di} - c <=>
00505     +{di}-c-1 < +{di*-pi}. Therefor p <=> a can be expressed by translating
00506     -p \/ a and p \/ -a. See vallst_lessThanEqMultToMoreThanMult() for
00507     transforming a >=*-formula into a <*-formula.
00508 
00509       Negative constants are not allowed. You can transform negative literal
00510     constants like this:  c < ... + -d*p + ...  <=>  c+d < ... + d*-p + ...
00511 
00512       If the formula is very long you might want to input d0, d1,... in
00513     increasing order since internally they will be sorted that way using an
00514     algorithm which is fast on already increasing formulas but which might be
00515     slow on non-increasing formulas.
00516 
00517       Excessive variable constants, as in e.g. 3 < 9*p + 7*q + 5*r + ..., are
00518     allowed and could be useful if you plan on incrementing the main constant,
00519     3, later on (see vallst_addNamedAxiom() and axiom altering functions).
00520     Though, rather than using excessive constants you might want to use
00521     vallst_alterAxiomIncMTMKeepAboves() instead.
00522     
00523 */
00524 #define VallstFormulaType_moreThanMult    (VallstLiteral_MAX-8)
00525 
00526 
00527 /*! \a0
00528     The meaning of the global axiom type VallstFormulaType_ggcdiTour is
00529     that any solution interpreted as nodes and edges in a complete directed
00530     irreflexive graph, assuming a canonical coding, must be a tour (i.e. a
00531     Hamiltonian cycle (visiting every node in the graph)).
00532 
00533       This formula type only covers the non-local part of formulas stating
00534     that the solution is a tour. Accompanying this formula must be the
00535     concluding local part. Otherwise the meaning and behaviour of the 
00536     solver is undefined.
00537 
00538       Here is an example that will clear things up:
00539     Suppose that you have a problem involving a complete directed irreflexive
00540     graph with n nodes 0,1...n-1. n is the dimension (dim) and the graph
00541     has n*(n-1) edges. Suppose that any solution to the problem must result
00542     in a tour of the graph; confer the asymmetric traveling salesperson
00543     problem, atsp. Let the graph be coded by variables p(i,j) with i!=j,
00544     i<n and j<n. p(i,j) will be true iff the edge (i,j) in the graph will be
00545     used in the solution. Assume that in actual fact p(i,j) will be
00546     represented by vallst literals q, q+2, q+4... where q is some offset 
00547     start vallst literal, e.g. 2. q may be odd. If q is 2 then let edge
00548     (0,1) be represented by vallst variable 2, (0,2) by 4, (0,3) by 6,
00549     (1,0) by 2*((n-1)+1), (1,2) by 2*((n-1)+2), (2,0) by 2*(2*(n-1)+1)... 
00550       The local part of formulas saying that a solution must be a tour says
00551     that each node has at most 1 in-edge and 1 out-edge, and at least
00552     1 in-edge and 1 out-edge:
00553 
00554         -     for all i<n,  n-3 < +{-p(i,j): j!=i, j<n}
00555         -     for all i<n,  n-3 < +{-p(j,i): j!=i, j<n}
00556         -     for all i<n,  \/{p(i,j): j!=i, j<n}
00557         -     for all i<n,  \/{p(j,i): j!=i, j<n}
00558 
00559     Then if you add a non-local tour axiom with vallst literal start q
00560     and with dimension n, you are ensured that any solution is a tour.
00561     The call to vallst_addAxiom() would be
00562     vallst_addAxiom( vi, [q,n], 2, VallstFormulaType_ggcdiTour ).
00563 
00564     As said, the tour type assumes the canonical coding of the graph
00565     described above. For a further definition of the canonical coding and
00566     utilities, see the macros vallst_ggcditEdgeToLit() and
00567     vallst_ggcditLitToEdge() (where dim is n above).
00568 */
00569 #define VallstFormulaType_ggcdiTour       (VallstLiteral_MAX-9)
00570 
00571 
00572 /*! Marks that the formula has been erased. 
00573 
00574       Although you can't use this type directly, you might still encounter
00575     this type because formulas can be erased by vallst. Say e.g. that you have
00576     named an axiom b which later gets erased by vallst (e.g. because it's
00577     simplified away or recognized to be subsumed). Then you have a name of an
00578     erased axiom and if you e.g. call vallst_formulaType() with the name you
00579     will get VallstFormulaType_erased back.
00580 */
00581 #define VallstFormulaType_erased          (VallstLiteral_MAX-10)
00582 
00583 /*\}*/ //\}
00584 
00585 
00586 
00587 //! A result type used for callback functions.
00588 typedef enum
00589 {
00590     VallstCallbackResult_continue,   //!< Continue as normal.
00591     VallstCallbackResult_interupt,   //!< Interupt and possibly save what has 
00592                                      //!  been achieved so far.
00593     VallstCallbackResult_otherIntMax = INT_MAX
00594 
00595 } VallstCallbackResult;
00596 
00597 
00598 
00599 //! Each bit in a verbosity vector decides if some particular info should be
00600 //! printed when appropriate. See \r2 below for what each bit means.
00601 typedef uint64_t VallstVerbosityVector;
00602 
00603 /*!\m Masks for the verbosity vector */
00604 /*\{*/ /*!\o*/ //\{
00605 
00606 //! Warns when space dependent on the number of variables needs to be extended.
00607 #define VallstVerbosity_varExtensionWarning ( (VallstVerbosityVector)1 << 0 )
00608 
00609 //! Warns when an empty (i.e. false) clause is added. Also warns about e.g.
00610 //! -<->{} I think. Not sure if every case that one wants to catch is caught.
00611 #define VallstVerbosity_emptyClauseWarning  ( (VallstVerbosityVector)1 << 1 )
00612 
00613 //! Gives you notice if you miss to oversee the allocation of the theory
00614 //! memory so that vallst will have to do it for you.
00615 #define VallstVerbosity_theoryMemNotice     ( (VallstVerbosityVector)1 << 2 )
00616 
00617 //! Prints info about a search when it's finished.
00618 #define VallstVerbosity_searchDetails       ( (VallstVerbosityVector)1 << 3 )
00619 
00620 //! Prints any model found.
00621 #define VallstVerbosity_printModel          ( (VallstVerbosityVector)1 << 4 )
00622 
00623 //! Prints parse error messages.
00624 #define VallstVerbosity_parseError          ( (VallstVerbosityVector)1 << 5 )
00625 
00626 //! Prints messages about other errors that the program will recover from and
00627 //! then continue.
00628 #define VallstVerbosity_lesserError         ( (VallstVerbosityVector)1 << 6 )
00629 
00630 //! Prints a brief notice of the result of the proof search.
00631 #define VallstVerbosity_printResult         ( (VallstVerbosityVector)1 << 7 )
00632 
00633 //! Prints info about how many variables are set and unchecked.
00634 #define VallstVerbosity_varsSet             ( (VallstVerbosityVector)1 << 8 )
00635 
00636 //! Prints the seed.
00637 #define VallstVerbosity_printSeed           ( (VallstVerbosityVector)1 << 9 )
00638 
00639 //! Prints the cpu time used.
00640 #define VallstVerbosity_time                ( (VallstVerbosityVector)1 << 10 )
00641 
00642 //! Prints some, easily obtainable, info about the hash-table.
00643 #define VallstVerbosity_hashInfo            ( (VallstVerbosityVector)1 << 11 )
00644 
00645 //! Prints option settings.
00646 #define VallstVerbosity_printSettings       ( (VallstVerbosityVector)1 << 12 )
00647 
00648 //! Prints hindsighted prologue values. See \ref vallst.c for an example.
00649 #define VallstVerbosity_printPrologues      ( (VallstVerbosityVector)1 << 13 )
00650 
00651 //! Prints estimated prologue values. See \ref vallst.c for an example.
00652 #define VallstVerbosity_printEstimatedPrologues  \
00653                                             ( (VallstVerbosityVector)1 << 14 )
00654 
00655 //! Gives notice when clauses are converted to an equivalence.
00656 #define VallstVerbosity_equConversionNotice ( (VallstVerbosityVector)1 << 15 )
00657 
00658 //! Prints info about non-axioms.
00659 #define VallstVerbosity_nonAxInfo           ( (VallstVerbosityVector)1 << 16 )
00660 
00661 //! Prints info about optimization parts of a problem.
00662 #define VallstVerbosity_optimizeInfo        ( (VallstVerbosityVector)1 << 17 )
00663 
00664 //! Gives notice when an already existing clause is added.
00665 #define VallstVerbosity_redundancyNotice    ( (VallstVerbosityVector)1 << 18 )
00666 
00667 //! Prints message about failure to double the hash table size. The program
00668 //! will recover from this error and then continue.
00669 #define VallstVerbosity_lesserHashError     ( (VallstVerbosityVector)1 << 19 )
00670 
00671 
00672 //! Prints progress info during the simplification process.
00673 #define VallstVerbosity_simpProgressDetails ( (VallstVerbosityVector)1 << 22 )
00674 
00675 //! Gives notice when a proof improvement attempt failed to prove false.
00676 #define VallstVerbosity_failedProofImprovementNotice  \
00677                                             ( (VallstVerbosityVector)1 << 23 )
00678 
00679 //! Prints info about proof improvements during search as they happen.
00680 #define VallstVerbosity_proofImprovementDetails  \
00681                                             ( (VallstVerbosityVector)1 << 24 )
00682 
00683 //! Prints detailed info about a the hash-table during consistency checks.
00684 #define VallstVerbosity_hashDetails         ( (VallstVerbosityVector)1 << 25 )
00685 
00686 //! Prints info about restarts during the search as they occur.
00687 #define VallstVerbosity_restartDetails      ( (VallstVerbosityVector)1 << 26 )
00688 
00689 //! Prints detailed progress info during the search.
00690 #define VallstVerbosity_progressDetails     ( (VallstVerbosityVector)1 << 27 )
00691 
00692 //! Prints detailed info about a the search branching heuristic.
00693 #define VallstVerbosity_branchingDetails    ( (VallstVerbosityVector)1 << 28 )
00694 
00695 //! Gives notice of a midair pruning.
00696 #define VallstVerbosity_midairPruneNotice   ( (VallstVerbosityVector)1 << 29 )
00697 
00698 //! Prints various not too interesting midair pruning details.
00699 #define VallstVerbosity_midairPruneDetails  ( (VallstVerbosityVector)1 << 30 )
00700 
00701 //! Gives notice when a contradiction is found but not acted on.
00702 #define VallstVerbosity_ignoredContradictionNotice  \
00703                                             ( (VallstVerbosityVector)1 << 31 )
00704 
00705 /*\}*/ //\}
00706 
00707 
00708 
00709 //! The type for names for formulas.
00710 typedef void * VallstFormulaName;
00711 
00712 
00713 //! A dynamic array of type VallstFormulaName.
00714 typedef struct VallstFormulaNames_ VallstFormulaNames;
00715 
00716 //! A dynamic array of type VallstFormulaName.
00717 struct VallstFormulaNames_
00718 {
00719     VallstFormulaName * names;         //!< The start of the array.
00720     VallstFormulaN nrOfNames;          //!< The current number of active names.
00721     VallstFormulaN nrOfAllocatedNames; //!< The physical length of the array.
00722 
00723 };
00724 
00725 
00726 
00727 /*!\d4 Problem types */
00728 /*\{*/ /*!\n1*/ //\{
00729 
00730 //! For some general default settings.
00731 #define VallstProblemType_default 0
00732 
00733 //! Means that the type is undefined at the moment. If the undefined value
00734 //! doesn't apply and something is needed, the same settings as for
00735 //! VallstProblemType_default will be used.
00736 #define VallstProblemType_undef   1
00737 
00738 //! For asymmetric traveling salesperson problems.
00739 #define VallstProblemType_atsp    2
00740 
00741 //! For symmetric traveling salesperson problems.
00742 #define VallstProblemType_tsp     3
00743 
00744 //! For pseudo boolean, (o)pb, problems. Only meant for problems where the
00745 //! input is on (restricted) (o)pb form.
00746 #define VallstProblemType_pb      4
00747 
00748 /*\}*/ //\}
00749 
00750 
00751 
00752 /*!\j Allocation */ // -----------------------------------------------
00753 //\{
00754 
00755 
00756 // vallst_deleteInstance       -- Deletes a vallst instance.
00757 
00758 
00759 /*! Returns a new vallst problem instance. NULL is returned iff a new instance
00760     couldn't be created, which can only happen due to insufficient memory.
00761 
00762       nrOfVars is meant to be a roughly minimal upper bound for the number of
00763     variables, like in the DIMACS cnf prologue. Any value including 0 will work
00764     though and if you don't have any good guess of a roughly minimal upper
00765     bound just use any value as long as it isn't much larger than the largest
00766     variable to be used.
00767 
00768       If nrOfVars is 0, no variable space will be allocated. Using nrOfVars=0
00769     is useful for memory efficiency reasons if you at first don't know how many
00770     variables that are used. If you later learn of a roughly minimal upper
00771     bound on the variables you can call vallst_extendNrOfVars().
00772     See vallst.c for an example.
00773 
00774       nrOf3ClausesEstimate is meant to be an estimate of the number of ternary
00775     clauses. It's not important that nrOf3Clauses is exactly accurate but any
00776     fairly accurate estimate might be helpful for memory efficiency reasons.
00777 
00778       You can use nrOf3ClausesEstimate=0, and then later, before adding
00779     ternary clauses, set an estimate with vallst_setNrOf3ClausesEstimate() and
00780     propagate the value by calling vallst_propagateNrOf3ClausesEstimate().
00781     See vallst.c for an example.
00782 
00783       If you know that there will be ternary clauses but have no idea of how
00784     many, just use any value not too large, e.g. 0. The only motive behind 
00785     this number of ternary clauses estimate is to improve efficiency a little;
00786     it's not very important.
00787 
00788       nrOfLitOccsEstimate is supposed to be a possibly rough estimate of the
00789     number of literal/constant occurrences in the input theory modulo "special
00790     accounting". The special accounting works like this: Occurrences in unit
00791     formulas or binary disjunctions don't count at all; add 1 for each
00792     formula (that isn't unit or a binary disjunction); add 1 for each formula
00793     that isn't a ternary disjunction (and not unit or a binary disjunction);
00794     add 2 for each <*-formula; the count for ggcdit is exactly 4. For example,
00795     the count for c < c1*p1 + ... + cn*pn  would be 1 + 2*n + 1 + 1 + 2.
00796 
00797       It's not important that the estimate is exactly accurate but any fairly
00798     accurate estimate might be helpful for memory efficiency reasons. Try to
00799     make it an upper bound. You could also set the value to some fraction of
00800     the "correct" value. Just try not to get a too low value.
00801 
00802       You can use nrOfLitOccsEstimate = VallstFormulaN_undef, and then later,
00803     before adding formulas, set an estimate with
00804     vallst_setNrOfLitOccsEstimate() and propagate the value by calling
00805     vallst_propagateNrOfLitOccsEstimate(). See vallst.c for an example.
00806 */
00807 VallstInstance * vallst_newInstance( VallstLiteralN nrOfVars,
00808                                      VallstFormulaN nrOf3ClausesEstimate,
00809                                      VallstFormulaN nrOfLitOccsEstimate );
00810 
00811 
00812 /*! See vallst_newInstance() for a description.
00813     Returns true iff not enough memory could be allocated.
00814 
00815       Nothing is done if the nrOf3ClausesEstimate in vi is undefined, i.e.
00816     equals VallstFormulaN_undef.
00817 */
00818 bool vallst_propagateNrOf3ClausesEstimate( VallstInstance * vi );
00819 
00820 
00821 /*! See vallst_newInstance() for a description.
00822     Returns true iff not enough memory could be allocated.
00823 
00824       Nothing is done if the theory memory is already set up somehow, i.e.
00825     the theory memory isn't NULL.
00826 
00827       If the nrOfLitOccsEstimate in vi is undefined, i.e. equals
00828     VallstFormulaN_undef, nrOfLitOccsEstimate in vi will be set to some
00829     value first before propagation.
00830 
00831       If it's possible, try to set the number of variables, explicitly or
00832     implicitly, before calling this function since some heuristic size value
00833     function will use that variable value. See e.g. vallst.c.
00834 */
00835 bool vallst_propagateNrOfLitOccsEstimate( VallstInstance * vi );
00836 
00837 
00838 /*! Sets the fstNrOfLevelsAlloc size.
00839 
00840       If no smaller value can be seen to be enough, like e.g. the number of
00841     variables, this value will be used as a first allocation size of
00842     nr-of-levels dependent arrays.
00843 
00844       This value can at most only have some minor memory allocation
00845     efficiency impact.
00846 */
00847 void vallst_setFstNrOfLevelsAllocSize( VallstInstance * vi,
00848                                        VallstLiteralN size );
00849 
00850 
00851 //! Sets max load. Decides how many hash entries are allowed before resizing.
00852 //! Resizing is done when maxLoad < nrOfEntries/tableSize.
00853 void vallst_setMaxHashLoad( VallstInstance * vi, double maxLoad );
00854 
00855 
00856 //! Sets the value. It determines the size addition to the non-axiom chunk
00857 //! size relative to the size of the axiom chunks.
00858 void vallst_setNonAxChunkSizeAxDep( VallstInstance * vi, double value );
00859 
00860 //! Sets the value. It determines the size of a constant addition to the
00861 //! non-axiom chunk size.
00862 void vallst_setNonAxChunkSizeConst( VallstInstance * vi,
00863                                     VallstFormulaN value );
00864 
00865 //! Sets the value. It determines the size addition to the non-axiom chunk size
00866 //! relative to the number of variables allocated for.
00867 void vallst_setNonAxChunkSizeVarDep( VallstInstance * vi, double value );
00868 
00869 
00870 /*! Sets the number of ternary clauses estimate.
00871 
00872       It's not important that the estimate is exactly accurate but any fairly
00873     accurate estimate might be helpful for memory efficiency reasons.
00874 */
00875 void vallst_setNrOf3ClausesEstimate( VallstInstance * vi,
00876                                      VallstFormulaN pNrOf3Clauses );
00877 
00878 
00879 /*! Sets cap.
00880 
00881       Only 'cap' number of free chunks are guaranteed to be kept.
00882     The rest are freed occasionally, handing the memory back to the system.
00883 */
00884 void vallst_setNrOfFreeChunksCap( VallstInstance * vi, unsigned int cap );
00885 
00886 
00887 /*! Sets the number of literal occurrences estimate, modulo special accounting.
00888     See vallst_newInstance().
00889 
00890       It's not important that the estimate is exactly accurate but any fairly
00891     accurate estimate might be helpful for memory efficiency reasons. Try to
00892     make it an upper bound.
00893 */
00894 void vallst_setNrOfLitOccsEstimate( VallstInstance * vi,
00895                                     VallstFormulaN pNrOfLitOccs );
00896 
00897 
00898 //\}
00899 
00900 
00901 
00902 /*!\x Formulas and variables */ // -----------------------------------
00903 //\{
00904 
00905 /*! Adds an axiom. New unit clauses will be put as unchecked w.r.t bcp.
00906 
00907       Literals are represented by 2, 3, 4,... 2 is the first variable. 3 is
00908     the negation of the first variable. In general 2n is the nth variable and
00909     2n+1 is the negation of the nth variable.
00910 
00911       'size' is the size of the formula to add, i.e. the length of 'axiom'.
00912 
00913       E.g. if the formula is a ternary clause 3\/6\/8, 'size' should be 3,
00914     type should be VallstFormulaType_clause and axiom should be [3,6,8].
00915 
00916       E.g. 1 < p+q+r is represented as [1,p,q,r] (where p, q and r are numbers
00917     representing literals) and the size is 4.
00918 
00919       2 < 3*p + 2*q + r + s is represented as [2,3,p,2,q,1,r,1,s] with size 9.
00920 
00921       p \/ c<q+r+s is represented as [p,c,q,r,s] with size 5.
00922 
00923       The axiom array might be altered.
00924 
00925       VallstResult_other is returned if no other value is applicable.
00926     VallstResult_model is never returned. Neither is
00927     VallstResult_modelOfSearchAssumptions, nor
00928     VallstResult_proofOfFalseGivenSearchAssumptions.
00929 
00930       For <*-formulas a variable p is allowed to occur as many times as you
00931     like, both positively and negatively. I.e. the literal list may look like
00932     ...d*p...e*p...f*-p...g*p...h*-p...
00933 
00934       For more-than and more-than-dis formulas it's an error if a literal
00935     occurs twice with the same sign, i.e. if the literal list looks like
00936     ...p...p... or ...-p...-p... where p is a variable. ...p...-p... is allowed
00937     though.
00938 
00939       If the type is more-than-dis and the formula is p\/a, then p and -p are
00940     allowed to occur in a.
00941 
00942       Literal constants in <*-formulas may be 0, like e.g. in c < ...0*p....
00943 
00944       You may use 0 and 1 as false and true constants if you like. (This of
00945     course only works here and not for the file parser where 0 marks the end
00946     of formulas.)
00947 
00948       If you have unit-clauses to add it might be slightly more efficient to
00949     supply them first.
00950 
00951       You might want to add the more important axioms, like e.g. a conclusion
00952     if there is something like that, last. This is for efficiency reasons
00953     since some heuristics go through the axioms from the last one to the
00954     first one. There might also be some sort of sos-like strategy in use
00955     where only the last n axioms will be considered.
00956 
00957       It might be good to have strong (short) formulas before weak (long)
00958     ones. (Consider though also the above paragraph.)
00959 */
00960 VallstResult vallst_addAxiom( VallstInstance * vi,
00961                               VallstLiteral * axiom,
00962                               VallstLiteralN size,
00963                               VallstFormulaType type );
00964 
00965 
00966 /*! Adds a formula that should be a consequence of the axioms since the formula
00967     might be removed. (It's guaranteed though that formulas with less than 4(?)
00968     literals won't be removed.)
00969 
00970       The formula must be a cnf clause, otherwise VallstResult_parseError is
00971     return.
00972 
00973       Otherwise it works like vallst_addAxiom().
00974 */
00975 VallstResult vallst_addConsequence( VallstInstance * vi,
00976                                     VallstLiteral * nonAxiom,
00977                                     VallstLiteralN size,
00978                                     VallstFormulaType type );
00979 
00980 
00981 /*! Adds a named axiom.
00982 
00983       Works like vallst_addAxiom() except that a name of the axiom is placed in
00984     *namePtr for future reference. The return value might also be different,
00985     see below. If namePtr is NULL, nothing extra is done at all and
00986     vallst_addNamedAxiom() will work exactly like vallst_addAxiom().
00987 
00988       Note that even if you successfully called vallst_addNamedAxiom() creating
00989     a new axiom, the axiom might internally have been tranformed into something
00990     you might not have expected. E.g. even if you input a long more-than-dis
00991     axiom, this might be turned into a binary clause.
00992 
00993       If a new axiom b was created, and b isn't a binary disjunction, then
00994     VallstResult_other will be returned and namePtr will be updated if it isn't
00995     NULL.
00996 
00997       Important to note is that binary clauses are treated in a special way
00998     because it's not very convenient or feasible to give them names like for
00999     other formulas. Instead, if a new axiom b was created, and b is a binary
01000     disjunction, either because the input was a binary clause or the input was
01001     transformed into a binary clause internally, then when a name is requested
01002     for b, *namePtr will be assigned 'axiom' (*namePtr = axiom) and the two
01003     disjuncts in the binary clause will be placed at the first two positions,
01004     [0..1], in the *namePtr/axiom array. VallstResult_other is returned.
01005 
01006       If no axiom was created and no already existing formula was found to be
01007     equivalent to 'axiom', (e.g. because the axiom was found inconsistent
01008     and vallst_addNamedAxiom() therefor returned VallstResult_proofOfFalse),
01009     *namePtr will be assigned NULL.
01010 
01011       If no axiom was created because 'axiom' was found to already be true,
01012     *namePtr will be assigned NULL and VallstResult_other+1 will be returned.
01013 
01014       If no axiom was created but, or rather because, 'axiom' was found to be
01015     equivalent to a literal, p, *namePtr will be assigned 'axiom' (*namePtr =
01016     axiom), p will be placed in the first position ([0]) in the *namePtr/axiom
01017     array (axiom[0] = p) and VallstResult_other+2 will be returned (and p will
01018     of course be set to true).
01019 
01020       If no axiom was created because 'axiom' was found to be equivalent to an
01021     already existing axiom b, then *namePtr will be assigned 'axiom'
01022     (*namePtr = axiom) when b is a binary clause; *namePtr will be a name of b
01023     when b isn't a binary clause. The equivalent axiom b is a disjunction and
01024     the disjuncts in b are placed in the first positions, [0..k], in the
01025     *namePtr/axiom array. Also, vallst_addNamedAxiom() will return
01026     VallstResult_other+1+size where size is the number of literals in b so that
01027     e.g. VallstResult_other+1+2 will be returned when 'axiom' is found to be
01028     equivalent to a binary disjunction.
01029 
01030       Here is a summary:
01031 
01032        - VallstResult_other: new axiom created with name *namePtr.
01033                              For created bin clause p\/q, *namePtr = [p,q,...]
01034        - VallstResult_other+1: 'axiom' true;        *namePtr = NULL
01035        - VallstResult_other+2: 'axiom' <=> p;       *namePtr = [p,...]
01036        - VallstResult_other+3: 'axiom' <=> p\/q;    *namePtr = [p,q,...]
01037        - VallstResult_other+4: 'axiom' <=> b <=> p\/q\/r; *namePtr is a name of
01038                                                     b; array = [p,q,r,...]
01039 
01040     Note that in the above summary, [...] denotes the 'axiom' array provided
01041     as an argument to the function. Hence it is of a temporary nature and may
01042     very well be overwritten (by the owner of the axiom array; indeed,
01043     overwriting it is probably the natural and common thing to do eventually).
01044 
01045       As things are at the moment, no value greater than VallstResult_other+4
01046     will ever be returned; 'axiom' will not be found to be equivalent to e.g.
01047     a disjunction with 4 disjuncts.
01048 
01049       You can use vallst_formulaType() to find out the type of a formula name.
01050 
01051       Getting a name for an axiom is useful e.g. for axiom strengthening:
01052     Assume e.g. that you have got a model for a theory and want to make the
01053     theory stronger, e.g. by incrementing the constant in a more-than axiom, to
01054     see if the stronger theory has a model or not. To do that you can just call
01055     some alter-axiom function to make the theory stronger and keep everything
01056     else, including all derived consequences of the previous theory, as it is.
01057 */
01058 VallstResult vallst_addNamedAxiom( VallstInstance * vi,
01059                                    VallstLiteral * axiom,
01060                                    VallstLiteralN size,
01061                                    VallstFormulaType type,
01062                                    VallstFormulaName * namePtr );
01063 
01064 
01065 /*! Adds c to the constant in a more-than (<), more-than-mult (<*) or
01066     more-than-dis (<\/) axiom.
01067 
01068       Returns VallstResult_parseError if 'name' isn't a name of a formula of
01069     more-than* type or if the level isn't 0. VallstResult_notEnoughMemory is
01070     returned in case not enough memory could be allocated.
01071     VallstResult_proofOfFalse may also be returned. Otherwise, Vallst_other is
01072     returned.
01073 
01074       Note that only strengthening of axioms is supported. 
01075     As a consequence you can't keep Tseitin names of <*-axioms that you alter
01076     because the p\/-a part would get weaker when the constant is increased.
01077     (Intuitively, if you strengthen a and have p<->a and -p is used positively
01078     elsewhere, that would weaken the theory, which isn't supported.)
01079     (If you want to weaken/undo something you can either use search
01080     assumptions; or you can save the theory/state and then later revert back
01081     to the saved theory/state.)
01082 */
01083 VallstResult vallst_alterAxiomIncMT( VallstInstance * vi,
01084                                      VallstFormulaName name,
01085                                      VallstLiteralN c );
01086 
01087 
01088 /*! Like vallst_alterAxiomIncMT() but also adds c to any literal constant d in
01089     'name' that is greater than the current constraint constant. 'name' must
01090     be of <* type.
01091 */
01092 VallstResult vallst_alterAxiomIncMTMKeepAboves( VallstInstance * vi,
01093                                                 VallstFormulaName name,
01094                                                 VallstLiteralN c );
01095 
01096 
01097 /*! Extends the number of variables ready to be used. true is returned iff the
01098     extension failed --- which can only happen due to insufficient memory.
01099 
01100       nrOfVars is meant to be a roughly minimal upper bound for the number of
01101     variables, like in the DIMACS cnf prologue. Any value will work though and
01102     if you don't have any good guess of a roughly minimal upper bound don't use
01103     this function. This function only exists for memory efficiency purposes and
01104     you are never required to use it. If nrOfVars is less than or equal to the
01105     current value, nothing will be done.
01106 
01107       You should, for efficiency reasons, try to use this function if you have
01108     an already built theory (that you e.g. just have decided) and you now want
01109     to extend or change the theory with a known number of variables.
01110 */
01111 bool vallst_extendNrOfVars( VallstInstance * vi, VallstLiteralN nrOfVars );
01112 
01113 
01114 /*! Returns the type of the formula with name formulaName.
01115 
01116       To follow vallst_addNamedAxiom(), vallst_formulaType() will return 1,
01117     representing the true constant, if formulaName is NULL. It will return
01118     VallstFormulaType_clause if *formulaName isn't a type (refer to the
01119     vallst_addNamedAxiom() case where formulaName = axiom = [p,...] where p is
01120     a literal and not a type).
01121 */
01122 VallstFormulaType vallst_formulaType( VallstFormulaName formulaName );
01123 
01124 
01125 //! Returns the constant in a formula of type <, <\/ or <*. Returns
01126 //! VallstLiteralN_parseError if the formula is of wrong type.
01127 VallstLiteralN vallst_getConst( VallstFormulaName name );
01128 
01129 
01130 /*! Returns the full status of literal p. 0 is returned iff p is held false
01131     (i.e. -p is true). 1 is returned iff p is held true. Otherwise p is open
01132     and 2 is returned.
01133 */
01134 int vallst_getFullLitValue( VallstInstance * vi, VallstLiteral p );
01135 
01136 
01137 //! Returns the keep-aboves flag. If true, constant-aboves will be kept aboves
01138 //! e.g. in vallst standalone if constraint constants are to be increased.
01139 //! See vallst_alterAxiomIncMTMKeepAboves() and vallst.c.
01140 bool vallst_getKeepAboves( VallstInstance * vi );
01141 
01142 
01143 /*! Returns the status of literal p. true is returned iff p is held true.
01144     Otherwise false is returned.
01145 */
01146 bool vallst_getLitValue( VallstInstance * vi, VallstLiteral p );
01147 
01148 
01149 //! Returns the number of variables that has been allocated for.
01150 VallstLiteralN vallst_getNrOfVarsAllocated( VallstInstance * vi );
01151 
01152 
01153 /*! Returns the sum of the literal constants in a more-than-mult (<*) formula.
01154     Takes constant time. Returns VallstLiteralN_parseError if the formula is
01155     of the wrong type.
01156 */
01157 VallstLiteralN vallst_getTotalSum( VallstFormulaName name );
01158 
01159 
01160 //! Returns true iff name is a constraint (i.e. of type <, <* or <\/).
01161 //! If name is NULL, false will be returned.
01162 bool vallst_isConstraint( VallstFormulaName name );
01163 
01164 
01165 /*! Tranforms a >=*-formula into a <*-formula using
01166     c >= +{di*pi} <=> +{di}-c-1 < +{di*-pi}.
01167 
01168       For example, [3,2,p,3,q,1,r] (size=7) with type >=*, representing
01169     3 >= 2p+3q+1r, is transformed into the equivalent [2,2,-p,3,-q,1,-r] with
01170     type <*, representing 2 < 2*'-p'+3*'-q'+1*'-r', where p, q,... are numbers.
01171 
01172       Returns true iff +{di}-c-1 < 0, i.e. c >= +{di}, in which case a isn't
01173     altered. I.e. if true is returned, the formula a is a tautology and can
01174     be ignored.
01175 */
01176 bool vallst_lessThanEqMultToMoreThanMult( VallstLiteral * a,
01177                                           VallstLiteralN size );
01178 
01179 
01180 /*! Tranforms a >=-formula into a <-formula using
01181     c >= p1+...+pn <=> n-c-1 < +{-pi}.
01182 
01183       For example, [2,p,q,r] (size=4) with type >=, representing 2 >= p+q+r,
01184     is transformed into the equivalent [0,-p,-q,-r] with type <, representing
01185     0 < '-p'+'-q'+'-r', where p, q,... are numbers.
01186 
01187       Returns true iff n-c-1 < 0, i.e. c >= n, in which case a isn't altered.
01188     I.e. if true is returned, the formula a is a tautology and can be ignored.
01189 */
01190 bool vallst_lessThanEqToMoreThan( VallstLiteral * a,
01191                                   VallstLiteralN size );
01192 
01193 
01194 //! Returns -p, i.e. the negation of the literal p.
01195 VallstLiteral vallst_neg( VallstLiteral p );
01196 
01197 
01198 
01199 /*
01200   vallst_newVar               -- Returns a new variable ready to be used.
01201 */
01202 
01203 
01204 
01205 //! Sets flag. If true, constant-aboves will be kept aboves
01206 //! e.g. in vallst standalone if constraint constants are to be increased.
01207 //! See vallst_alterAxiomIncMTMKeepAboves() and \ref vallst.c.
01208 void vallst_setKeepAboves( VallstInstance * vi, bool b );
01209 
01210 
01211 /*! Sets the main constant for an (a)tsp. This value will be used when the
01212     formula is parsed and nowhere else. The edge sum formula will be
01213     (min) c >= d0*p0 + ... + dn*pn. Any value larger than or equal to the
01214     total sum s = d0+...+dn will reduce to s-1.
01215 */
01216 void vallst_setStartConst( VallstInstance * vi, VallstLiteralN c );
01217 
01218 
01219 /*! Evaluates the summation side in a more-than* formula given the current
01220     state. Open literals will count as true. Returns the sum. Returns
01221     VallstLiteralN_parseError if the formula isn't a more-than* formula.
01222 
01223       See vallst_sumTrue() for the intended use.
01224 */
01225 VallstLiteralN 
01226 vallst_sumOpenTrue( VallstInstance * vi, VallstFormulaName name );
01227 
01228 
01229 /*! Evaluates the summation side in a more-than* formula given the current
01230     state. Open literals will count as false. Returns the sum. Returns
01231     VallstLiteralN_parseError if the formula isn't a more-than* formula.
01232 
01233       The intended use of this function is like this: Assume that you have
01234     found a model to a problem which contains constraint formulas
01235     a_k := c_k < +{d_i*p_i}. Then you can call this function for all a_k to
01236     know of a lower bound of how high you can raise the c_k constants and still
01237     have a model. Then you can carry out the increase of the constants ---
01238     possible after that you have moved up to level 0 --- and then maybe
01239     strengthen the theory further to see if the constants found were optimal.
01240     (See the various axiom altering functions on how to increase constants in
01241     constraints.)
01242 
01243       Since open variables can be interpreted either way you can use 
01244     vallst_sumOpenTrue() instead if you know that the variables in the formulas
01245     you are interested in are disjoint. If the variables aren't disjoint, some
01246     caution is of course needed. Assume e.g. a_0 := c_0 < ...d_j*p_j... and
01247     a_1 := c_m < ...d_k*-p_j... where p_j is open. Then you can't of course
01248     count both p_j and -p_j as true. But you can always use
01249     vallst_sumOpenTrue() on at least one formula a_i.
01250 */
01251 VallstLiteralN vallst_sumTrue( VallstInstance * vi, VallstFormulaName name );
01252 
01253 
01254 //\}
01255 
01256 
01257 
01258 /*!\h Search */ // ---------------------------------------------------
01259 //\{
01260 
01261 /*! Returns value.
01262 
01263       Search will be aborted after this many new variables have been set, to
01264     a truth value or to an other equ class. (Aborted that is provided that
01265     enough time has passed. See vallst_getNoAbortTime().) Search will also
01266     be aborted if fewer vars are set but more time has passed.
01267 */
01268 VallstLiteralN vallst_getAbortThreshold( VallstInstance * vi );
01269 
01270 
01271 //! Returns the current search level.
01272 VallstLiteralN vallst_getLevel( VallstInstance * vi );
01273 
01274 
01275 /*! Returns limit.
01276 
01277       Given that enough vars are set, search will not abort until no-abort-time
01278     seconds have passed. See vallst_getAbortThreshold().
01279 */
01280 unsigned int vallst_getNoAbortTime( VallstInstance * vi );
01281 
01282 
01283 /*! Makes all search assumptions into onetime search suggestions. Used for
01284     suggesting a model/state.
01285 
01286       Suggestions will be chosen as assumptions at the lowest levels in a
01287     search. The suggestions will be emptied/reset as soon as one literal
01288     suggestion is false.
01289 
01290       Search assumptions take precedence over search suggestions.
01291 
01292       Returns true iff not enough memory could be allocated.
01293 
01294       Any previous suggestions will be emptied/reset.
01295 */
01296 bool vallst_makeCurrentAssumptionsSuggestions( VallstInstance * vi );
01297 
01298 
01299 /*! Makes a search assumption that will affect vallst_search().
01300 
01301       If p is already true, VallstResult_other is returned.
01302 
01303       If p is already false, VallstResult_proofOfFalseGivenSearchAssumptions is
01304     returned.
01305 
01306       If not enough memory could be allocated, VallstResult_notEnoughMemory is
01307     returned.
01308 
01309       Otherwise VallstResult_other+1 is returned.
01310 
01311       If p is already true or false, a call to vallst_makeSearchAssumption()
01312     will have no effect.
01313 */
01314 VallstResult vallst_makeSearchAssumption( VallstInstance * vi,
01315                                           VallstLiteral p );
01316 
01317 
01318 /*! Moves the current search state to level 0.
01319 
01320       Also resets the buffers if the level isn't 0 already.
01321 */
01322 void vallst_moveToLevel0( VallstInstance * vi );
01323 
01324 
01325 //! Removes all search assumptions.
01326 void vallst_removeAssumptions( VallstInstance * vi );
01327 
01328 //! Removes the last search assumption.
01329 void vallst_removeLastAssumption( VallstInstance * vi );
01330 
01331 
01332 /*! Searches for a proof of false or a model. Returns the result of the search.
01333 
01334       VallstResult_other will be returned if the level isn't 0.
01335 
01336       If there are search assumptions,
01337     VallstResult_proofOfFalseGivenSearchAssumptions and
01338     VallstResult_modelOfSearchAssumptions may be returned. If it's determined
01339     that there is no model where the extra search assumptions are true as well
01340     as the axioms, VallstResult_proofOfFalseGivenSearchAssumptions is returned,
01341     except that if a proof of false was found not using the extra search
01342     assumptions, VallstResult_proofOfFalse will be returned rather than
01343     VallstResult_proofOfFalseGivenSearchAssumptions. Note also that 
01344     VallstResult_model may be returned instead
01345     VallstResult_proofOfFalseGivenSearchAssumptions if it's proved that there
01346     is no model satisfying the extra search assumptions but a model to the
01347     axioms was in fact found.
01348 */
01349 VallstResult vallst_search( VallstInstance * vi );
01350 
01351 
01352 /*! Sets value.
01353 
01354       Search will be aborted after this many new variables have been set, to
01355     a truth value or to an other equ class. (Aborted that is provided that
01356     enough time has passed. See vallst_getNoAbortTime().) Search will also
01357     be aborted if fewer vars are set but more time has passed.
01358 */
01359 void vallst_setAbortThreshold( VallstInstance * vi, VallstLiteralN n );
01360 
01361 
01362 /*! Sets the frequency.
01363 
01364       The buffers will be emptied every bufferResetFrequency-th time the
01365     search is restarted. You might want to synchronize this value with
01366     metaPruneFrequency and perhaps with metaMetaPruneFrequency too
01367     so that metaPruneFrequency is a multiple of bufferResetFrequency and
01368     metaMetaPruneFrequency is a multiple of metaPruneFrequency.
01369 */
01370 void vallst_setBufferResetFrequency( VallstInstance * vi,
01371                                      VallstFormulaN freq );
01372 
01373 
01374 //! Sets the value. It determines the size of a constant addition to the
01375 //! buffer size.
01376 void vallst_setBufferSizeConst( VallstInstance * vi, VallstFormulaN value );
01377 
01378 //! Sets the value. It determines the size addition to the buffer size 
01379 //! relative to the size of some non-axiom chunk.
01380 void vallst_setBufferSizeNonAxDep( VallstInstance * vi, double value );
01381 
01382 //! Sets the value. It determines the size addition to the buffer size 
01383 //! relative to the number of variables allocated for.
01384 void vallst_setBufferSizeVarDep( VallstInstance * vi, double value );
01385 
01386 
01387 /*! Sets the proof improvement leeway.
01388 
01389       Conflict clause size ccSize1 is considered as good as ccSize2 if
01390     ccSize1/ccSize2 <= ccLeeway. Used when the 1-uips are the same. Should
01391     probably be 1.0 or slightly greater.
01392 */
01393 void vallst_setCCLeeway( VallstInstance * vi, double ccLeeway );
01394 
01395 
01396 /*! Sets the create-phantom-conflict-clauses flag. Conflict clauses will be
01397     marked as deleted iff createPhantomConflictClauses is true and they aren't
01398     short. False by default.
01399 
01400       If you change this flag from false to true after a search has been made
01401     the buffers will also reset.
01402 
01403       This flag, if set to true, might interact with the improveProofLevel
01404     and keepConflictClauseLengthThreshold options to affect proof improvement
01405     in a perhaps subtle way. See the note on vallst_setImproveProofLevel().
01406 */
01407 void vallst_setCreatePhantomConflictClauses( VallstInstance * vi, bool b );
01408 
01409 
01410 /*! Sets the base/initial restart size. Typically used as the initial number of
01411     end nodes until the first restart is made. Restarts may be postponed for
01412     other reasons during the search batch. The value is supposed to be the
01413     least size that is sensible to have as a search batch size and is used as
01414     a base for restart strategies.
01415 
01416       If the Luby-Sinclair-Zuckerman restart strategy is used, all batch sizes
01417     will be multiples of this value. See vallst_setRestartPredefFunc().
01418 */
01419 void vallst_setFirstRestart( VallstInstance * vi, VallstFormulaN n );
01420 
01421 
01422 /*! Sets what's to be considered good.
01423 
01424       Clause sizes <= goodClauseSize are considered good. If a conflict
01425     clause size is good the next restart will be postponed.
01426 */
01427 void vallst_setGoodClauseSize( VallstInstance * vi, VallstFormulaN size );
01428 
01429 
01430 /*! Sets what's to be considered good.
01431 
01432       Levels <= goodLevel are considered good. If the search backtracks to
01433     a good level the next restart will be postponed.
01434 */
01435 void vallst_setGoodLevel( VallstInstance * vi, VallstFormulaN size );
01436 
01437 
01438 //! Sets how many axioms, starting from the last one, that should be checked
01439 //! to see if they are open, in some branching heuristics. Binary clauses
01440 //! don't count!
01441 void vallst_setHeurAxSize( VallstInstance * vi, VallstFormulaN size );
01442 
01443 
01444 /*! Sets the level threshold.
01445 
01446       The solver will try to improve proofs if the current level is less
01447     than improveProofLevel. Hence, setting it to 0 will turn off proof
01448     improvements.
01449 
01450       There are situations where the algorithm won't make an effort to
01451     improve proofs even if the level is less than improveProofLevel.
01452 
01453       Note that trying to improve proofs while createPhantomConflictClauses is
01454     true might give rise to a situation where the prover during a proof
01455     improvement attempt can't re-prove what it just proved:
01456     Let |-0 stand for closure under bcp. Assume that improveProofLevel is large
01457     enough and keepConflictClauseLengthThreshold is small enough. Assume that
01458     ...+p+q+r|-0 0, where 0 stands for a contradiction. Then ...+p+q proves -r
01459     with reason c_r and say that c_r is a phantom clause. Assume that
01460     ...+p+q+-r|-0 0. Then ...+p|- -q but this proof depends on c_r and it's not
01461     necessarily the case that we now have ...+p+q|-0 0. In this situation,
01462     i.e. when the proof improvement attempt fails to even find a proof of
01463     false, the proof path is aborted and the state is reverted back to the
01464     first proof before proof improvement was last attempted.
01465       Hence, if you want to try to improve proofs while creating phantom
01466     conflict clauses, you still might want to lower the improve-proof-level
01467     in order to get the proof improvement to work more effectively. Ideally
01468     one might want to somehow synchronize improveProofLevel and
01469     vallst_setKeepConflictClauseLengthThreshold().
01470 */
01471 void vallst_setImproveProofLevel( VallstInstance * vi, VallstLiteralN lvl );
01472 
01473 
01474 
01475 /*! Sets the keep-conflict-clause-length meta meta threshold.
01476 
01477       keepCCMetaMetaThreshold functions as a lower bound for various
01478     non-axiom pruning thresholds. Non-axioms of size less than or equal to
01479     keepCCMetaMetaThreshold will be kept.
01480 
01481       The intended use is to have:
01482 
01483      -   keepCCMetaMetaThreshold <= metaPruneStart <= metaPruneEnd
01484      -   keepCCMetaMetaThreshold <= metaMetaPruneStart <= metaMetaPruneEnd
01485      -   metaMetaPruneStart <= metaPruneStart
01486      -   metaMetaPruneEnd <= metaPruneEnd
01487      -   keepCCMetaMetaThreshold <= tightMetaPruneStart <= tightMetaPruneEnd
01488      -   keepCCMetaMetaThreshold <= tightMetaMetaPruneStart <=
01489          tightMetaMetaPruneEnd
01490      -   tightMetaMetaPruneStart <= tightMetaPruneStart
01491      -   tightMetaMetaPruneEnd <= tightMetaPruneEnd
01492 
01493       Furthermore, the tight thresholds are intended to be less than or equal
01494     to the loose ones (where it makes sense):
01495 
01496      -   tightMetaPruneStart <= metaPruneStart
01497      -   tightMetaMetaPruneStart <= metaMetaPruneStart
01498      -   tightMetaMetaPruneEnd <= metaMetaPruneEnd
01499      -   tightKeepCCThreshold <= keepConflictClauseLengthThreshold
01500      -   tightTheorySizeLeeway <= looseTheorySizeLeeway
01501 
01502       It is also the intention that the below meta-meta, meta, object relations
01503     hold:
01504      -   tightTheorySizeLeeway <= tightTheoryMetaSizeLeeway <=
01505          tightTheorySizeLeewayKeep
01506      -   looseTheorySizeLeeway <= looseTheoryMetaSizeLeeway <=
01507          looseTheorySizeLeewayKeep
01508 */
01509 void vallst_setKeepCCMetaMetaThreshold( VallstInstance * vi,
01510                                         VallstLiteralN threshold );
01511 
01512 
01513 /*! Sets the keep-conflict-clause-length threshold.
01514 
01515       Conflict clauses less than or equal to keepConflictClauseLengthThreshold
01516     will be fully added even if the createPhantomConflictClauses flag is 
01517     true.
01518 
01519       Also, when using conflict clause buffers, if the conflict clause is
01520     less than or equal to keepConflictClauseLengthThreshold the clause
01521     will be added, to the non-axioms, as a proper first class clause.
01522     Note though that a doppelganger may be created too.
01523 
01524       A threshold of less than 2 will have the same effects as a threshold of
01525     2. Therefore any value lower than 2 will be raised to 2.
01526 
01527       This flag might interact with the improveProofLevel and
01528     createPhantomConflictClauses options, if the latter is set to true, to
01529     affect proof improvement in a perhaps subtle way. See the note on
01530     vallst_setImproveProofLevel().
01531 
01532       The intention is to have
01533     tightKeepCCThreshold <= keepConflictClauseLengthThreshold.
01534 */
01535 void vallst_setKeepConflictClauseLengthThreshold( VallstInstance * vi,
01536                                                   VallstLiteralN threshold );
01537 
01538 
01539 /*! Sets the function defining the strength of literal pairs (p,-p) given
01540     the strength of the literals p and -p.
01541 
01542       The litPairStrFunc function should return a measure of the combined
01543     strength of p and -p given the individual strength of p and -p.
01544     varStrPtr[0] will be the strength of the unnegated variable (p),
01545     varStrPtr[1] will be the strength of the   negated variable (-p).
01546 
01547       The default function looks something like this:\v
01548         static Strength litPairStrF( Strength * varStrPtr )
01549         {
01550             return varStrPtr[0] * varStrPtr[1];
01551         } \w
01552 
01553       Unfortunately, because the Strength type isn't (for various reasons) part
01554     of the interface/library, you have to provide two versions of the function:
01555         1) a version with type      double as the Strength type,
01556         2) a version with type long double as the Strength type.
01557 */
01558 void vallst_setLitPairStrFunc
01559                  ( VallstInstance * vi,
01560                    double (*litPairStrFunc)( double * varStrPtr ),
01561                    long double (*litPairStrFuncl)( long double * varStrPtr ) );
01562 
01563 
01564 
01565 /*! Sets meta meta leeway.
01566 
01567       The nr of non-axioms is allowed to grow in loose mode to at most
01568     nrOf(non-erased)Axioms * looseTheorySizeLeeway before relevant parameters
01569     are tightened in order to bring the size of the theory back down again.
01570     Used after meta meta pruning.
01571 
01572       The intention is to have tightTheorySizeLeeway <= looseTheorySizeLeeway.
01573     See also vallst_setKeepCCMetaMetaThreshold().
01574 */
01575 void vallst_setLooseTheorySizeLeeway( VallstInstance * vi, double leeway );
01576 
01577 
01578 /*! Sets value.
01579 
01580       Given that enough vars are set, search will not abort until secs
01581     seconds have passed. See vallst_getAbortThreshold().
01582 */
01583 void vallst_setNoAbortTime( VallstInstance * vi, unsigned int secs );
01584 
01585 
01586 /*! Sets meta meta leeway.
01587 
01588       The nr of non-axioms is allowed to grow in tight mode to at most
01589     nrOf(non-erased)Axioms * tightTheorySizeLeeway before relevant parameters
01590     are tightened in order to bring the size of the theory back down again.
01591     Used after meta meta pruning.
01592 
01593       The intention is to have tightTheorySizeLeeway <= looseTheorySizeLeeway.
01594     See also vallst_setKeepCCMetaMetaThreshold().
01595 */
01596 void vallst_setTightTheorySizeLeeway( VallstInstance * vi, double leeway );
01597 
01598 
01599 /*! Sets meta leeway.
01600 
01601       Like vallst_setLooseTheorySizeLeeway() but used after meta pruning.
01602 
01603       The intention is to have tightTheoryMetaSizeLeeway <=
01604     looseTheoryMetaSizeLeeway.
01605 */
01606 void vallst_setLooseTheoryMetaSizeLeeway( VallstInstance * vi, double leeway );
01607 
01608 
01609 /*! Sets meta leeway.
01610 
01611       Like vallst_setTightTheorySizeLeeway() but used after meta pruning.
01612 
01613       The intention is to have tightTheoryMetaSizeLeeway <=
01614     looseTheoryMetaSizeLeeway.
01615 */
01616 void vallst_setTightTheoryMetaSizeLeeway( VallstInstance * vi, double leeway );
01617 
01618 
01619 /*! Sets leeway.
01620 
01621       Like vallst_setLooseTheorySizeLeeway() but used before meta meta pruning.
01622 
01623       The intention is to have tightTheorySizeLeewayKeep <=
01624     looseTheorySizeLeewayKeep.
01625 */
01626 void vallst_setLooseTheorySizeLeewayKeep( VallstInstance * vi, double leeway );
01627 
01628 
01629 /*! Sets leeway.
01630 
01631       Like vallst_setTightTheorySizeLeeway() but used before meta meta pruning.
01632 
01633       The intention is to have tightTheorySizeLeewayKeep <=
01634     looseTheorySizeLeewayKeep.
01635 */
01636 void vallst_setTightTheorySizeLeewayKeep( VallstInstance * vi, double leeway );
01637 
01638 
01639 
01640 /*! Sets the looseTimeLimitBase parameter to k. The heuristic mode timers will
01641     be something like
01642     looseTimeLimitBase * looseBias + nrOfRestarts * looseTimeLimitMod.
01643 */
01644 void vallst_setLooseTimeLimitBase( VallstInstance * vi, unsigned int k );
01645 
01646 /*! Sets the looseTimeLimitMod parameter to k. The heuristic mode timers will
01647     be something like
01648     looseTimeLimitBase * looseBias + nrOfRestarts * looseTimeLimitMod.
01649 */
01650 void vallst_setLooseTimeLimitMod( VallstInstance * vi, unsigned int k );
01651 
01652 /*! Sets the tightTimeLimitBase parameter to k. The heuristic mode timers will
01653     be something like
01654     tightTimeLimitBase * tightBias + nrOfRestarts * tightTimeLimitMod.
01655 */
01656 void vallst_setTightTimeLimitBase( VallstInstance * vi, unsigned int k );
01657 
01658 /*! Sets the tightTimeLimitMod parameter to k. The heuristic mode timers will
01659     be something like
01660     tightTimeLimitBase * tightBias + nrOfRestarts * tightTimeLimitMod.
01661 */
01662 void vallst_setTightTimeLimitMod( VallstInstance * vi, unsigned int k );
01663 
01664 
01665 /*! Sets the value.
01666 
01667       The value determines the maximal number of times the simplify call
01668     during search can be skipped (because the theory didn't become sufficently
01669     much stronger from the last time simplification was made).
01670 */
01671 void vallst_setMaxSkippedSimps( VallstInstance * vi, VallstFormulaN size );
01672 
01673 
01674 /*! Sets the value.
01675 
01676       These start and end values determine which clauses are kept during
01677     pruning. A clause is kept iff it's on or below the line starting at the
01678     start value and ending at the end value. The actual end point used will be
01679     the minimum of meta(Meta)PruneEnd and (tight) keep-cc-length-threshold.
01680 
01681       The idea is to keep the meta meta pruning more restrictive and rarer
01682     than the meta pruning although that's not required.
01683 
01684       See vallst_setKeepCCMetaMetaThreshold() for more on the intended
01685     relation between different thresholds.
01686 */
01687 void vallst_setMetaMetaPruneEnd( VallstInstance * vi, VallstLiteralN end );
01688 
01689 
01690 /*! Sets the frequency.
01691 
01692       The proper non-axioms will be meta meta pruned, using
01693     metaMetaPruneStart and metaMetaPruneEnd, every metaMetaPruneFrequency-th
01694     time the search is restarted. You might want to synchronize this value
01695     with bufferResetFrequency and perhaps also with metaPruneFrequency so
01696     that metaPruneFrequency is a multiple of bufferResetFrequency and
01697     metaMetaPruneFrequency is a multiple of metaPruneFrequency.
01698 */
01699 void vallst_setMetaMetaPruneFrequency( VallstInstance * vi,
01700                                        VallstFormulaN freq );
01701 
01702 
01703 //! Sets the value. See vallst_setMetaMetaPruneEnd().
01704 void vallst_setMetaMetaPruneStart( VallstInstance * vi, VallstLiteralN start );
01705 
01706 
01707 /*! Sets the value. See vallst_setMetaMetaPruneEnd().
01708 
01709       Not that relevant since tightKeepCCThreshold and
01710     keepConflictClauseLengthThreshold are used as endpoints instead of
01711     this metaPruneEnd value if metaPruneEnd is larger. Hence you might
01712     want to leave metaPruneEnd at the default infinite value.
01713 */
01714 void vallst_setMetaPruneEnd( VallstInstance * vi, VallstLiteralN end );
01715 
01716 
01717 /*! Sets the frequency.
01718 
01719       The proper non-axioms will be (meta) pruned, using
01720     metaPruneStart and metaPruneEnd, every metaPruneFrequency-th
01721     time the search is restarted provided that it's not time for a
01722     meta meta pruning. You might want to synchronize this 
01723     value with bufferResetFrequency and perhaps also metaMetaPruneFrequency
01724     so that metaPruneFrequency is a multiple of bufferResetFrequency and
01725     metaMetaPruneFrequency is a multiple of metaPruneFrequency.
01726 */
01727 void vallst_setMetaPruneFrequency( VallstInstance * vi,
01728                                    VallstFormulaN freq );
01729 
01730 
01731 //! Sets the value. See vallst_setMetaMetaPruneEnd().
01732 void vallst_setMetaPruneStart( VallstInstance * vi, VallstLiteralN start );
01733 
01734 
01735 /*! Sets the next-batch-size-const value.
01736 
01737       The restart batch size will possibly increase with nextBatchSizeConst,
01738     depending on the restart strategy. (The restart batch size may depend
01739     on other things too.)
01740 */
01741 void vallst_setNextBatchSizeConst( VallstInstance * vi, double value );
01742 
01743 
01744 /*! If positiveHeurAxSign is true, the sign of the branching literal will be
01745     the sign it has in the formula from where it was derived, if it is
01746     derived from an axiom in the sos-like heuristic set (i.e. if the axiom
01747     comes late) (see vallst_setHeurAxSize()).
01748 
01749       This can be useful e.g. if you don't want to set the positiveSign to
01750     true but still want the literals picked from the last axiom to be true,
01751     e.g. when solving an optimization problem with a large driving last
01752     axiom to optimize.
01753 */
01754 void vallst_setPositiveHeurAxSign( VallstInstance * vi, bool b );
01755 
01756 
01757 /*! Depending on other settings as well, if positiveSign is true, the sign
01758     of the branching literal will be the sign it has in the formula from
01759     where it was derived.
01760 */
01761 void vallst_setPositiveSign( VallstInstance * vi, bool b );
01762 
01763 
01764 
01765 // vallst_setPruningFunction   -- Sets the pruning function.
01766 
01767 
01768 
01769 /*! With prob/1000 probability the sign of the literal to branch on will be
01770     chosen randomly.
01771 
01772       (This will not affect any added search assumptions of course.)
01773 */
01774 void vallst_setRandomBranchSign( VallstInstance * vi, unsigned int prob );
01775 
01776 /*! With prob/1000 probability the open literal to branch on in a formula
01777     will be chosen randomly.
01778 */
01779 void vallst_setRandomFormulaLit( VallstInstance * vi, unsigned int prob );
01780 
01781 
01782 //! Moved temporary causes no longer active will be removed iff the
01783 //! removeTmpCauses flag is true. This flag will have no very large impact but
01784 //! left-over causes no longer active might screw up some heuristics.(???)
01785 void vallst_setRemoveTmpCauses( VallstInstance * vi, bool b );
01786 
01787 
01788 //! The flag tells whether buffers should be reset when moving up to level 0
01789 //! between searches.
01790 void vallst_setResetBuffersBetweenSearches( VallstInstance * vi, bool b );
01791 
01792 
01793 /*! Sets restart batch size function.
01794 
01795       The restart batch size function should return the next batch size,
01796     which should be greater than 0.
01797 
01798       lastSize is the last batch size. At the very first invocation of each
01799     search, the value provided will be taken to be firstRestart.
01800 
01801        nrOfRestarts is the number of restarts made so far. Is 0 at each
01802     search start.
01803 */
01804 void
01805 vallst_setRestartFunc
01806 ( VallstInstance * vi,
01807   VallstFormulaN (*restartSizeFunc)( VallstInstance * vi,
01808                                      VallstFormulaN lastSize,
01809                                      VallstFormulaN nrOfRestarts ) );
01810 
01811 
01812 /*! Sets the restart batch size function used to the fth function below:
01813 
01814         0: Luby-Sinclair-Zuckerman restart strategy (1,1,2,1,1,2,4,1,1,2,1...)
01815            with firstRestart used as a base size.
01816 
01817         1: Starting at firstRestart size, the sizes will be incremented using
01818            nextBatchSizeConst.
01819 
01820       Returns true iff f doesn't designate a legitimate function, i.e. iff f>1.
01821 
01822       To set firstRestart, see vallst_setFirstRestart().
01823 */
01824 bool vallst_setRestartPredefFunc( VallstInstance * vi, unsigned char f );
01825 
01826 
01827 /*! Sets the restart batch prolong cap.
01828 
01829       A restart batch won't be prolonged to be (much) more than the value at
01830     the start of the batch times restartProlongCap.
01831 */
01832 void vallst_setRestartProlongCap( VallstInstance * vi, double cap );
01833 
01834 
01835 /*! Sets the start phase size.
01836 
01837       A restart time strictly less than restartStart belongs to the
01838     start phase of a restart search batch which will possibly imply a
01839     different branching heuristic from the main phase.
01840 */
01841 void vallst_setRestartStart( VallstInstance * vi, VallstFormulaN size );
01842 
01843 
01844 /*! Sets flag.
01845 
01846       Decides which bcp function should be applied first. The other bcp
01847     function will then be used if a proof improvement is attempted.
01848 */
01849 void vallst_setStartWithBinFstBcp( VallstInstance * vi, bool b );
01850 
01851 
01852 /*! Will be greater than or equal to 1. Heuristic strength str is
01853     considered to be maximal iff leeway * str >= maxStr where maxStr
01854     is the real maximal strength.
01855 
01856       The Formula variant of leeway (see vallst_setStrengthLeewayFormula()
01857     below) is used for formula based heuristics. This non-formula variant is
01858     used elsewhere for absolute heuristics.
01859 */
01860 void vallst_setStrengthLeeway( VallstInstance * vi, double leeway );
01861 
01862 /*! Will be greater than or equal to 1. Heuristic strength str is
01863     considered to be maximal iff leeway * str >= maxStr where maxStr
01864     is the real maximal strength.
01865 
01866       This Formula variant of leeway is used for formula based heuristics.
01867     The non-formula variant (see vallst_setStrengthLeeway() above) is used
01868     elsewhere for absolute heuristics.
01869 */
01870 void vallst_setStrengthLeewayFormula( VallstInstance * vi, double leeway );
01871 
01872 //! Sets a hard cap of the maximal number of strengths to be considered maximal
01873 //! by the strength-leeway construction (see vallst_setStrengthLeeway()). Will
01874 //! be greater than or equal to 1.
01875 void vallst_setStrengthLeewaySize( VallstInstance * vi,
01876                                    VallstFormulaN leewaySize );
01877 
01878 //! Sets a hard cap of the maximal number of strengths to be considered maximal
01879 //! by the strength-leeway-formula construction (see
01880 //! vallst_setStrengthLeewayFormula()). Will be greater than or equal to 1.
01881 void vallst_setStrengthLeewaySizeFormula( VallstInstance * vi,
01882                                           VallstFormulaN leewaySize );
01883 
01884 //! Sets the tight proof improvement leeway. Like the normal ccLeeway but used
01885 //! when the 1-uips differ. Should probably be 1.0 or slightly greater.
01886 void vallst_setTightCCLeeway( VallstInstance * vi, double leeway );
01887 
01888 
01889 /*! Like vallst_setKeepConflictClauseLengthThreshold() but for when the
01890     search heuristic is in tight mode. The intention is to have
01891     tightKeepCCThreshold <= keepConflictClauseLengthThreshold.
01892 */
01893 void vallst_setTightKeepCCThreshold( VallstInstance * vi,
01894                                      VallstLiteralN threshold );
01895 
01896 /*! Like vallst_setMetaMetaPruneEnd() but for when the
01897     search heuristic is in tight mode.
01898 */
01899 void vallst_setTightMetaMetaPruneEnd( VallstInstance * vi,
01900                                       VallstLiteralN end );
01901 
01902 /*! Like vallst_setMetaMetaPruneStart() but for when the
01903     search heuristic is in tight mode.
01904 */
01905 void vallst_setTightMetaMetaPruneStart( VallstInstance * vi,
01906                                         VallstLiteralN start );
01907 
01908 /*! Like vallst_setMetaPruneStart() but for when the
01909     search heuristic is in tight mode.
01910 */
01911 void vallst_setTightMetaPruneStart( VallstInstance * vi,
01912                                     VallstLiteralN start );
01913 
01914 
01915 /*! Sets the useDoppelganger flag.
01916 
01917       Determines if, when the conflict clause is saved in a non-buffer as a 
01918     proper non-axiom, an extra copy phantom clause should be added to a
01919     buffer in order to preserve clause order for branching heuristics.
01920 */
01921 void vallst_setUseDoppelganger( VallstInstance * vi, bool b );
01922 
01923 
01924 //\}
01925 
01926 
01927 
01928 /*!\y Simplification */ // -------------------------------------------
01929 //\{
01930 
01931 
01932 /*
01933   vallst_compactifyVars       -- Removes gaps in the variables.
01934 */
01935 
01936 
01937 
01938 //! Returns flag. See vallst_setSubstEqus() and vallst_substEqus().
01939 bool vallst_getSubstEqus( VallstInstance * vi );
01940 
01941 
01942 
01943 /*
01944   vallst_permuteVars          -- Permute the variables moving related
01945                                  variables closer together.
01946   vallst_pruneTheory          -- Prunes the theory.
01947 */
01948 
01949 
01950 
01951 /*!\v
01952     Sets the convert-3-clauses flag. 3-clauses on the form:
01953        p \/  q \/  r
01954        p \/ -q \/ -r
01955       -p \/ -q \/  r
01956       -p \/  q \/ -r
01957     will be converted into an equivalence <->{p,q,r} iff the convert-3-clauses
01958     flag is true. p, q and r stand for literals rather than just variables and
01959     the clauses and the literals in the clauses may be permuted in any way,
01960     clauses representing an equivalence will still be detected and converted 
01961     if the 3-clause flag is true. The conversion happens at input, when the 
01962     fourth clause is added. There may be other formulas added in between the 
01963     four clauses.\w
01964 */
01965 void vallst_setConvert3ClausesIntoEqus( VallstInstance * vi, bool b );
01966 
01967 
01968 
01969 //! Sets the time limit in millisecs for fast simplification calls,
01970 //! vallst_simplify().
01971 void vallst_setSimpTimeLimitFast( VallstInstance * vi, unsigned int ms );
01972 
01973 
01974 //! Sets the time limit in millisecs for slow simplification calls,
01975 //! vallst_simplifySlow().
01976 void vallst_setSimpTimeLimitSlow( VallstInstance * vi, unsigned int ms );
01977 
01978 
01979 
01980 /*! Sets setting for the main, bcp based, simplification, vallst_simplify().
01981 
01982       'level' determines which simplification case the sublevel, nrOfVars and
01983     nrOfIterations arguments pertain to. 'level' start at 1 so having
01984     level = 0 is pointless. Having nrOfIterations = 0 will traverse once,
01985     which might very well be the best strategy.
01986 
01987       The time complexity for vallst_simplify() for a level n typically is
01988     2^n times the product of the nrOfVars values for that level, not
01989     counting iterations (nrOfIterations). Hence be mindful of the complexity
01990     explosion! However, there is a time limit in effect too. See
01991     vallst_setSimpTimeLimitFast().
01992 
01993       'sublevel' must be less than or equal to level. (Having sublevel=0 makes
01994     no sense.)
01995 
01996       Return true iff not enough memory could be allocated.
01997 
01998       The default setting for level 1 is a very large nrOfVars value, in
01999     effect infinite. The default nrOfIterations value for level 1 is 0.
02000     Other lower levels, especially level 2, might also have some default
02001     values that imply that simplification will be done on that level.
02002     Levels not covered thus far get default values like this:
02003     the default setting for nrOfIterations is 0; the default for nrOfVars
02004     is 0 if the sublevel is 1, otherwise it is 1.
02005 */
02006 bool vallst_setSimpSetting( VallstInstance * vi, VallstLiteralN level,
02007                             VallstLiteralN sublevel,
02008                             VallstLiteralN nrOfVars,
02009                             VallstLiteralN nrOfIterations );
02010 
02011 
02012 /*! Like vallst_setSimpSetting() but used for the slower and stronger
02013     vallst_simplifySlow(). See also vallst_setSimpTimeLimitSlow().
02014 */
02015 bool vallst_setSimpSettingSlow( VallstInstance * vi, VallstLiteralN level,
02016                                 VallstLiteralN sublevel,
02017                                 VallstLiteralN nrOfVars,
02018                                 VallstLiteralN nrOfIterations );
02019 
02020 
02021 /*! Simplifies the problem. BCP based.
02022 
02023       For each level k>0 and each sublevel i, 0<i<=k, in the simplification
02024     settings, the m=nrOfVars strongest variables and their negations will be
02025     assumed so that there are k nested assumptions. Then bcp will be applied
02026     and the cut inferred. This is iterated n=nrOfIterations times.
02027 
02028       See vallst_setSimpSetting() to define how much simplification is done.
02029     The default setting entails *no* simplification (for the API version; the
02030     standalone solver will do some simplifications)!
02031 
02032       VallstResult_other will be returned if no other value is applicable.
02033 
02034       VallstResult_other+1 will be returned iff the function couldn't even
02035     try to do simplifications. This can only happen if certain default
02036     compiling options are changed (in particular undefining StrHeur).
02037 
02038       Uses the simp-time-limit-fast time limit as time limit (or the overall
02039     time limit if at the time the overall time limit is smaller). See
02040     vallst_setSimpTimeLimitFast().
02041 
02042       The fast and weak version. Uses the fast
02043     simplification settings (confer vallst_setSimpSetting()) in contrast to
02044     the slow and strong vallst_simplifySlow(), which uses the slow
02045     simplification settings (confer vallst_setSimpSettingSlow()).
02046 */
02047 VallstResult vallst_simplify( VallstInstance * vi );
02048 
02049 
02050 /*! Like vallst_simplify() but slower and stronger. Uses the slow
02051     simplification settings, confer vallst_setSimpSettingSlow(), and the
02052     slow time limit, confer vallst_setSimpTimeLimitSlow().
02053 */
02054 VallstResult vallst_simplifySlow( VallstInstance * vi );
02055 
02056 
02057 /*! Sets flag. If true, then at least for standalone vallst, variables p
02058     equivalent to an equivalence a (e.g. p<->a, a:=-q<->r), will be
02059     substituted in other equivalences. (Equivalences here include xors (-<->).)
02060 */
02061 void vallst_setSubstEqus( VallstInstance * vi, bool b );
02062 
02063 
02064 /*! Variables p equivalent to an equivalence a (e.g. p<->a, a:=-q<->r), will be
02065     substituted in other equivalences. (Equivalences here include xors (-<->).)
02066 
02067       Returns 1 iff a proof of false was found; 2 iff not enough memory could
02068     be allocated; 0 otherwise.
02069 */
02070 unsigned char vallst_substEqus( VallstInstance * vi );
02071 
02072 
02073 //\}
02074 
02075 
02076 
02077 /*!\k Symmetry detection */ // ---------------------------------------
02078 //\{
02079 
02080 /*
02081   vallst_symmetrySearch       -- Searches for symmetries.
02082 */
02083 
02084 //\}
02085 
02086 
02087 
02088 /*!\g Parsing */ // --------------------------------------------------
02089 //\{
02090 
02091 
02092 //! Closes the in-theory file, if it isn't stdin. Will however *not* reset
02093 //! the in-theory file *name*. Returns true iff fclose returned an error
02094 //! (EOF). Also sets the in-theory file to NULL.
02095 bool vallst_closeInTheoryFile( VallstInstance * vi );
02096 
02097 //! Returns the in-theory file.
02098 FILE * vallst_getInTheoryFile( VallstInstance * vi );
02099 
02100 //! Returns the in-theory file name.
02101 char * vallst_getInTheoryFileName( VallstInstance * vi );
02102 
02103 //! Returns the problem type (see \r3 description above).
02104 unsigned char vallst_getProblemType( VallstInstance * vi );
02105 
02106 
02107 /*! Parses command line options. vi will be updated according to the
02108     options. argC and argV work like C's 'main' function arguments.
02109     VallstResult_other is returned if a help or version flag is encountered.
02110     VallstResult_other + 1 is returned iff no other VallstResult value is
02111     applicable, which is usually the case.
02112 
02113       You are free to free the argV memory after the call; vallst won't
02114     store and use any argV pointer.
02115 */
02116 VallstResult vallst_parseCommandLineOptions( VallstInstance * vi,
02117                                              int argC, char * * argV );
02118 
02119 
02120 /*! Reads the body of an in-theory. At invocation it's assumed that the
02121     in-theory file pointer is between the head and the body.
02122 
02123       VallstLiteralN_parseError is returned on parse error.
02124     VallstResult_notEnoughMemory might also be returned.
02125     VallstResult_other+1 is returned if the newNamePtrFunc returned an error.
02126     VallstResult_other is returned if no other value is applicable.
02127 
02128       A name of each min/max formula will be saved to a name pointer provided
02129     by newNamePtrFunc. What is stated for vallst_addNamedAxiom() relating to
02130     names also holds here. A difference though is that here, the name will be
02131     assigned NULL if it doesn't point to a vallst axiom (confer *namePtr being
02132     NULL or pointing to the provided 'axiom' array parameter in the
02133     vallst_addNamedAxiom() case). If nothing else applies, the name will be
02134     set to NULL.
02135 
02136       newNamePtrFunc should return a name pointer when called. newNamePtrFunc
02137     will be called when a name pointer is needed for giving a name to a min/max
02138     formula. The name pointer returned by newNamePtrFunc will be used to store
02139     the name of the formula to be named.
02140 
02141     newNamePtrFuncArg is a fixed pointer argument that will be supplied to
02142     newNamePtrFunc each call.
02143 
02144     If newNamePtrFunc returns NULL, the formula wont be given a name.
02145 
02146     You may set newNamePtrFunc to NULL in which case no formulas will be given
02147     names.
02148 
02149     If newNamePtrFunc sets *errorFlag to true, the parsing will be aborted and
02150     VallstResult_other+1 will be returned. *errorFlag is false by default so
02151     you don't need to set *errorFlag to false in newNamePtrFunc each time.
02152 
02153     The pNrOfVars argument is supposed to be the value returned from the
02154     preceding vallst_readInTheoryHead() call. (It's currently used only
02155     for tsp problems.)
02156 
02157     See vallst.c for an example.
02158 */
02159 VallstResult
02160 vallst_readInTheoryBody
02161 ( VallstInstance * vi, VallstLiteralN pNrOfVars,
02162   VallstFormulaName * (*newNamePtrFunc)( void * newNamePtrFuncArg,
02163                                          VallstInstance * vi,
02164                                          bool * errorFlag ),
02165   void * newNamePtrFuncArg );
02166 
02167 //\}
02168 
02169 
02170 /*!\d
02171  \v
02172     A vallst prologue, which is different from the ordinary prologue beginning
02173     with a 'p', is a line whose first non-white characters are "cv". If numbers
02174     follow the vallst prologue start, like this:
02175     "cv [<nrOf3Clauses> [<nrOfLitOccs>]]", the number <nrOf3Clauses> will be
02176     taken to be the number of ternary clauses and <nrOfLitOccs> will be taken
02177     to be the number of literal occurrences, modulo some special accounting (do
02178     a search on "special accounting"). It's not important that nrOf3Clauses is
02179     exactly accurate but any fairly accurate estimate might be helpful for
02180     memory efficiency reasons. Try to make nrOfLitOccs an upper bound.
02181       A vallst prologue must come before the ordinary 'p'-prologue.
02182       If there are many vallst prologues defining <nrOf3Clauses>, it's the last
02183     one (containing a <nrOf3Clauses> number) that counts. The same goes for
02184     <nrOfLitOccs>.\w
02185 */
02186 
02187 /*!\i*/ //\{
02188 
02189 /*!
02190     Reads the head (i.e. any optional prologue) of the in-theory file, placing
02191     the file pointer just after any optional prologue but before any character
02192     in the body (i.e. before any character in any formula definition) --- no
02193     matter what is returned except for file error i.e. when
02194     VallstLiteralN_fileError is returned.
02195 
02196       Returns the prologue's nrOfVars. If no such prologue nrOfVars can be
02197     found or vi's ignorePrologue flag is true, the maximal variable occurring
02198     in the file is returned provided that the file can be reread. If there is
02199     no prologue nrOfVars and the file can't be reread,
02200     VallstLiteralN_noPrologueNrOfVars is returned.
02201 
02202       The nrOf3Clauses and nrOfLitOccs values from the vallst prologue, see \r
02203     description above, will, if present, be read and saved in vi. If the
02204     whole file is read twice (because of reasons related to nrOfVars; see
02205     above) *and* no vallst prologue nrOf3Clauses was found and it hasn't been
02206     set before in some other way, an estimate of the number of ternary
02207     clauses will be saved in vi; and similar for nrOfLitOccs.
02208 
02209       VallstLiteralN_parseError is returned on parse error.
02210     VallstLiteralN_fileError is returned on file error.
02211 */
02212 VallstLiteralN vallst_readInTheoryHead( VallstInstance * vi );
02213 
02214 
02215 //! Sets the ignore-prologue flag. The prologue nrOfVars, in any in-theory file
02216 //! read, will be ignored, if possible, iff the ignore-prologue flag is true.
02217 void vallst_setIgnorePrologue( VallstInstance * vi, bool b );
02218 
02219 //! Sets the in-theory file.
02220 void vallst_setInTheoryFile( VallstInstance * vi, FILE * f );
02221 
02222 
02223 /*! Sets the in-theory file name. There is no need really to supply a name for
02224     the in-theory file, if there even is one, since it is only used for error
02225     messages. NULL is the default.
02226 
02227       The string will *not* be copied and the pointer (fileName) will be saved.
02228 */
02229 void vallst_setInTheoryFileName( VallstInstance * vi, char * fileName );
02230 
02231 
02232 /*! Sets flag. If true, it is assumed that pb variables are on the form
02233     <char><positive_integer>. Otherwise the variables can be any string of
02234     characters.
02235 */
02236 void vallst_setPBVarPrefixChar( VallstInstance * vi, bool b );
02237 
02238 
02239 //! Sets the problem type (see \r3 description above).
02240 void vallst_setProblemType( VallstInstance * vi, unsigned char type );
02241 
02242 
02243 /*! Sets the pb variable map file.
02244 
02245       The file will be used for any variable mapping. Used for pb problems
02246     where variables can be arbitrary character strings. The file will contain
02247     a list of string variable names. The first variable in the file is mapped
02248     to the first internal variable name (1 or 2), and so on.
02249 
02250       May also be used for holding the prefix character for pb problems if
02251     the single prefix character mode is used. See vallst_setPBVarPrefixChar().
02252 */
02253 void vallst_setVarMapFile( VallstInstance * vi, FILE * f );
02254 
02255 
02256 /*! Sets the pb variable map file name.
02257 
02258       The string will *not* be copied and the pointer (fileName) will be saved.
02259 */
02260 void vallst_setVarMapFileName( VallstInstance * vi, char * fileName );
02261 
02262 
02263 //\}
02264 
02265 
02266 
02267 /*!\d0 Printing */ // ------------------------------------------------
02268 //\{
02269 
02270 //! Closes the changing-setting file, if it isn't stdout. Will however *not*
02271 //! reset the changing-setting file *name*. Returns true iff fclose returned
02272 //! an error (EOF). Also sets the changing-setting file to NULL.
02273 bool vallst_closeChangingSettingFile( VallstInstance * vi );
02274 
02275 //! Closes the out-theory file, if it isn't stdout. Will however *not* reset
02276 //! the out-theory file *name*. Returns true iff fclose returned an error
02277 //! (EOF). Also sets the out-theory file to NULL.
02278 bool vallst_closeOutTheoryFile( VallstInstance * vi );
02279 
02280 
02281 /*! Returns the changing-setting file.
02282 
02283       If the changing setting is printed it goes to this file. See
02284     vallst_printChangingSetting().
02285 */
02286 FILE * vallst_getChangingSettingFile( VallstInstance * vi );
02287 
02288 
02289 //! Returns the changing-setting file name.
02290 char * vallst_getChangingSettingFileName( VallstInstance * vi );
02291 
02292 
02293 /*! Returns the complete-model flag determining if partial models will be
02294     printed as non-partial. See vallst_printModel().
02295 */
02296 bool vallst_getCompleteModel( VallstInstance * vi );
02297 
02298 
02299 /*! Returns the out-theory file.
02300 
02301       If the theory is printed it goes to this file. See vallst_printTheory().
02302 */
02303 FILE * vallst_getOutTheoryFile( VallstInstance * vi );
02304 
02305 
02306 //! Returns the out-theory file name.
02307 char * vallst_getOutTheoryFileName( VallstInstance * vi );
02308 
02309 
02310 /*! Returns the print-changing-setting flag.
02311 
02312       If the flag is true, the changing setting will be printed at time-out
02313     and at interupt. See vallst_printChangingSetting().
02314 */
02315 bool vallst_getPrintChangingSetting( VallstInstance * vi );
02316 
02317 
02318 /*! Returns the print-out-theory flag.
02319 
02320       If the flag is true, the theory will be printed at time-out and at
02321     interupt.
02322 */
02323 bool vallst_getPrintOutTheory( VallstInstance * vi );
02324 
02325 
02326 //! Returns the result file, to which any model is printed.
02327 FILE * vallst_getResultFile( VallstInstance * vi );
02328 
02329 //! Returns the result file name.
02330 char * vallst_getResultFileName( VallstInstance * vi );
02331 
02332 //! Returns the verbosity vector.
02333 //! See \r1 VallstVerbosityVector for what each bit means.
02334 VallstVerbosityVector vallst_getVerbosityVector( VallstInstance * vi );
02335 
02336 
02337 /*! Prints detailed info about a the hash-table, if the
02338     VallstVerbosity_hashDetails flag is set.
02339 
02340       If NDEBUG is defined, things will be printed only if forcePrint is true
02341     (and the VallstVerbosity_hashDetails flag is set).
02342 */
02343 void vallst_hashStateCheck( FILE * f, VallstInstance * vi, bool forcePrint );
02344 
02345 
02346 /*! Prints all ggcdit tours. See vallst_printGgcditTour().
02347 */
02348 bool vallst_printAllGgcditTours( FILE * f, VallstInstance * vi );
02349 
02350 
02351 /*! Prints changing settings.
02352 
02353       Will print a subset of the settings that typically change during a
02354     search. Something like this is what will be printed, on a single line
02355     without a newline character ending the line:
02356       "  --tight-meta-meta-prune-start=5  --tight-meta-meta-prune-end=7
02357          --tight-meta-prune-start=9  --tight-keep-cc-threshold=18
02358          --meta-meta-prune-start=8  --meta-meta-prune-end=12
02359          --meta-prune-start=30  --keep-conflict-clause-length-threshold=47  "
02360 
02361       The file printed to will be changing-setting-file-name. If
02362     changing-setting-file-name is NULL, the file used will be
02363     changing-setting-file. Any previous contents of the file will be
02364     discarded if changing-setting-file-name isn't NULL. See
02365     vallst_setChangingSettingFile() and vallst_setChangingSettingFileName().
02366 
02367       If changing-setting-file-name isn't NULL, that file will be assigned to
02368     changing-setting-file. If the file couldn't be opened, true is returned.
02369     Otherwise false is returned.
02370 
02371 
02372       False is returned iff the destination file couldn't be opened.
02373 */
02374 bool vallst_printChangingSetting( VallstInstance * vi );
02375 
02376 
02377 //! Prints the changing setting to file.
02378 void vallst_printChangingSettingToFile( VallstInstance * vi, FILE * file );
02379 
02380 
02381 /*! Prints estimated prologue values.
02382 
02383     See vallst.c for an example.
02384 */
02385 void vallst_printEstimatedPrologues( FILE * f,
02386                                      VallstInstance * vi,
02387                                      VallstLiteralN pNrOfVars );
02388 
02389 
02390 /*! Prints the current tour corresponding to the formula 'a', where 'a' should
02391     be of type VallstFormulaType_ggcdiTour. For example, if the current
02392     state corresponds to the tour 0->3->1->2->0, "0 3 1 2 0" will be printed.
02393 
02394       Takes linear time in the number of nodes in the graph.
02395 
02396       Returns true iff something went wrong, like e.g. if 'a' isn't of the
02397     ggcdit type or it's detected that the literals representing the graph
02398     don't correspond to a tour.
02399 
02400       Note that there is no guarantee that the current state does in fact
02401     constitute a tour and no exhaustive check of that fact will be done.
02402     The edge state is just printed as it is without any double checks.
02403     If you have a model, and everything else is as it should be, then
02404     what's printed will be a tour. But if something is askew there is no
02405     guarantee that what's printed is correct or a tour and there is no
02406     guarantee that the function returns true if there is something wrong.
02407 */
02408 bool vallst_printGgcditTour( FILE * f, VallstInstance * vi,
02409                              VallstFormulaName a );
02410 
02411 
02412 //! Prints some, easily obtainable, info about the hash-table.
02413 void vallst_printHashInfo( FILE * f, VallstInstance * vi );
02414 
02415 
02416 /*! Prints the current value of the variables to 'file'. The notation 
02417     used will be DIMACS so that e.g. if the negated variable 7 is
02418     true it will be printed as -3. Only true literals are printed.
02419 
02420       If 'file' is NULL, the default output result file will be used
02421     except when that also is NULL in which case stdout is used.
02422 
02423       Open variables, who is not in an equ-class with more than one member,
02424     will be printed (as true) if the complete-model flag is true. See
02425     vallst_setCompleteModel().
02426 
02427       Members of an open equivalence class with more than one member will be
02428     printed as having a truth value.
02429 */
02430 void vallst_printModel( FILE * file, VallstInstance * vi );
02431 
02432 
02433 //! Prints the number of unchecked variables.
02434 void vallst_printNrOfUncheckedVars( FILE * f, VallstInstance * vi );
02435 
02436 //! Prints the number of variables that have been given a truth-value.
02437 void vallst_printNrOfVarsSet(  FILE * f, VallstInstance * vi );
02438 
02439 
02440 
02441 /*
02442   vallst_printOpenTheory      -- Prints the current theory but without the
02443                                  variable history.
02444 */
02445 
02446 
02447 
02448 /*! Prints hindsighted prologue values.
02449 
02450     See vallst.c for an example.
02451 */
02452 void vallst_printPrologues( FILE * f, VallstInstance * vi );
02453 
02454 //! Prints option settings. sep is used as a separator between options and can
02455 //! e.g. be ' ' (space) or '\\n' (newline).
02456 void vallst_printSettings( FILE * f, VallstInstance * vi, char sep );
02457 
02458 
02459 /*! Prints the current theory.
02460 
02461       The file printed to will be out-theory-file-name. If out-theory-file-name
02462     is NULL, the file used will be out-theory-file. Any previous contents of
02463     the file will be discarded if out-theory-file-name isn't NULL.
02464     See vallst_setOutTheoryFile() and vallst_setOutTheoryFileName().
02465 
02466       If out-theory-file-name isn't NULL, that file will be assigned to
02467     out-theory-file. If the file couldn't be opened, true is returned.
02468     Otherwise false is returned.
02469 
02470       "max" will be augmented to the prints of constraint formulas of type <,
02471     <* and <\/ in optMax. This doesn't affect other types of formulas. If
02472     optMax is NULL, no "max" will be printed. (Note that a "max" for <\/ might
02473     not make much sense.)
02474 */
02475 bool vallst_printTheory( VallstInstance * vi, VallstFormulaNames * optMax );
02476 
02477 
02478 /*! Prints the current theory to file.
02479 
02480       "max" will be augmented to the prints of constraint formulas of type <,
02481     <* and <\/ in optMax. This doesn't affect other types of formulas. If
02482     optMax is NULL, no "max" will be printed. (Note that a "max" for <\/ might
02483     not make much sense.)
02484 */
02485 void vallst_printTheoryToFile( VallstInstance * vi, FILE * file,
02486                                VallstFormulaNames * optMax );
02487 
02488 //! Prints the cpu time used.
02489 void vallst_printTimePassed( FILE * f, VallstInstance * vi );
02490 
02491 //! Prints to f a short string corresponding to a VallstResult.
02492 void vallst_printVallstResult( FILE * f, VallstResult result );
02493 
02494 
02495 
02496 /*
02497   vallst_printVarHistory      -- Prints the variable history.
02498 */
02499 
02500 
02501 
02502 /*! Sets the changing-setting file. See vallst_printChangingSetting().
02503 */
02504 void vallst_setChangingSettingFile( VallstInstance * vi, FILE * f );
02505 
02506 //! Sets the changing-setting file name. See vallst_printChangingSetting().
02507 //! The string will *not* be copied and the pointer (fileName) will be saved.
02508 void vallst_setChangingSettingFileName( VallstInstance * vi, char * fileName );
02509 
02510 
02511 /*! Sets the complete-model flag determining if partial models will be
02512     printed as non-partial. See vallst_printModel().
02513 */
02514 void vallst_setCompleteModel( VallstInstance * vi, bool b );
02515 
02516 
02517 /*! Sets the out-theory file. See vallst_printTheory().
02518 */
02519 void vallst_setOutTheoryFile( VallstInstance * vi, FILE * f );
02520 
02521 //! Sets the out-theory file name. See vallst_printTheory().
02522 //! The string will *not* be copied and the pointer (fileName) will be saved.
02523 void vallst_setOutTheoryFileName( VallstInstance * vi, char * fileName );
02524 
02525 
02526 /*! Sets the print-changing-setting flag.
02527 
02528       If the flag is true, the changing setting will be printed at time-out
02529     and at interupt.
02530 */
02531 void vallst_setPrintChangingSetting( VallstInstance * vi, bool b );
02532 
02533 
02534 /*! Sets the print-out-theory flag.
02535 
02536       If the flag is true, the theory will be printed at time-out and at
02537     interupt.
02538 */
02539 void vallst_setPrintOutTheory( VallstInstance * vi, bool b );
02540 
02541 
02542 //! Sets the result file, to which any model is printed.
02543 void vallst_setResultFile( VallstInstance * vi, FILE * f );
02544 
02545 //! Sets the result file name. The string will *not* be copied and the pointer
02546 //! (fileName) will be saved.
02547 void vallst_setResultFileName( VallstInstance * vi, char * fileName );
02548 
02549 
02550 /*! Sets the verbosity level. 0 is quiet; only some error messages are printed.
02551     99 is maximally verbose. What this function does is to set the verbosity
02552     vector to something seemingly appropriate. If you want to fine-tune, use
02553     vallst_setVerbosityVector().
02554 */
02555 void vallst_setVerbosityLevel( VallstInstance * vi, unsigned int vl );
02556 
02557 
02558 //! Sets the verbosity vector to vv. 0 is quiet; only some error messages is
02559 //! printed. See \r1 VallstVerbosityVector for what each bit means.
02560 void vallst_setVerbosityVector( VallstInstance * vi,
02561                                 VallstVerbosityVector vv );
02562 
02563 
02564 //\}
02565 
02566 
02567 
02568 /*!\d3 Callback */ // ------------------------------------------------
02569 //\{
02570 
02571 /*! Sets the callback function. callbackArg is an argument that will be used on
02572     every call to callbackFunc. callbackFunc will be called regularly e.g. in
02573     vallst_search().
02574 
02575       The default callback function is a function that always returns
02576     VallstCallbackResult_continue. In vallst standalone the callback function
02577     is one that handles interupt signals (see vallst.c).
02578 */
02579 void
02580 vallst_setCallback( VallstInstance * vi,
02581                     VallstCallbackResult (*callbackFunc)(void * callbackArg),
02582                     void * callbackArg );
02583 
02584 
02585 //\}
02586 
02587 
02588 
02589 /*!\d1 Formula name allocation */ // ---------------------------------
02590 //\{
02591 
02592 //! Extends the name array. Returns true iff it fails.
02593 bool vallst_extendFormulaNameArray( VallstFormulaNames * names );
02594 
02595 //! Returns a new formula name array with n elements. Returns NULL if it fails.
02596 //! If n is 0, a size 1 array will be allocated.
02597 VallstFormulaNames * vallst_newFormulaNameArray( VallstFormulaN n );
02598 
02599 
02600 //\}
02601 
02602 
02603 
02604 /*!\d5 Graph coding */ // --------------------------------------------
02605 //\{
02606 
02607 /*! The intended meaning of this macro is a mapping from graph edge (i,j)
02608     to the corresponding vallst literal representing the edge.
02609 
02610     vallst_ggcditEdgeToLit defines a canonical mapping between the edges
02611     (i,j) in a complete directed irreflexive graph with dim many nodes, and
02612     vallst literals representing the edges, with i!=j, 0<=i<dim and 0<=j<dim.
02613 
02614     Here the first vallst literal representing an edge is assumed to be 2.
02615     If that's not the case but instead the coding starts with literal q,
02616     just adjust the returned values accordingly. E.g. if q=5 starts the
02617     representation, just add 3 (5-2 (q-2)) to values returned by
02618     vallst_ggcditEdgeToLit.
02619 
02620     VallstFormulaType_ggcdiTour assumes the coding defined by
02621     vallst_ggcditEdgeToLit (except possibly for some other vallst start
02622     literal q). See \ref VallstFormulaType_ggcdiTour for more.
02623 */
02624 #define vallst_ggcditEdgeToLit(i,j,dim)  \
02625     ( 2 * ( ((dim)-1) * (i) + (j) + ((j)<(i)) ) )
02626 
02627 
02628 /*! The inverse of vallst_ggcditEdgeToLit(), mapping the literals p and -p
02629     representing (i,j) to (i,j), assigning i and j. See
02630     vallst_ggcditEdgeToLit() and \ref VallstFormulaType_ggcdiTour. If e.g.
02631     your edge representation starts with q=5 instead of the default 2,
02632     subtract 2 to the representing p when calling vallst_ggcditLitToEdge
02633     (i.e. subtract q-2+"q is odd" (i.e. subtract (q-2+q%2))).
02634 */
02635 #define vallst_ggcditLitToEdge(p,dim,i,j)  \
02636 do                                         \
02637 {                                          \
02638     (j) = (p)/2 - 1;                       \
02639     (i) = (j) / ((dim)-1);                 \
02640     (j) = (j) % ((dim)-1);                 \
02641     (j) += (i) <= (j);                     \
02642 }                                          \
02643 while (0)
02644 
02645 
02646 /*! The first part of the inverse of vallst_ggcditEdgeToLit(), mapping the
02647     literals p and -p representing (i,j) to i. See vallst_ggcditEdgeToLit()
02648     and \ref VallstFormulaType_ggcdiTour.
02649 */
02650 #define vallst_ggcditLitToEdgeFst(p,dim)  ( ( (p)/2 - 1 )  /  ((dim)-1) )
02651 
02652 
02653 //\}
02654 
02655 
02656 
02657 /*!\s Optimization */ // ---------------------------------------------
02658 //\{
02659 
02660 /*! Returns the optimization strategy flag.
02661 
02662     If true, min/max formulas will be optimized in a breadth first fashion
02663     e.g. in vallst standalone. Otherwise the last min/max axiom will be the
02664     one pushed. See vallst.c.
02665 */
02666 bool vallst_getBreadthFstOptStrat( VallstInstance * vi );
02667 
02668 
02669 /*! Calculates the maximum amount the constraint constants in 'names' can be
02670     raised while still maintaining the model. The calculated max amounts
02671     will be placed in constraintIncs like this: pushedConstraintPos will
02672     correspond to constraintIncs+0; prev(pushedConstraintPos) to
02673     constraintIncs+1; ...
02674 
02675       Semi-completes the model for open literals in the constraints. The
02676     literals will all be set on one level greater than the
02677     current one. Note that that is a bit of a hack since all the literals on
02678     that level will really be assumptions and not consequences. However,
02679     since the open literals set could be very many and there shouldn't be any
02680     problem with this hack, they are collected to one level. You can undo the
02681     semi-completion by moving up one level (i.e. undoing one level,
02682     moving to a lesser level). See vallst_undoLevel().
02683 
02684       However, if no literal was set, no new level will be created. If
02685     levelCreated isn't NULL, *levelCreated will be set to true iff a new level
02686     was created; otherwise it is set to false.
02687 
02688       Returns true iff an out of memory error occurred.
02689 
02690       pushedConstraintPos must be the position of a constraint in 'names'.
02691     pushedConstraintPos will be the first position processed. Then
02692     prev(pushedConstraintPos) will be processed, and so on.
02693 
02694       The state should be a model (i.e. all axioms should be satisfied).
02695 
02696       The raise for formulas of type <\/ where the left disjunct is true will
02697     be set to 0.
02698 
02699       See vallst.c for an example.
02700 */
02701 bool vallst_maxConstraints( VallstInstance * vi,
02702                             VallstFormulaNames * names,
02703                             VallstFormulaN pushedConstraintPos,
02704                             VallstLiteralN * constraintIncs,
02705                             bool * levelCreated );
02706 
02707 
02708 /*! Sets the optimization strategy flag.
02709 
02710     If true, min/max formulas will be optimized in a breadth first fashion
02711     e.g. in vallst standalone. Otherwise the last min/max axiom will be the
02712     one pushed. See \ref vallst.c.
02713 */
02714 void vallst_setBreadthFstOptStrat( VallstInstance * vi, bool b );
02715 
02716 
02717 //\}
02718 
02719 
02720 
02721 /*!\z Seed */ // -----------------------------------------------------
02722 //\{
02723 
02724 //! Returns the seed used.
02725 unsigned int vallst_getSeed( VallstInstance * vi );
02726 
02727 
02728 /*! Sets the seed.
02729 
02730       Before you start all over on a completely new problem you might want to
02731     call this function (e.g. with seed=time(NULL)) in order to know what the
02732     seed value is for the new problem.
02733 */
02734 void vallst_setSeed( VallstInstance * vi, unsigned int seed );
02735 
02736 
02737 //\}
02738 
02739 
02740 
02741 /*!\d2 Timers */ // --------------------------------------------------
02742 //\{
02743 
02744 
02745 // The sub-time limit isn't included in the api any longer.
02746 #if 0
02747 /*! Sets the time limit in milliseconds for sub-processes. See
02748     vallst_setTimeLimitInMilliSec(). The sub-processes affected are those that 
02749     can take a lot of time: vallst_symmetrySearch(), vallst_search() and
02750     vallst_simplify().
02751 
02752       Note that all vi's time limits will decrease as time passes so if you
02753     e.g. set a time limit to 242 ms, do a vallst_search() and then want to do
02754     another vallst_search() with 242 ms time limit you will have to set the
02755     time timit again.
02756 */
02757 void vallst_setTimeLimitForSubProcInMilliSec( VallstInstance * vi,
02758                                               long long int milliSec,
02759                                               bool startFromCurrentClock );
02760 
02761 
02762 //! Sets time limit in seconds for sub-processes. See
02763 //! vallst_setTimeLimitForSubProcInMilliSec().
02764 void vallst_setTimeLimitForSubProcInSec( VallstInstance * vi,
02765                                          unsigned int sec,
02766                                          bool startFromCurrentClock );
02767 #endif
02768 
02769 
02770 /*! Sets the overall time limit in milliseconds.
02771 
02772       If startFromCurrentClock is true, the timer will start counting toward
02773     the time limit from the current clock. Otherwise the counting is from when
02774     the main program was started. With startFromCurrentClock=false the timer
02775     is only guaranteed to be accurate if vallst_setTimeLimitInMilliSec()
02776     (or vallst_setTimeLimitInSec()) was called within 35 min from when the
02777     main program was started.
02778 */
02779 void vallst_setTimeLimitInMilliSec( VallstInstance * vi,
02780                                     long long int milliSec,
02781                                     bool startFromCurrentClock );
02782 
02783 
02784 //! Sets the overall time limit in seconds. See
02785 //! vallst_setTimeLimitInMilliSec().
02786 void vallst_setTimeLimitInSec( VallstInstance * vi, unsigned int sec,
02787                                bool startFromCurrentClock );
02788 
02789 
02790 //\}
02791 
02792 
02793 
02794 // Misc:
02795 
02796 // There is only standalone support for this yet, sort of.
02797 void vallst_setNrOfVarsSetAtStartIs0( VallstInstance * vi, bool b );
02798 
02799 
02800 
02801 #ifdef __cplusplus
02802 }
02803 #endif
02804 
02805 #endif // vallstAPI_H

Copyright (C) 2004-2005 Daniel Vallstrom. See the various vallst files for license notices.

Generated on Mon Jul 18 11:34:14 2005 for Vallst by doxygen 1.4.3.