Generated on Tue Apr 18 10:21:31 2017 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: 2016-10-23 14:09:24 +0200 (Sun, 23 Oct 2016) $ by $Author: schulte $
00011  *     $Revision: 15218 $
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      * Integer propagation level option
00138      *
00139      */
00140     inline void
00141     IplOption::value(IntPropLevel ipl) {
00142       cur = ipl;
00143     }
00144     inline IntPropLevel
00145     IplOption::value(void) const {
00146       return cur;
00147     }
00148 
00149 
00150     /*
00151      * Trace flag option
00152      *
00153      */
00154     inline void
00155     TraceOption::value(int f) {
00156       cur = f;
00157     }
00158     inline int
00159     TraceOption::value(void) const {
00160       return cur;
00161     }
00162 
00163   }
00164 
00165   /*
00166    * Options
00167    *
00168    */
00169   inline const char*
00170   BaseOptions::name(void) const {
00171     return _name;
00172   }
00173 
00174 
00175 
00176   /*
00177    * Model options
00178    *
00179    */
00180   inline void
00181   Options::model(int v) {
00182     _model.value(v);
00183   }
00184   inline void
00185   Options::model(int v, const char* o, const char* h) {
00186     _model.add(v,o,h);
00187   }
00188   inline int
00189   Options::model(void) const {
00190     return _model.value();
00191   }
00192 
00193   inline void
00194   Options::symmetry(int v) {
00195     _symmetry.value(v);
00196   }
00197   inline void
00198   Options::symmetry(int v, const char* o, const char* h) {
00199     _symmetry.add(v,o,h);
00200   }
00201   inline int
00202   Options::symmetry(void) const {
00203     return _symmetry.value();
00204   }
00205 
00206   inline void
00207   Options::propagation(int v) {
00208     _propagation.value(v);
00209   }
00210   inline void
00211   Options::propagation(int v, const char* o, const char* h) {
00212     _propagation.add(v,o,h);
00213   }
00214   inline int
00215   Options::propagation(void) const {
00216     return _propagation.value();
00217   }
00218 
00219   inline void
00220   Options::ipl(IntPropLevel i) {
00221     _ipl.value(i);
00222   }
00223   inline IntPropLevel
00224   Options::ipl(void) const {
00225     return _ipl.value();
00226   }
00227 
00228   inline void
00229   Options::branching(int v) {
00230     _branching.value(v);
00231   }
00232   inline void
00233   Options::branching(int v, const char* o, const char* h) {
00234     _branching.add(v,o,h);
00235   }
00236   inline int
00237   Options::branching(void) const {
00238     return _branching.value();
00239   }
00240 
00241   inline void
00242   Options::decay(double d) {
00243     _decay.value(d);
00244   }
00245   inline double
00246   Options::decay(void) const {
00247     return _decay.value();
00248   }
00249 
00250   inline void
00251   Options::seed(unsigned int s) {
00252     _seed.value(s);
00253   }
00254   inline unsigned int
00255   Options::seed(void) const {
00256     return _seed.value();
00257   }
00258 
00259   inline void
00260   Options::step(double s) {
00261     _step.value(s);
00262   }
00263   inline double
00264   Options::step(void) const {
00265     return _step.value();
00266   }
00267 
00268 
00269   /*
00270    * Search options
00271    *
00272    */
00273   inline void
00274   Options::search(int v) {
00275     _search.value(v);
00276   }
00277   inline void
00278   Options::search(int v, const char* o, const char* h) {
00279     _search.add(v,o,h);
00280   }
00281   inline int
00282   Options::search(void) const {
00283     return _search.value();
00284   }
00285 
00286   inline void
00287   Options::solutions(unsigned int n) {
00288     _solutions.value(n);
00289   }
00290   inline unsigned int
00291   Options::solutions(void) const {
00292     return _solutions.value();
00293   }
00294 
00295   inline void
00296   Options::threads(double n) {
00297     _threads.value(n);
00298   }
00299   inline double
00300   Options::threads(void) const {
00301     return _threads.value();
00302   }
00303 
00304   inline void
00305   Options::c_d(unsigned int d) {
00306     _c_d.value(d);
00307   }
00308   inline unsigned int
00309   Options::c_d(void) const {
00310     return _c_d.value();
00311   }
00312 
00313   inline void
00314   Options::a_d(unsigned int d) {
00315     _a_d.value(d);
00316   }
00317   inline unsigned int
00318   Options::a_d(void) const {
00319     return _a_d.value();
00320   }
00321 
00322   inline void
00323   Options::d_l(unsigned int d) {
00324     _d_l.value(d);
00325   }
00326   inline unsigned int
00327   Options::d_l(void) const {
00328     return _d_l.value();
00329   }
00330 
00331   inline void
00332   Options::node(unsigned int n) {
00333     _node.value(n);
00334   }
00335   inline unsigned int
00336   Options::node(void) const {
00337     return _node.value();
00338   }
00339 
00340   inline void
00341   Options::fail(unsigned int n) {
00342     _fail.value(n);
00343   }
00344   inline unsigned int
00345   Options::fail(void) const {
00346     return _fail.value();
00347   }
00348 
00349   inline void
00350   Options::time(unsigned int t) {
00351     _time.value(t);
00352   }
00353   inline unsigned int
00354   Options::time(void) const {
00355     return _time.value();
00356   }
00357 
00358   inline void
00359   Options::assets(unsigned int n) {
00360     _assets.value(n);
00361   }
00362   inline unsigned int
00363   Options::assets(void) const {
00364     return _assets.value();
00365   }
00366 
00367   inline void
00368   Options::slice(unsigned int n) {
00369     _slice.value(n);
00370   }
00371   inline unsigned int
00372   Options::slice(void) const {
00373     return _slice.value();
00374   }
00375 
00376   inline void
00377   Options::restart(RestartMode rm) {
00378     _restart.value(rm);
00379   }
00380   inline RestartMode
00381   Options::restart(void) const {
00382     return static_cast<RestartMode>(_restart.value());
00383   }
00384 
00385   inline void
00386   Options::restart_base(double n) {
00387     _r_base.value(n);
00388   }
00389   inline double
00390   Options::restart_base(void) const {
00391     return _r_base.value();
00392   }
00393 
00394   inline void
00395   Options::restart_scale(unsigned int n) {
00396     _r_scale.value(n);
00397   }
00398   inline unsigned int
00399   Options::restart_scale(void) const {
00400     return _r_scale.value();
00401   }
00402 
00403   inline void
00404   Options::nogoods(bool b) {
00405     _nogoods.value(b);
00406   }
00407   inline bool
00408   Options::nogoods(void) const {
00409     return _nogoods.value();
00410   }
00411 
00412   inline void
00413   Options::nogoods_limit(unsigned int l) {
00414     _nogoods_limit.value(l);
00415   }
00416   inline unsigned int
00417   Options::nogoods_limit(void) const {
00418     return _nogoods_limit.value();
00419   }
00420 
00421   inline void
00422   Options::relax(double d) {
00423     _relax.value(d);
00424   }
00425   inline double
00426   Options::relax(void) const {
00427     return _relax.value();
00428   }
00429 
00430 
00431 
00432   inline void
00433   Options::interrupt(bool b) {
00434     _interrupt.value(b);
00435   }
00436   inline bool
00437   Options::interrupt(void) const {
00438     return _interrupt.value();
00439   }
00440 
00441 
00442   /*
00443    * Execution options
00444    *
00445    */
00446   inline void
00447   Options::mode(ScriptMode sm) {
00448     _mode.value(sm);
00449   }
00450   inline ScriptMode
00451   Options::mode(void) const {
00452     return static_cast<ScriptMode>(_mode.value());
00453   }
00454 
00455   inline void
00456   Options::samples(unsigned int s) {
00457     _samples.value(s);
00458   }
00459   inline unsigned int
00460   Options::samples(void) const {
00461     return _samples.value();
00462   }
00463 
00464   inline void
00465   Options::iterations(unsigned int i) {
00466     _iterations.value(i);
00467   }
00468   inline unsigned int
00469   Options::iterations(void) const {
00470     return _iterations.value();
00471   }
00472 
00473   inline void
00474   Options::print_last(bool p) {
00475     _print_last.value(p);
00476   }
00477   inline bool
00478   Options::print_last(void) const {
00479     return _print_last.value();
00480   }
00481 
00482   inline void
00483   Options::out_file(const char *f) {
00484     _out_file.value(f);
00485   }
00486 
00487   inline const char*
00488   Options::out_file(void) const {
00489     return _out_file.value();
00490   }
00491 
00492   inline void
00493   Options::log_file(const char* f) {
00494     _log_file.value(f);
00495   }
00496 
00497   inline const char*
00498   Options::log_file(void) const {
00499     return _log_file.value();
00500   }
00501 
00502   inline void
00503   Options::trace(int f) {
00504     _trace.value(f);
00505   }
00506 
00507   inline int
00508   Options::trace(void) const {
00509     return _trace.value();
00510   }
00511 
00512 #ifdef GECODE_HAS_GIST
00513   forceinline
00514   Options::_I::_I(void) : _click(heap,1), n_click(0),
00515     _solution(heap,1), n_solution(0), _move(heap,1), n_move(0),
00516     _compare(heap,1), n_compare(0) {}
00517 
00518   forceinline void
00519   Options::_I::click(Gist::Inspector* i) {
00520     _click[static_cast<int>(n_click++)] = i;
00521   }
00522   forceinline void
00523   Options::_I::solution(Gist::Inspector* i) {
00524     _solution[static_cast<int>(n_solution++)] = i;
00525   }
00526   forceinline void
00527   Options::_I::move(Gist::Inspector* i) {
00528     _move[static_cast<int>(n_move++)] = i;
00529   }
00530   forceinline void
00531   Options::_I::compare(Gist::Comparator* i) {
00532     _compare[static_cast<int>(n_compare++)] = i;
00533   }
00534   forceinline Gist::Inspector*
00535   Options::_I::click(unsigned int i) const {
00536     return (i < n_click) ? _click[i] : NULL;
00537   }
00538   forceinline Gist::Inspector*
00539   Options::_I::solution(unsigned int i) const {
00540     return (i < n_solution) ? _solution[i] : NULL;
00541   }
00542   forceinline Gist::Inspector*
00543   Options::_I::move(unsigned int i) const {
00544     return (i < n_move) ? _move[i] : NULL;
00545   }
00546   forceinline Gist::Comparator*
00547   Options::_I::compare(unsigned int i) const {
00548     return (i < n_compare) ? _compare[i] : NULL;
00549   }
00550 #endif
00551 
00552   /*
00553    * Options with additional size argument
00554    *
00555    */
00556   inline void
00557   SizeOptions::size(unsigned int s) {
00558     _size = s;
00559   }
00560   inline unsigned int
00561   SizeOptions::size(void) const {
00562     return _size;
00563   }
00564 
00565   /*
00566    * Options with additional string argument
00567    *
00568    */
00569   inline const char*
00570   InstanceOptions::instance(void) const {
00571     return _inst;
00572   }
00573 
00574 }
00575 
00576 // STATISTICS: driver-any