Generated on Fri Mar 20 15:55:55 2015 for Gecode by doxygen 1.6.3

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