Generated on Wed Nov 5 2014 05:18:16 for Gecode by doxygen 1.7.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: 2013-07-08 14:22:40 +0200 (Mon, 08 Jul 2013) $ by $Author: schulte $
00011  *     $Revision: 13820 $
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     /*
00046      * String option
00047      *
00048      */
00049     inline const char*
00050     StringValueOption::value(void) const {
00051       return cur;
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                                double 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, bool v) 
00126       : BaseOption(o,e), cur(v) {}
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 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   inline void
00216   Options::decay(double d) {
00217     _decay.value(d);
00218   }
00219   inline double
00220   Options::decay(void) const {
00221     return _decay.value();
00222   }
00223   
00224   
00225   /*
00226    * Search options
00227    *
00228    */
00229   inline void
00230   Options::search(int v) {
00231     _search.value(v);
00232   }
00233   inline void
00234   Options::search(int v, const char* o, const char* h) {
00235     _search.add(v,o,h);
00236   }
00237   inline int
00238   Options::search(void) const {
00239     return _search.value();
00240   }
00241   
00242   inline void
00243   Options::solutions(unsigned int n) {
00244     _solutions.value(n);
00245   }
00246   inline unsigned int
00247   Options::solutions(void) const {
00248     return _solutions.value();
00249   }
00250   
00251   inline void
00252   Options::threads(double n) {
00253     _threads.value(n);
00254   }
00255   inline double
00256   Options::threads(void) const {
00257     return _threads.value();
00258   }
00259   
00260   inline void
00261   Options::c_d(unsigned int d) {
00262     _c_d.value(d);
00263   }
00264   inline unsigned int
00265   Options::c_d(void) const {
00266     return _c_d.value();
00267   }
00268   
00269   inline void
00270   Options::a_d(unsigned int d) {
00271     _a_d.value(d);
00272   }
00273   inline unsigned int
00274   Options::a_d(void) const {
00275     return _a_d.value();
00276   }
00277   
00278   inline void
00279   Options::node(unsigned int n) {
00280     _node.value(n);
00281   }
00282   inline unsigned int
00283   Options::node(void) const {
00284     return _node.value();
00285   }
00286   
00287   inline void
00288   Options::fail(unsigned int n) {
00289     _fail.value(n);
00290   }
00291   inline unsigned int
00292   Options::fail(void) const {
00293     return _fail.value();
00294   }
00295   
00296   inline void
00297   Options::time(unsigned int t) {
00298     _time.value(t);
00299   }
00300   inline unsigned int
00301   Options::time(void) const {
00302     return _time.value();
00303   }
00304 
00305   inline void
00306   Options::restart(RestartMode rm) {
00307     _restart.value(rm);
00308   }
00309   inline RestartMode
00310   Options::restart(void) const {
00311     return static_cast<RestartMode>(_restart.value());
00312   }
00313   
00314   inline void
00315   Options::restart_base(double n) {
00316     _r_base.value(n);
00317   }
00318   inline double
00319   Options::restart_base(void) const {
00320     return _r_base.value();
00321   }
00322   
00323   inline void
00324   Options::restart_scale(unsigned int n) {
00325     _r_scale.value(n);
00326   }
00327   inline unsigned int
00328   Options::restart_scale(void) const {
00329     return _r_scale.value();
00330   }
00331   
00332   inline void
00333   Options::nogoods(bool b) {
00334     _nogoods.value(b);
00335   }
00336   inline bool
00337   Options::nogoods(void) const {
00338     return _nogoods.value();
00339   }
00340   
00341   inline void
00342   Options::nogoods_limit(unsigned int l) {
00343     _nogoods_limit.value(l);
00344   }
00345   inline unsigned int
00346   Options::nogoods_limit(void) const {
00347     return _nogoods_limit.value();
00348   }
00349   
00350   
00351   
00352   inline void
00353   Options::interrupt(bool b) {
00354     _interrupt.value(b);
00355   }
00356   inline bool
00357   Options::interrupt(void) const {
00358     return _interrupt.value();
00359   }
00360   
00361   
00362   /*
00363    * Execution options
00364    *
00365    */
00366   inline void
00367   Options::mode(ScriptMode sm) {
00368     _mode.value(sm);
00369   }
00370   inline ScriptMode
00371   Options::mode(void) const {
00372     return static_cast<ScriptMode>(_mode.value());
00373   }
00374   
00375   inline void
00376   Options::samples(unsigned int s) {
00377     _samples.value(s);
00378   }
00379   inline unsigned int
00380   Options::samples(void) const {
00381     return _samples.value();
00382   }
00383 
00384   inline void
00385   Options::iterations(unsigned int i) {
00386     _iterations.value(i);
00387   }
00388   inline unsigned int
00389   Options::iterations(void) const {
00390     return _iterations.value();
00391   }
00392   
00393   inline void
00394   Options::print_last(bool p) {
00395     _print_last.value(p);
00396   }
00397   inline bool
00398   Options::print_last(void) const {
00399     return _print_last.value();
00400   }
00401 
00402   inline void
00403   Options::out_file(const char *f) {
00404     _out_file.value(f);
00405   }
00406 
00407   inline const char*
00408   Options::out_file(void) const {
00409     return _out_file.value();
00410   }
00411 
00412   inline void
00413   Options::log_file(const char* f) {
00414     _log_file.value(f);
00415   }
00416 
00417   inline const char*
00418   Options::log_file(void) const {
00419     return _log_file.value();
00420   }
00421 
00422 #ifdef GECODE_HAS_GIST
00423   forceinline
00424   Options::_I::_I(void) : _click(heap,1), n_click(0),
00425     _solution(heap,1), n_solution(0), _move(heap,1), n_move(0),
00426     _compare(heap,1), n_compare(0) {}
00427 
00428   forceinline void
00429   Options::_I::click(Gist::Inspector* i) {
00430     _click[static_cast<int>(n_click++)] = i;
00431   }
00432   forceinline void
00433   Options::_I::solution(Gist::Inspector* i) {
00434     _solution[static_cast<int>(n_solution++)] = i;
00435   }
00436   forceinline void
00437   Options::_I::move(Gist::Inspector* i) {
00438     _move[static_cast<int>(n_move++)] = i;
00439   }
00440   forceinline void
00441   Options::_I::compare(Gist::Comparator* i) {
00442     _compare[static_cast<int>(n_compare++)] = i;
00443   }
00444   forceinline Gist::Inspector*
00445   Options::_I::click(unsigned int i) const {
00446     return (i < n_click) ? _click[i] : NULL;
00447   }
00448   forceinline Gist::Inspector*
00449   Options::_I::solution(unsigned int i) const {
00450     return (i < n_solution) ? _solution[i] : NULL;
00451   }
00452   forceinline Gist::Inspector*
00453   Options::_I::move(unsigned int i) const {
00454     return (i < n_move) ? _move[i] : NULL;
00455   }
00456   forceinline Gist::Comparator*
00457   Options::_I::compare(unsigned int i) const {
00458     return (i < n_compare) ? _compare[i] : NULL;
00459   }
00460 #endif
00461 
00462   /*
00463    * Options with additional size argument
00464    *
00465    */
00466   inline void
00467   SizeOptions::size(unsigned int s) {
00468     _size = s;
00469   }
00470   inline unsigned int
00471   SizeOptions::size(void) const {
00472     return _size;
00473   }
00474   
00475   /*
00476    * Options with additional string argument
00477    *
00478    */
00479   inline const char*
00480   InstanceOptions::instance(void) const {
00481     return _inst;
00482   }
00483   
00484 }
00485 
00486 // STATISTICS: driver-any