Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

Options.hpp

Go to the documentation of this file.
00001 //
00002 //  file Options.hpp
00003 //  defines Vampire options
00004 //
00005 
00006 
00007 #ifndef __options__
00008 #define __options__
00009 
00010 
00011 #include <string>
00012 
00013 #include "Output.hpp"
00014 
00015 
00016 // class ostream;
00017 
00018 class Opt {
00019  public:
00020   enum Tag {
00021     // general
00022     MODE,
00023     TAB,
00024     INPUT_FILE,
00025     RANDOM_SEED,
00026 
00027     // preprocessor options
00028     REMOVE_UNUSED_DEF,
00029     ARITY_CHECK,
00030     NO_FREE_VARS,
00031     MINISCOPE,
00032     OUTPUT_EQUALITY_INFIX,
00033     INCLUDE, // include files for TPTP
00034 
00035     // input/output options
00036     STATISTICS,
00037     PROOF,
00038     INPUT_SYNTAX,
00039     OUTPUT_SYNTAX,
00040     SILENT,
00041     SHOW_GEN,
00042     SHOW_PASSIVE,
00043     SHOW_ACTIVE,
00044     SHOW_PREPRO,
00045     SHOW_PROFILE,
00046     SHOW_INPUT,
00047     SHOW_OPTIONS,
00048     SHOW_WEIGHT_LIMIT_CHANGES,
00049 
00050     // Kernel options
00051     MAIN_ALG,
00052     SPLITTING,
00053     SPLITTING_STYLE,
00054     SPLITTING_WITH_NAMING,
00055     SELECTION,
00056     FORWARD_SUBSUMPTION,
00057     BACKWARD_SUBSUMPTION,
00058     FORWARD_SUBSUMPTION_RESOLUTION,
00059     AGE_WEIGHT_RATIO,
00060     FORWARD_DEMODULATION,
00061     BACKWARD_DEMODULATION,
00062     ORPHAN_MURDER,
00063     FD_ON_SPLITTING_BRANCHES,
00064     BD_ON_SPLITTING_BRANCHES,
00065     INHERITED_NEGATIVE_SELECTION,
00066     SOS,
00067     NONGOAL_WEIGHT_COEFFICIENT,
00068     SELECTED_EQUALITY_WEIGHT_COEFFICIENT,
00069     PARAMODULATION,
00070     ELIM_DEF,
00071     LRS_FIRST_TIME_CHECK,
00072     LRS_FIRST_MEMORY_CHECK,
00073     MAX_INFERENCE_DEPTH,
00074     TIME_LIMIT,
00075     MEMORY_LIMIT,
00076     INEQUALITY_SPLITTING,
00077     NO_INFERENCES_BETWEEN_RULES,
00078     ALLOCATION_BUFFER_SIZE,
00079     ALLOCATION_BUFFER_PRICE,
00080     MAX_ACTIVE,
00081     MAX_PASSIVE,
00082     MAX_WEIGHT,
00083     // **********************************
00084     LITERAL_COMPARISON_MODE,
00085     SYMBOL_PRECEDENCE,
00086     HEADER_PRECEDENCE_KINKY,
00087 
00088     MAX_SKOLEM,
00089     TEST_ID,
00090     TEST_NUMBER,
00091     SYMBOL_WEIGHT_BY_ARITY,
00092     TERM_WEIGHTING_SCHEME,
00093     SIMPLIFICATION_ORDERING,
00094   };
00095   
00096   Opt (Tag t,const char* nm,const char* srt) 
00097     : _tag (t), 
00098       _name (nm),
00099       _short (srt),
00100       _changed (false)
00101       {}
00102   virtual bool set (const char* val) = 0;
00109   virtual void toStream (ostream& str) const = 0;
00110   virtual bool quotes () const = 0; 
00114   const char* name () const { return _name; }
00115   bool changed () const { return _changed; }
00116   void output (ostream& str) const;
00117   void toXML (ostream& str) const;
00118   void tabulate (ostream& str) const;
00119 
00120  protected:
00121   const Tag _tag;
00122   const char* _name;
00123   const char* _short;
00124   bool _changed;
00125 }; // class Opt
00126 
00127 
00128 template <class C>
00129 class Option :
00130   public Opt {
00131  public:
00132   // constructor
00133   Option (Opt::Tag t, const C dfl, const char* name, const char* srt = 0 )
00134     : Opt (t, name, srt),
00135       _value (dfl),
00136       _default (dfl)
00137       {}
00138   virtual bool set (const char* val);
00139   virtual void toStream (ostream& str) const;
00140   virtual bool quotes () const; // whether quotes are required for Prolog output
00141   C value () const { return _value; }
00142   void value (C newVal) { _value = newVal; _changed = true; }
00143 
00144  private:
00145   C _value;
00146   const C _default;
00147 }; // class Option
00148 
00149 
00150 class Options {
00151  public:
00152   // possible values for various options
00153   enum Mode {
00154     VAMPIRE,
00155     KIF,
00156     CASC_18
00157   };
00158 
00162   enum Statistics {
00166     STATISTICS_OFF,
00170     STATISTICS_BRIEF,
00174     STATISTICS_DETAILED
00175   };
00176 
00177   enum MainAlg {
00178     LRS,
00179     OTTER,
00180     DISCOUNT
00181   };
00182 
00183   enum Splitting {
00184     SPLIT_OFF,
00185     SPLIT_PREPRO,
00186     SPLIT_ON
00187   };
00188 
00189   enum Subsumption {
00190     SUBSUMPTION_OFF,
00191     SUBSUMPTION_MULTISET,
00192     SUBSUMPTION_OPTIMIZED,
00193     SUBSUMPTION_SET
00194   };
00195 
00196   enum SplittingStyle {
00197     BLOCKING = 2,
00198     PARALLEL = 1
00199   };
00200 
00201   enum Selection {
00202     P_1 = 1,
00203     P_2 = 2,
00204     P_3 = 3,
00205     P_4 = 4,
00206     P_5 = 5,
00207     P_6 = 6,
00208     P_7 = 7,
00209     P_1002 = 1002,
00210     P_1003 = 1003,
00211     P_1004 = 1004,
00212     P_1005 = 1005,
00213     P_1006 = 1006,
00214     P_1007 = 1007,
00215     P_1008 = 1008,
00216     P_1009 = 1009,
00217     N_2 = -2,
00218     N_3 = -3,
00219     N_4 = -4,
00220     N_5 = -5,
00221     N_6 = -6,
00222     N_7 = -7,
00223     N_1005 = -1005,
00224     N_1009 = -1009
00225   };
00226 
00227   enum LiteralComparisonMode {
00228     NORMAL = 0,
00229     KINKY = 1,
00230     PREDICATE = 2
00231   };
00232 
00233   enum Demodulation {
00234     DEMODULATION_OFF = 0,
00235     DEMODULATION_PREORDERED = 1,
00236     DEMODULATION_ALL = 4
00237   };
00238 
00239   enum SymbolPrecedence {
00240     BY_OCCURRENCE = 0,
00241     BY_ARITY = 1,
00242     BY_REVERSE_ARITY = -1
00243   };
00244 
00245   enum SimplificationOrdering {
00246     KBO,
00247     KBO_NONREC
00248   };
00249 
00250   enum TermWeightingScheme {
00251     TWS_UNIFORM,
00252     TWS_NONUNIFORM_CONSTANT
00253   };
00254 
00255   enum InputSyntax {
00256     INPUT_TPTP,
00257     INPUT_KIF
00258   };
00259 
00260   enum Proof {
00261     PROOF_OFF,
00262     PROOF_CONDENSED,
00263     PROOF_FULL
00264   };
00265 
00266  public:
00267   Options ();
00268   // correct existing options using command line options
00269   void correct (int argc, char* argv []);
00270   void output (ostream&) const;
00271   void tabulate (ostream&) const;
00272 
00273   // general options
00274 
00275   Mode mode () const { return _mode.value(); }
00276   void mode (Mode m); // implementation in the cpp file
00277 
00278   const char* tab () const { return _tab.value(); }
00279   void tab (const char* newVal) { _tab.value(newVal); }
00280 
00281   const char* inputFile () const { return _inputFile.value(); }
00282   void inputFile (const char* newVal) { _inputFile.value(newVal); }
00283 
00284   int randomSeed () const { return _randomSeed.value(); }
00285   void randomSeed (int newVal) { _randomSeed.value(newVal); }
00286 
00287   // input/output options
00288 
00289   Statistics statistics () const { return _statistics.value(); }
00290   void statistics (Statistics m); // implementation in the cpp file
00291 
00292   Proof proof () const { return _proof.value(); }
00293   void proof (Proof newVal) { _proof.value(newVal); }
00294 
00295   InputSyntax inputSyntax () const { return _inputSyntax.value(); }
00296   void inputSyntax (InputSyntax newVal) { _inputSyntax.value(newVal); }
00297 
00298 
00313   OutputSyntax outputSyntax () const { return _outputSyntax.value(); }
00314   void outputSyntax (OutputSyntax newVal) { _outputSyntax.value(newVal); }
00315 
00316   bool silent () const { return _silent.value(); }
00317   void silent (bool newVal) { _silent.value(newVal); }
00318 
00319   bool showGen () const { return _showGen.value(); }
00320   void showGen (bool newVal) { _showGen.value(newVal); }
00321 
00322   bool showPassive () const { return _showPassive.value(); }
00323   void showPassive (bool newVal) { _showPassive.value(newVal); }
00324 
00325   bool showActive () const { return _showActive.value(); }
00326   void showActive (bool newVal) { _showActive.value(newVal); }
00327 
00328   bool showProfile () const { return _showProfile.value(); }
00329   void showProfile (bool newVal) { _showProfile.value(newVal); }
00330 
00331   bool showPrepro () const { return _showPrepro.value(); }
00332   void showPrepro (bool newVal) { _showPrepro.value(newVal); }
00333 
00334   bool showInput () const { return _showInput.value(); }
00335   void showInput (bool newVal) { _showInput.value(newVal); }
00336 
00337   bool showOptions () const { return _showOptions.value(); }
00338   void showOptions (bool newVal) { _showOptions.value(newVal); }
00339 
00340   bool showWeightLimitChanges () const { return _showWeightLimitChanges.value(); }
00341   void showWeightLimitChanges (bool newVal) { _showWeightLimitChanges.value(newVal); }
00342 
00343   // preprocessor options
00344 
00345   bool removeUnusedDefs () const { return _removeUnusedDefs.value (); }
00346   void removeUnusedDefs (bool newVal) { _removeUnusedDefs.value (newVal); }
00347 
00348   bool arityCheck () const { return _arityCheck.value (); }
00349   void arityCheck (bool newVal) { _arityCheck.value (newVal); }
00350 
00351   bool noFreeVars () const { return _noFreeVars.value (); }
00352   void noFreeVars (bool newVal) { _noFreeVars.value (newVal); }
00353 
00354   bool miniscope () const { return _miniscope.value (); }
00355   void miniscope (bool newVal) { _miniscope.value (newVal); }
00356 
00357   bool outputEqualityInfix () const { return _outputEqualityInfix.value (); }
00358   void outputEqualityInfix (bool newVal) { _outputEqualityInfix.value (newVal); }
00359 
00360   const char* include () const { return _include.value(); }
00361   void include (const char* newVal) { _include.value(newVal); }
00362 
00363   // kernel options
00364   MainAlg mainAlg () const { return _mainAlg.value(); }
00365   void mainAlg (MainAlg alg) { _mainAlg.value(alg); }
00366 
00367   Splitting splitting () const { return _splitting.value(); }
00368   void splitting (Splitting newVal) { _splitting.value(newVal); }
00369 
00370   SplittingStyle splittingStyle () const { return _splittingStyle.value(); }
00371   void splittingStyle (SplittingStyle newVal) { _splittingStyle.value(newVal); }
00372 
00373   bool splittingWithNaming () const { return _splittingWithNaming.value(); }
00374   void splittingWithNaming (bool newVal) { _splittingWithNaming.value(newVal); }
00375 
00376   Selection selection () const { return _selection.value(); }
00377   void selection (Selection s) { _selection.value (s); }
00378 
00379   LiteralComparisonMode literalComparisonMode () const { return _literalComparisonMode.value(); }
00380   void literalComparisonMode (LiteralComparisonMode lcm) { _literalComparisonMode.value(lcm); }
00381 
00382   bool inheritedNegativeSelection () const { return _inheritedNegativeSelection.value(); }
00383   void inheritedNegativeSelection (bool newVal) { _inheritedNegativeSelection.value(newVal); }
00384 
00385   bool forwardSubsumptionResolution () const { return _forwardSubsumptionResolution.value(); }
00386   void forwardSubsumptionResolution (bool newVal) { _forwardSubsumptionResolution.value(newVal); }
00387 
00388   Demodulation forwardDemodulation () const { return _forwardDemodulation.value(); }
00389   void forwardDemodulation (Demodulation newVal) { _forwardDemodulation.value(newVal); }
00390 
00391   bool fdOnSplittingBranches () const { return _fdOnSplittingBranches.value(); }
00392   void fdOnSplittingBranches (bool newVal) { _fdOnSplittingBranches.value(newVal); }
00393 
00394   Demodulation backwardDemodulation () const { return _backwardDemodulation.value(); }
00395   void backwardDemodulation (Demodulation newVal) { _backwardDemodulation.value(newVal); }
00396 
00397   bool bdOnSplittingBranches () const { return _bdOnSplittingBranches.value(); }
00398   void bdOnSplittingBranches (bool newVal) { _bdOnSplittingBranches.value(newVal); }
00399 
00400   Subsumption backwardSubsumption () const { return _backwardSubsumption.value(); }
00401   void backwardSubsumption (Subsumption newVal) { _backwardSubsumption.value(newVal); }
00402 
00403   Subsumption forwardSubsumption () const { return _forwardSubsumption.value(); }
00404   void forwardSubsumption (Subsumption newVal) { _forwardSubsumption.value(newVal); }
00405 
00406   bool orphanMurder () const { return _orphanMurder.value(); }
00407   void orphanMurder (bool newVal) { _orphanMurder.value(newVal); }
00408 
00409   int elimDef () const { return _elimDef.value(); }
00410   void elimDef (int newVal) { _elimDef.value(newVal); }
00411 
00412   int lrsFirstTimeCheck () const { return _lrsFirstTimeCheck.value(); }
00413   void lrsFirstTimeCheck (int newVal) { _lrsFirstTimeCheck.value(newVal); }
00414 
00415   int lrsFirstMemoryCheck () const { return _lrsFirstMemoryCheck.value(); }
00416   void lrsFirstMemoryCheck (int newVal) { _lrsFirstMemoryCheck.value(newVal); }
00417 
00418   int maxInferenceDepth () const { return _maxInferenceDepth.value(); }
00419   void maxInferenceDepth (int newVal) { _maxInferenceDepth.value(newVal); }
00420 
00421   SymbolPrecedence symbolPrecedence () const { return _symbolPrecedence.value(); }
00422   void symbolPrecedence (SymbolPrecedence newVal) { _symbolPrecedence.value(newVal); }
00423 
00424   bool headerPrecedenceKinky () const { return _headerPrecedenceKinky.value(); }
00425   void headerPrecedenceKinky (bool newVal) { _headerPrecedenceKinky.value(newVal); }
00426 
00427   bool noInferencesBetweenRules () const { return _noInferencesBetweenRules.value(); }
00428   void noInferencesBetweenRules (bool newVal) { _noInferencesBetweenRules.value(newVal); }
00429 
00430   long timeLimit () const { return _timeLimit.value(); }
00431   void timeLimit ( long newVal ) { _timeLimit.value (newVal); }
00432 
00433   int memoryLimit () const { return _memoryLimit.value(); }
00434   void memoryLimit ( int newVal ) { _memoryLimit.value (newVal); }
00435 
00436   int allocationBufferSize () const { return _allocationBufferSize.value(); }
00437   void allocationBufferSize ( int newVal ) { _allocationBufferSize.value (newVal); }
00438 
00439   float allocationBufferPrice () const { return _allocationBufferPrice.value(); }
00440   void allocationBufferPrice ( float newVal ) { _allocationBufferPrice.value (newVal); }
00441 
00442   int inequalitySplitting () const { return _inequalitySplitting.value(); }
00443   void inequalitySplitting ( int newVal ) { _inequalitySplitting.value (newVal); }
00444 
00445   int maxSkolem () const { return _maxSkolem.value(); }
00446   void maxSkolem ( int newVal ) { _maxSkolem.value (newVal); }
00447 
00448   long maxActive () const { return _maxActive.value(); }
00449   void maxActive (long newVal) { _maxActive.value(newVal); }
00450 
00451   long maxPassive () const { return _maxPassive.value(); }
00452   void maxPassive (long newVal) { _maxPassive.value(newVal); }
00453 
00454   long maxWeight () const { return _maxWeight.value(); }
00455   void maxWeight (long newVal) { _maxWeight.value(newVal); }
00456 
00457   int ageWeightRatio () const { return _ageWeightRatio.value(); }
00458   void ageWeightRatio (int newVal) { _ageWeightRatio.value(newVal); }
00459 
00460   const char* testId () const { return _testId.value(); }
00461   void testId (const char* newVal) { _testId.value(newVal); }
00462 
00463   int testNumber () const { return _testNumber.value(); }
00464   void testNumber (int newVal) { _testNumber.value(newVal); }
00465 
00466   bool paramodulation () const { return _paramodulation.value(); }
00467   void paramodulation (bool newVal) { _paramodulation.value(newVal); }
00468 
00469   int symbolWeightByArity () const { return _symbolWeightByArity.value(); }
00470   void symbolWeightByArity (int newVal) { _symbolWeightByArity.value(newVal); }
00471 
00472   TermWeightingScheme termWeightingScheme () const { return _termWeightingScheme.value (); }
00473   void termWeightingScheme (TermWeightingScheme newVal) { _termWeightingScheme.value (newVal); }
00474 
00475   SimplificationOrdering simplificationOrdering () const { return _simplificationOrdering.value(); }
00476   void simplificationOrdering (SimplificationOrdering newVal) { _simplificationOrdering.value(newVal); }
00477 
00478   float nongoalWeightCoefficient () const { return _nongoalWeightCoefficient.value(); }
00479   void nongoalWeightCoefficient (float newVal) { _nongoalWeightCoefficient.value(newVal); }
00480 
00481   float selectedEqualityWeightCoefficient () const { return _selectedEqualityWeightCoefficient.value(); }
00482   void selectedEqualityWeightCoefficient (float newVal) { _selectedEqualityWeightCoefficient.value(newVal); }
00483 
00484   bool sos () const { return _sos.value(); }
00485   void sos (bool newVal) { _sos.value(newVal); }
00486 
00487   // standard ways of creating options
00488   static Options* lrs (Selection selection);
00489   static Options* lrs (Selection selection, LiteralComparisonMode);
00490 
00491   static Options* discount (Selection selection);
00492   static Options* discount (Selection selection, LiteralComparisonMode);
00493 
00494   static Options* otter (Selection selection);
00495 
00496   // change to the standard KIF options
00497   void kif ();
00498   void fullSplitting ();
00499 
00500   // miscellaneous
00501   string includeFileName (char* relativeName); // absolute include file name
00502   bool testNumberChanged () const { return _testNumber.changed(); }
00503 
00504  private:
00505   // general options
00506 
00507   Option <Mode> _mode;
00508   Option <const char*> _tab;
00509   Option <const char*> _inputFile; // input file
00510   Option <int> _randomSeed;
00511 
00512   // input/output options
00513 
00514   Option <Statistics> _statistics;
00515   Option <InputSyntax> _inputSyntax;
00516   Option <OutputSyntax> _outputSyntax;
00517   Option <bool> _silent;
00518   Option <bool> _showGen;  
00519   Option <bool> _showPassive;  
00520   Option <bool> _showActive;
00521   Option <bool> _showPrepro;
00522   Option <bool> _showProfile;
00523   Option <bool> _showInput;
00524   Option <bool> _showOptions;
00525   Option <bool> _showWeightLimitChanges;  
00526 
00527   // preprocessor options
00528 
00529   Option <bool> _removeUnusedDefs;
00530   Option <bool> _arityCheck;
00531   Option <bool> _noFreeVars;
00532   Option <bool> _miniscope;
00533   Option <bool> _outputEqualityInfix;
00534   Option <const char*> _include;
00535 
00536   // Kernel's options
00537 
00538   Option <MainAlg> _mainAlg;
00539   Option <Splitting> _splitting;
00540   Option <SplittingStyle> _splittingStyle;
00541   Option <bool> _splittingWithNaming;
00542   Option <Selection> _selection;
00543   Option <LiteralComparisonMode> _literalComparisonMode;
00544   Option <bool> _inheritedNegativeSelection;
00545   Option <bool> _forwardSubsumptionResolution;
00546   Option <Demodulation> _forwardDemodulation;
00547   Option<bool> _fdOnSplittingBranches;
00548   Option <Demodulation> _backwardDemodulation;
00549   Option<bool> _bdOnSplittingBranches;
00550   Option <Subsumption> _forwardSubsumption;
00551   Option <Subsumption> _backwardSubsumption;
00552   Option <bool> _orphanMurder;
00553   Option <int> _elimDef;
00554   Option <int> _lrsFirstTimeCheck;
00555   Option <int> _lrsFirstMemoryCheck;
00556   Option <int> _maxInferenceDepth;
00557   Option <SymbolPrecedence> _symbolPrecedence;
00558   Option <bool> _headerPrecedenceKinky;
00559   Option <bool> _noInferencesBetweenRules;
00560   Option <long> _timeLimit;
00561   Option <int> _memoryLimit;
00562   Option <int> _allocationBufferSize;
00563   Option <float> _allocationBufferPrice;
00564   Option <int> _inequalitySplitting;
00565   Option <int> _maxSkolem;
00566   Option <long> _maxActive;
00567   Option <long> _maxPassive;
00568   Option <long> _maxWeight;
00569   Option <int> _ageWeightRatio;
00570   Option <Proof> _proof;
00571   Option <const char*> _testId;
00572   Option <int> _testNumber;
00573   Option <bool> _paramodulation;
00574   Option <int> _symbolWeightByArity;
00575   Option <TermWeightingScheme> _termWeightingScheme;
00576   Option <SimplificationOrdering> _simplificationOrdering;
00577   Option <float> _nongoalWeightCoefficient;
00578   Option <float> _selectedEqualityWeightCoefficient;
00579   Option <bool> _sos;
00580 
00581   Opt* find (const char*); // find option by name
00582   static const char* _names [];
00583   void toXML (ostream& str) const;
00584 }; // class Options
00585 
00586 
00587 // a kind of kludge. Needed since some options are required for e.g. 
00588 // output
00589 extern Options* options;
00590 
00591 
00592 inline
00593 ostream& operator << (ostream& str, const Options& opts)
00594 {
00595   opts.output(str);
00596 
00597   return str;
00598 } // ostream& operator << (ostream& str, const Options& opts)
00599 
00600 
00601 #endif
00602 

Generated on Sat Jun 28 15:08:58 2003 for Vampire by doxygen 1.3.2