Generated on Mon Jul 6 18:09:02 2009 for Gecode by doxygen 1.5.9

options.hpp

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Christian Schulte, 2004
00008  *
00009  *  Last modified:
00010  *     $Date: 2009-05-14 04:16:05 +0200 (Thu, 14 May 2009) $ by $Author: tack $
00011  *     $Revision: 9102 $
00012  *
00013  *  This file is part of Gecode, the generic constraint
00014  *  development environment:
00015  *     http://www.gecode.org
00016  *
00017  *
00018  *  Permission is hereby granted, free of charge, to any person obtaining
00019  *  a copy of this software and associated documentation files (the
00020  *  "Software"), to deal in the Software without restriction, including
00021  *  without limitation the rights to use, copy, modify, merge, publish,
00022  *  distribute, sublicense, and/or sell copies of the Software, and to
00023  *  permit persons to whom the Software is furnished to do so, subject to
00024  *  the following conditions:
00025  *
00026  *  The above copyright notice and this permission notice shall be
00027  *  included in all copies or substantial portions of the Software.
00028  *
00029  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00030  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00031  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00032  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00033  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00034  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00035  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00036  *
00037  */
00038 
00039 namespace Gecode {
00040 
00041   namespace Driver {
00042     /*
00043      * Option baseclass
00044      *
00045      */
00046     inline
00047     BaseOption::BaseOption(const char* o, const char* e)
00048       : opt(o), exp(e) {}
00049     inline
00050     BaseOption::~BaseOption(void) {
00051     }
00052     
00053     
00054     /*
00055      * String option
00056      *
00057      */
00058     inline
00059     StringOption::StringOption(const char* o, const char* e, int v)
00060       : BaseOption(o,e), cur(v), fst(NULL), lst(NULL) {}
00061     inline void
00062     StringOption::value(int v) {
00063       cur = v;
00064     }
00065     inline int
00066     StringOption::value(void) const {
00067       return cur;
00068     }
00069     
00070     /*
00071      * Integer option
00072      *
00073      */
00074     inline
00075     IntOption::IntOption(const char* o, const char* e, int v)
00076       : BaseOption(o,e), cur(v) {}
00077     inline void
00078     IntOption::value(int v) {
00079       cur = v;
00080     }
00081     inline int
00082     IntOption::value(void) const {
00083       return cur;
00084     }
00085 
00086     /*
00087      * Unsigned integer option
00088      *
00089      */
00090     inline
00091     UnsignedIntOption::UnsignedIntOption(const char* o, const char* e,
00092                                          unsigned int v)
00093       : BaseOption(o,e), cur(v) {}
00094     inline void
00095     UnsignedIntOption::value(unsigned int v) {
00096       cur = v;
00097     }
00098     inline unsigned int
00099     UnsignedIntOption::value(void) const {
00100       return cur;
00101     }
00102 
00103     /*
00104      * Double option
00105      *
00106      */
00107     inline
00108     DoubleOption::DoubleOption(const char* o, const char* e,
00109                                unsigned int v)
00110       : BaseOption(o,e), cur(v) {}
00111     inline void
00112     DoubleOption::value(double v) {
00113       cur = v;
00114     }
00115     inline double
00116     DoubleOption::value(void) const {
00117       return cur;
00118     }
00119 
00120     /*
00121      * Bool option
00122      *
00123      */
00124     inline
00125     BoolOption::BoolOption(const char* o, const char* e) 
00126       : BaseOption(o,e), cur(false) {}
00127     inline void
00128     BoolOption::value(bool v) {
00129       cur = v;
00130     }
00131     inline bool
00132     BoolOption::value(void) const {
00133       return cur;
00134     }
00135 
00136 
00137   }
00138   
00139   /*
00140    * Options
00141    *
00142    */
00143   inline void
00144   BaseOptions::add(Driver::BaseOption& o) {
00145     o.next = NULL;
00146     if (fst == NULL) {
00147       fst=&o;
00148     } else {
00149       lst->next=&o;
00150     }
00151     lst=&o;
00152   }
00153   inline const char*
00154   BaseOptions::name(void) const {
00155     return _name;
00156   }
00157   inline void
00158   BaseOptions::name(const char* n) {
00159     _name = n;
00160   }
00161   inline
00162   BaseOptions::~BaseOptions(void) {}
00163 
00164   /*
00165    * Model options
00166    *
00167    */
00168   inline void
00169   Options::model(int v) {
00170     _model.value(v);
00171   }
00172   inline void
00173   Options::model(int v, const char* o, const char* h) {
00174     _model.add(v,o,h);
00175   }
00176   inline int
00177   Options::model(void) const {
00178     return _model.value();
00179   }
00180   
00181   inline void
00182   Options::propagation(int v) {
00183     _propagation.value(v);
00184   }
00185   inline void
00186   Options::propagation(int v, const char* o, const char* h) {
00187     _propagation.add(v,o,h);
00188   }
00189   inline int
00190   Options::propagation(void) const {
00191     return _propagation.value();
00192   }
00193   
00194   inline void
00195   Options::icl(IntConLevel i) {
00196     _icl.value(i);
00197   }
00198   inline IntConLevel
00199   Options::icl(void) const {
00200     return static_cast<IntConLevel>(_icl.value());
00201   }
00202   
00203   inline void
00204   Options::branching(int v) {
00205     _branching.value(v);
00206   }
00207   inline void
00208   Options::branching(int v, const char* o, const char* h) {
00209     _branching.add(v,o,h);
00210   }
00211   inline int
00212   Options::branching(void) const {
00213     return _branching.value();
00214   }
00215   
00216   /*
00217    * Search options
00218    *
00219    */
00220   inline void
00221   Options::search(int v) {
00222     _search.value(v);
00223   }
00224   inline void
00225   Options::search(int v, const char* o, const char* h) {
00226     _search.add(v,o,h);
00227   }
00228   inline int
00229   Options::search(void) const {
00230     return _search.value();
00231   }
00232   
00233   inline void
00234   Options::solutions(unsigned int n) {
00235     _solutions.value(n);
00236   }
00237   inline unsigned int
00238   Options::solutions(void) const {
00239     return _solutions.value();
00240   }
00241   
00242   inline void
00243   Options::threads(double n) {
00244     _threads.value(n);
00245   }
00246   inline double
00247   Options::threads(void) const {
00248     return _threads.value();
00249   }
00250   
00251   inline void
00252   Options::c_d(unsigned int d) {
00253     _c_d.value(d);
00254   }
00255   inline unsigned int
00256   Options::c_d(void) const {
00257     return _c_d.value();
00258   }
00259   
00260   inline void
00261   Options::a_d(unsigned int d) {
00262     _a_d.value(d);
00263   }
00264   inline unsigned int
00265   Options::a_d(void) const {
00266     return _a_d.value();
00267   }
00268   
00269   inline void
00270   Options::node(unsigned int n) {
00271     _node.value(n);
00272   }
00273   inline unsigned int
00274   Options::node(void) const {
00275     return _node.value();
00276   }
00277   
00278   inline void
00279   Options::fail(unsigned int n) {
00280     _fail.value(n);
00281   }
00282   inline unsigned int
00283   Options::fail(void) const {
00284     return _fail.value();
00285   }
00286   
00287   inline void
00288   Options::time(unsigned int t) {
00289     _time.value(t);
00290   }
00291   inline unsigned int
00292   Options::time(void) const {
00293     return _time.value();
00294   }
00295   
00296   
00297   
00298   /*
00299    * Execution options
00300    *
00301    */
00302   inline void
00303   Options::mode(ScriptMode sm) {
00304     _mode.value(sm);
00305   }
00306   inline ScriptMode
00307   Options::mode(void) const {
00308     return static_cast<ScriptMode>(_mode.value());
00309   }
00310   
00311   inline void
00312   Options::iterations(unsigned int i) {
00313     _iterations.value(i);
00314   }
00315   inline unsigned int
00316   Options::iterations(void) const {
00317     return _iterations.value();
00318   }
00319   
00320   inline void
00321   Options::samples(unsigned int s) {
00322     _samples.value(s);
00323   }
00324   inline unsigned int
00325   Options::samples(void) const {
00326     return _samples.value();
00327   }
00328 
00329   /*
00330    * Options with additional size argument
00331    *
00332    */
00333   inline void
00334   SizeOptions::size(unsigned int s) {
00335     _size = s;
00336   }
00337   inline unsigned int
00338   SizeOptions::size(void) const {
00339     return _size;
00340   }
00341   
00342 }
00343 
00344 // STATISTICS: driver-any