Generated on Mon Nov 30 23:53:18 2009 for Gecode by doxygen 1.6.1

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-06-26 13:15:22 +0200 (Fri, 26 Jun 2009) $ by $Author: zayenz $
00011  *     $Revision: 9350 $
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 #include <cstring>
00040 
00041 namespace Gecode {
00042 
00043   namespace Driver {
00044     /*
00045      * String option
00046      *
00047      */
00048     inline
00049     StringOption::StringOption(const char* o, const char* e, int v)
00050       : BaseOption(o,e), cur(v), fst(NULL), lst(NULL) {}
00051     inline void
00052     StringOption::value(int v) {
00053       cur = v;
00054     }
00055     inline int
00056     StringOption::value(void) const {
00057       return cur;
00058     }
00059     
00060     /*
00061      * Integer option
00062      *
00063      */
00064     inline
00065     IntOption::IntOption(const char* o, const char* e, int v)
00066       : BaseOption(o,e), cur(v) {}
00067     inline void
00068     IntOption::value(int v) {
00069       cur = v;
00070     }
00071     inline int
00072     IntOption::value(void) const {
00073       return cur;
00074     }
00075 
00076     /*
00077      * Unsigned integer option
00078      *
00079      */
00080     inline
00081     UnsignedIntOption::UnsignedIntOption(const char* o, const char* e,
00082                                          unsigned int v)
00083       : BaseOption(o,e), cur(v) {}
00084     inline void
00085     UnsignedIntOption::value(unsigned int v) {
00086       cur = v;
00087     }
00088     inline unsigned int
00089     UnsignedIntOption::value(void) const {
00090       return cur;
00091     }
00092 
00093     /*
00094      * Double option
00095      *
00096      */
00097     inline
00098     DoubleOption::DoubleOption(const char* o, const char* e,
00099                                unsigned int v)
00100       : BaseOption(o,e), cur(v) {}
00101     inline void
00102     DoubleOption::value(double v) {
00103       cur = v;
00104     }
00105     inline double
00106     DoubleOption::value(void) const {
00107       return cur;
00108     }
00109 
00110     /*
00111      * Bool option
00112      *
00113      */
00114     inline
00115     BoolOption::BoolOption(const char* o, const char* e) 
00116       : BaseOption(o,e), cur(false) {}
00117     inline void
00118     BoolOption::value(bool v) {
00119       cur = v;
00120     }
00121     inline bool
00122     BoolOption::value(void) const {
00123       return cur;
00124     }
00125 
00126 
00127   }
00128   
00129   /*
00130    * Options
00131    *
00132    */
00133   inline void
00134   BaseOptions::add(Driver::BaseOption& o) {
00135     o.next = NULL;
00136     if (fst == NULL) {
00137       fst=&o;
00138     } else {
00139       lst->next=&o;
00140     }
00141     lst=&o;
00142   }
00143   inline const char*
00144   BaseOptions::name(void) const {
00145     return _name;
00146   }
00147 
00148 
00149 
00150   /*
00151    * Model options
00152    *
00153    */
00154   inline void
00155   Options::model(int v) {
00156     _model.value(v);
00157   }
00158   inline void
00159   Options::model(int v, const char* o, const char* h) {
00160     _model.add(v,o,h);
00161   }
00162   inline int
00163   Options::model(void) const {
00164     return _model.value();
00165   }
00166   
00167   inline void
00168   Options::symmetry(int v) {
00169     _symmetry.value(v);
00170   }
00171   inline void
00172   Options::symmetry(int v, const char* o, const char* h) {
00173     _symmetry.add(v,o,h);
00174   }
00175   inline int
00176   Options::symmetry(void) const {
00177     return _symmetry.value();
00178   }
00179   
00180   inline void
00181   Options::propagation(int v) {
00182     _propagation.value(v);
00183   }
00184   inline void
00185   Options::propagation(int v, const char* o, const char* h) {
00186     _propagation.add(v,o,h);
00187   }
00188   inline int
00189   Options::propagation(void) const {
00190     return _propagation.value();
00191   }
00192   
00193   inline void
00194   Options::icl(IntConLevel i) {
00195     _icl.value(i);
00196   }
00197   inline IntConLevel
00198   Options::icl(void) const {
00199     return static_cast<IntConLevel>(_icl.value());
00200   }
00201   
00202   inline void
00203   Options::branching(int v) {
00204     _branching.value(v);
00205   }
00206   inline void
00207   Options::branching(int v, const char* o, const char* h) {
00208     _branching.add(v,o,h);
00209   }
00210   inline int
00211   Options::branching(void) const {
00212     return _branching.value();
00213   }
00214   
00215   /*
00216    * Search options
00217    *
00218    */
00219   inline void
00220   Options::search(int v) {
00221     _search.value(v);
00222   }
00223   inline void
00224   Options::search(int v, const char* o, const char* h) {
00225     _search.add(v,o,h);
00226   }
00227   inline int
00228   Options::search(void) const {
00229     return _search.value();
00230   }
00231   
00232   inline void
00233   Options::solutions(unsigned int n) {
00234     _solutions.value(n);
00235   }
00236   inline unsigned int
00237   Options::solutions(void) const {
00238     return _solutions.value();
00239   }
00240   
00241   inline void
00242   Options::threads(double n) {
00243     _threads.value(n);
00244   }
00245   inline double
00246   Options::threads(void) const {
00247     return _threads.value();
00248   }
00249   
00250   inline void
00251   Options::c_d(unsigned int d) {
00252     _c_d.value(d);
00253   }
00254   inline unsigned int
00255   Options::c_d(void) const {
00256     return _c_d.value();
00257   }
00258   
00259   inline void
00260   Options::a_d(unsigned int d) {
00261     _a_d.value(d);
00262   }
00263   inline unsigned int
00264   Options::a_d(void) const {
00265     return _a_d.value();
00266   }
00267   
00268   inline void
00269   Options::node(unsigned int n) {
00270     _node.value(n);
00271   }
00272   inline unsigned int
00273   Options::node(void) const {
00274     return _node.value();
00275   }
00276   
00277   inline void
00278   Options::fail(unsigned int n) {
00279     _fail.value(n);
00280   }
00281   inline unsigned int
00282   Options::fail(void) const {
00283     return _fail.value();
00284   }
00285   
00286   inline void
00287   Options::time(unsigned int t) {
00288     _time.value(t);
00289   }
00290   inline unsigned int
00291   Options::time(void) const {
00292     return _time.value();
00293   }
00294   
00295   
00296   
00297   /*
00298    * Execution options
00299    *
00300    */
00301   inline void
00302   Options::mode(ScriptMode sm) {
00303     _mode.value(sm);
00304   }
00305   inline ScriptMode
00306   Options::mode(void) const {
00307     return static_cast<ScriptMode>(_mode.value());
00308   }
00309   
00310   inline void
00311   Options::iterations(unsigned int i) {
00312     _iterations.value(i);
00313   }
00314   inline unsigned int
00315   Options::iterations(void) const {
00316     return _iterations.value();
00317   }
00318   
00319   inline void
00320   Options::samples(unsigned int s) {
00321     _samples.value(s);
00322   }
00323   inline unsigned int
00324   Options::samples(void) const {
00325     return _samples.value();
00326   }
00327 
00328   /*
00329    * Options with additional size argument
00330    *
00331    */
00332   inline void
00333   SizeOptions::size(unsigned int s) {
00334     _size = s;
00335   }
00336   inline unsigned int
00337   SizeOptions::size(void) const {
00338     return _size;
00339   }
00340   
00341 }
00342 
00343 // STATISTICS: driver-any