options.hpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2004
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include <cstring>
namespace Gecode {
namespace Driver {
/*
* String option
*
*/
inline const char*
StringValueOption::value(void) const {
return cur;
}
/*
* String option
*
*/
inline
StringOption::StringOption(const char* o, const char* e, int v)
: BaseOption(o,e), cur(v), fst(NULL), lst(NULL) {}
inline void
StringOption::value(int v) {
cur = v;
}
inline int
StringOption::value(void) const {
return cur;
}
/*
* Integer option
*
*/
inline
IntOption::IntOption(const char* o, const char* e, int v)
: BaseOption(o,e), cur(v) {}
inline void
IntOption::value(int v) {
cur = v;
}
inline int
IntOption::value(void) const {
return cur;
}
/*
* Unsigned integer option
*
*/
inline
UnsignedIntOption::UnsignedIntOption(const char* o, const char* e,
unsigned int v)
: BaseOption(o,e), cur(v) {}
inline void
UnsignedIntOption::value(unsigned int v) {
cur = v;
}
inline unsigned int
UnsignedIntOption::value(void) const {
return cur;
}
/*
* Double option
*
*/
inline
DoubleOption::DoubleOption(const char* o, const char* e,
double v)
: BaseOption(o,e), cur(v) {}
inline void
DoubleOption::value(double v) {
cur = v;
}
inline double
DoubleOption::value(void) const {
return cur;
}
/*
* Bool option
*
*/
inline
BoolOption::BoolOption(const char* o, const char* e, bool v)
: BaseOption(o,e), cur(v) {}
inline void
BoolOption::value(bool v) {
cur = v;
}
inline bool
BoolOption::value(void) const {
return cur;
}
/*
* Integer propagation level option
*
*/
inline void
IplOption::value(IntPropLevel ipl) {
cur = ipl;
}
inline IntPropLevel
IplOption::value(void) const {
return cur;
}
/*
* Trace flag option
*
*/
inline void
TraceOption::value(int f) {
cur = f;
}
inline int
TraceOption::value(void) const {
return cur;
}
}
/*
* Options
*
*/
inline const char*
BaseOptions::name(void) const {
return _name;
}
/*
* Model options
*
*/
inline void
Options::model(int v) {
_model.value(v);
}
inline void
Options::model(int v, const char* o, const char* h) {
_model.add(v,o,h);
}
inline int
Options::model(void) const {
return _model.value();
}
inline void
Options::symmetry(int v) {
_symmetry.value(v);
}
inline void
Options::symmetry(int v, const char* o, const char* h) {
_symmetry.add(v,o,h);
}
inline int
Options::symmetry(void) const {
return _symmetry.value();
}
inline void
Options::propagation(int v) {
_propagation.value(v);
}
inline void
Options::propagation(int v, const char* o, const char* h) {
_propagation.add(v,o,h);
}
inline int
Options::propagation(void) const {
return _propagation.value();
}
inline void
Options::ipl(IntPropLevel i) {
_ipl.value(i);
}
inline IntPropLevel
Options::ipl(void) const {
return _ipl.value();
}
inline void
Options::branching(int v) {
_branching.value(v);
}
inline void
Options::branching(int v, const char* o, const char* h) {
_branching.add(v,o,h);
}
inline int
Options::branching(void) const {
return _branching.value();
}
inline void
Options::decay(double d) {
_decay.value(d);
}
inline double
Options::decay(void) const {
return _decay.value();
}
inline void
Options::seed(unsigned int s) {
_seed.value(s);
}
inline unsigned int
Options::seed(void) const {
return _seed.value();
}
inline void
Options::step(double s) {
_step.value(s);
}
inline double
Options::step(void) const {
return _step.value();
}
/*
* Search options
*
*/
inline void
Options::search(int v) {
_search.value(v);
}
inline void
Options::search(int v, const char* o, const char* h) {
_search.add(v,o,h);
}
inline int
Options::search(void) const {
return _search.value();
}
inline void
Options::solutions(unsigned int n) {
_solutions.value(n);
}
inline unsigned int
Options::solutions(void) const {
return _solutions.value();
}
inline void
Options::threads(double n) {
_threads.value(n);
}
inline double
Options::threads(void) const {
return _threads.value();
}
inline void
Options::c_d(unsigned int d) {
_c_d.value(d);
}
inline unsigned int
Options::c_d(void) const {
return _c_d.value();
}
inline void
Options::a_d(unsigned int d) {
_a_d.value(d);
}
inline unsigned int
Options::a_d(void) const {
return _a_d.value();
}
inline void
Options::d_l(unsigned int d) {
_d_l.value(d);
}
inline unsigned int
Options::d_l(void) const {
return _d_l.value();
}
inline void
Options::node(unsigned int n) {
_node.value(n);
}
inline unsigned int
Options::node(void) const {
return _node.value();
}
inline void
Options::fail(unsigned int n) {
_fail.value(n);
}
inline unsigned int
Options::fail(void) const {
return _fail.value();
}
inline void
Options::time(unsigned int t) {
_time.value(t);
}
inline unsigned int
Options::time(void) const {
return _time.value();
}
inline void
Options::assets(unsigned int n) {
_assets.value(n);
}
inline unsigned int
Options::assets(void) const {
return _assets.value();
}
inline void
Options::slice(unsigned int n) {
_slice.value(n);
}
inline unsigned int
Options::slice(void) const {
return _slice.value();
}
inline void
Options::restart(RestartMode rm) {
_restart.value(rm);
}
inline RestartMode
Options::restart(void) const {
return static_cast<RestartMode>(_restart.value());
}
inline void
Options::restart_base(double n) {
_r_base.value(n);
}
inline double
Options::restart_base(void) const {
return _r_base.value();
}
inline void
Options::restart_scale(unsigned int n) {
_r_scale.value(n);
}
inline unsigned int
Options::restart_scale(void) const {
return _r_scale.value();
}
inline void
Options::nogoods(bool b) {
_nogoods.value(b);
}
inline bool
Options::nogoods(void) const {
return _nogoods.value();
}
inline void
Options::nogoods_limit(unsigned int l) {
_nogoods_limit.value(l);
}
inline unsigned int
Options::nogoods_limit(void) const {
return _nogoods_limit.value();
}
inline void
Options::relax(double d) {
_relax.value(d);
}
inline double
Options::relax(void) const {
return _relax.value();
}
inline void
Options::interrupt(bool b) {
_interrupt.value(b);
}
inline bool
Options::interrupt(void) const {
return _interrupt.value();
}
/*
* Execution options
*
*/
inline void
Options::mode(ScriptMode sm) {
_mode.value(sm);
}
inline ScriptMode
Options::mode(void) const {
return static_cast<ScriptMode>(_mode.value());
}
inline void
Options::samples(unsigned int s) {
_samples.value(s);
}
inline unsigned int
Options::samples(void) const {
return _samples.value();
}
inline void
Options::iterations(unsigned int i) {
_iterations.value(i);
}
inline unsigned int
Options::iterations(void) const {
return _iterations.value();
}
inline void
Options::print_last(bool p) {
_print_last.value(p);
}
inline bool
Options::print_last(void) const {
return _print_last.value();
}
inline void
Options::out_file(const char *f) {
_out_file.value(f);
}
inline const char*
Options::out_file(void) const {
return _out_file.value();
}
inline void
Options::log_file(const char* f) {
_log_file.value(f);
}
inline const char*
Options::log_file(void) const {
return _log_file.value();
}
inline void
Options::trace(int f) {
_trace.value(f);
}
inline int
Options::trace(void) const {
return _trace.value();
}
#ifdef GECODE_HAS_CPPROFILER
/*
* Profiler options
*
*/
inline void
Options::profiler_id(int i) {
_profiler_id.value(i);
}
inline int
Options::profiler_id(void) const {
return _profiler_id.value();
}
inline void
Options::profiler_port(unsigned int p) {
_profiler_port.value(p);
}
inline unsigned int
Options::profiler_port(void) const {
return _profiler_port.value();
}
inline void
Options::profiler_info(bool b) {
_profiler_info.value(b);
}
inline bool
Options::profiler_info(void) const {
return _profiler_info.value();
}
#endif
#ifdef GECODE_HAS_GIST
forceinline
Options::_I::_I(void) : _click(heap,1), n_click(0),
_solution(heap,1), n_solution(0), _move(heap,1), n_move(0),
_compare(heap,1), n_compare(0) {}
forceinline void
Options::_I::click(Gist::Inspector* i) {
_click[static_cast<int>(n_click++)] = i;
}
forceinline void
Options::_I::solution(Gist::Inspector* i) {
_solution[static_cast<int>(n_solution++)] = i;
}
forceinline void
Options::_I::move(Gist::Inspector* i) {
_move[static_cast<int>(n_move++)] = i;
}
forceinline void
Options::_I::compare(Gist::Comparator* i) {
_compare[static_cast<int>(n_compare++)] = i;
}
forceinline Gist::Inspector*
Options::_I::click(unsigned int i) const {
return (i < n_click) ? _click[i] : NULL;
}
forceinline Gist::Inspector*
Options::_I::solution(unsigned int i) const {
return (i < n_solution) ? _solution[i] : NULL;
}
forceinline Gist::Inspector*
Options::_I::move(unsigned int i) const {
return (i < n_move) ? _move[i] : NULL;
}
forceinline Gist::Comparator*
Options::_I::compare(unsigned int i) const {
return (i < n_compare) ? _compare[i] : NULL;
}
#endif
/*
* Options with additional size argument
*
*/
inline void
SizeOptions::size(unsigned int s) {
_size = s;
}
inline unsigned int
SizeOptions::size(void) const {
return _size;
}
/*
* Options with additional string argument
*
*/
inline const char*
InstanceOptions::instance(void) const {
return _inst;
}
}
// STATISTICS: driver-any
Gecode::BaseOptions::_name
const char * _name
Script name.
Definition driver.hh:335
Gecode::BaseOptions::name
const char * name(void) const
Return name of script.
Definition options.hpp:166
Gecode::Driver::BaseOption::BaseOption
BaseOption(const char *o, const char *e)
Initialize for option o and explanation e.
Definition options.cpp:99
Gecode::Driver::BoolOption::cur
bool cur
Current value.
Definition driver.hh:271
Gecode::Driver::BoolOption::BoolOption
BoolOption(const char *o, const char *e, bool v=false)
Initialize for option o and explanation e and default value v.
Definition options.hpp:121
Gecode::Driver::BoolOption::value
bool value(void) const
Return current option value.
Definition options.hpp:128
Gecode::Driver::DoubleOption::value
double value(void) const
Return current option value.
Definition options.hpp:112
Gecode::Driver::DoubleOption::cur
double cur
Current value.
Definition driver.hh:251
Gecode::Driver::DoubleOption::DoubleOption
DoubleOption(const char *o, const char *e, double v=0)
Initialize for option o and explanation e and default value v.
Definition options.hpp:104
Gecode::Driver::IntOption::cur
int cur
Current value.
Definition driver.hh:211
Gecode::Driver::IntOption::value
int value(void) const
Return current option value.
Definition options.hpp:78
Gecode::Driver::IntOption::IntOption
IntOption(const char *o, const char *e, int v=0)
Initialize for option o and explanation e and default value v.
Definition options.hpp:71
Gecode::Driver::IplOption::cur
IntPropLevel cur
Current value.
Definition driver.hh:291
Gecode::Driver::IplOption::value
IntPropLevel value(void) const
Return current option value.
Definition options.hpp:141
Gecode::Driver::StringOption::cur
int cur
Current value.
Definition driver.hh:184
Gecode::Driver::StringOption::value
int value(void) const
Return current option value.
Definition options.hpp:62
Gecode::Driver::StringOption::StringOption
StringOption(const char *o, const char *e, int v=0)
Initialize for option o and explanation e and default value v.
Definition options.hpp:55
Gecode::Driver::StringOption::lst
Value * lst
Last option value.
Definition driver.hh:186
Gecode::Driver::StringOption::fst
Value * fst
First option value.
Definition driver.hh:185
Gecode::Driver::StringValueOption::value
const char * value(void) const
Return current option value.
Definition options.hpp:46
Gecode::Driver::StringValueOption::cur
const char * cur
Current value.
Definition driver.hh:153
Gecode::Driver::TraceOption::cur
int cur
Current value.
Definition driver.hh:311
Gecode::Driver::TraceOption::value
int value(void) const
Return current option value.
Definition options.hpp:155
Gecode::Driver::UnsignedIntOption::value
unsigned int value(void) const
Return current option value.
Definition options.hpp:95
Gecode::Driver::UnsignedIntOption::UnsignedIntOption
UnsignedIntOption(const char *o, const char *e, unsigned int v=0)
Initialize for option o and explanation e and default value v.
Definition options.hpp:87
Gecode::Driver::UnsignedIntOption::cur
unsigned int cur
Current value.
Definition driver.hh:231
Gecode::Gist::Comparator
Abstract base class for comparators.
Definition gist.hh:119
Gecode::Gist::Inspector
Abstract base class for inspectors.
Definition gist.hh:99
Gecode::InstanceOptions::_inst
const char * _inst
Instance string.
Definition driver.hh:698
Gecode::InstanceOptions::instance
const char * instance(void) const
Return instance name.
Definition options.hpp:599
Gecode::Options::_I::click
void click(Gist::Inspector *i)
Add inspector that reacts on node double clicks.
Definition options.hpp:548
Gecode::Options::_I::solution
void solution(Gist::Inspector *i)
Add inspector that reacts on each new solution that is found.
Definition options.hpp:552
Gecode::Options::_I::move
void move(Gist::Inspector *i)
Add inspector that reacts on each move of the cursor.
Definition options.hpp:556
Gecode::Options::_I::_I
_I(void)
Constructor.
Definition options.hpp:543
Gecode::Options::_I::compare
void compare(Gist::Comparator *i)
Add comparator.
Definition options.hpp:560
Gecode::Options::_relax
Driver::DoubleOption _relax
Probability to relax variable.
Definition driver.hh:398
Gecode::Options::nogoods
bool nogoods(void) const
Return whether nogoods are used.
Definition options.hpp:404
Gecode::Options::_log_file
Driver::StringValueOption _log_file
Where to print statistics.
Definition driver.hh:409
Gecode::Options::profiler_port
unsigned int profiler_port(void) const
Return profiler execution id.
Definition options.hpp:527
Gecode::Options::_model
Driver::StringOption _model
General model options.
Definition driver.hh:370
Gecode::Options::print_last
bool print_last(void) const
Return whether to print only last solution found.
Definition options.hpp:474
Gecode::Options::model
int model(void) const
Return model value.
Definition options.hpp:185
Gecode::Options::a_d
unsigned int a_d(void) const
Return adaptive recomputation distance.
Definition options.hpp:314
Gecode::Options::threads
double threads(void) const
Return number of parallel threads.
Definition options.hpp:296
Gecode::Options::symmetry
int symmetry(void) const
Return symmetry value.
Definition options.hpp:198
Gecode::Options::_mode
Driver::StringOption _mode
Script mode to run.
Definition driver.hh:404
Gecode::Options::_decay
Driver::DoubleOption _decay
Decay option.
Definition driver.hh:375
Gecode::Options::_nogoods_limit
Driver::UnsignedIntOption _nogoods_limit
Limit for no-good extraction.
Definition driver.hh:397
Gecode::Options::iterations
unsigned int iterations(void) const
Return number of iterations.
Definition options.hpp:465
Gecode::Options::_nogoods
Driver::BoolOption _nogoods
Whether to use no-goods.
Definition driver.hh:396
Gecode::Options::_slice
Driver::UnsignedIntOption _slice
Size of a portfolio slice.
Definition driver.hh:392
Gecode::Options::_trace
Driver::TraceOption _trace
Trace flags for tracing.
Definition driver.hh:410
Gecode::Options::_d_l
Driver::UnsignedIntOption _d_l
Discrepancy limit for LDS.
Definition driver.hh:387
Gecode::Options::_assets
Driver::UnsignedIntOption _assets
Number of assets in a portfolio.
Definition driver.hh:391
Gecode::Options::node
unsigned int node(void) const
Return node cutoff.
Definition options.hpp:332
Gecode::Options::propagation
int propagation(void) const
Return propagation value.
Definition options.hpp:211
Gecode::Options::_solutions
Driver::UnsignedIntOption _solutions
How many solutions.
Definition driver.hh:383
Gecode::Options::time
unsigned int time(void) const
Return time cutoff.
Definition options.hpp:350
Gecode::Options::seed
unsigned int seed(void) const
Return seed value.
Definition options.hpp:251
Gecode::Options::assets
unsigned int assets(void) const
Return slice size in a portfolio.
Definition options.hpp:359
Gecode::Options::mode
ScriptMode mode(void) const
Return mode.
Definition options.hpp:447
Gecode::Options::_iterations
Driver::UnsignedIntOption _iterations
How many iterations per sample.
Definition driver.hh:406
Gecode::Options::_search
Driver::StringOption _search
Search options.
Definition driver.hh:382
Gecode::Options::_propagation
Driver::StringOption _propagation
Propagation options.
Definition driver.hh:372
Gecode::Options::_ipl
Driver::IplOption _ipl
Integer propagation level.
Definition driver.hh:373
Gecode::Options::log_file
const char * log_file(void) const
Get file name for Gecode stats.
Definition options.hpp:494
Gecode::Options::_profiler_info
Driver::BoolOption _profiler_info
Whether solution information should be sent to the CPProfiler.
Definition driver.hh:415
Gecode::Options::_print_last
Driver::BoolOption _print_last
Print only last solution found.
Definition driver.hh:407
Gecode::Options::_c_d
Driver::UnsignedIntOption _c_d
Copy recomputation distance.
Definition driver.hh:385
Gecode::Options::c_d
unsigned int c_d(void) const
Return copy recomputation distance.
Definition options.hpp:305
Gecode::Options::_threads
Driver::DoubleOption _threads
How many threads to use.
Definition driver.hh:384
Gecode::Options::_branching
Driver::StringOption _branching
Branching options.
Definition driver.hh:374
Gecode::Options::search
int search(void) const
Return search value.
Definition options.hpp:278
Gecode::Options::_restart
Driver::StringOption _restart
Restart method option.
Definition driver.hh:393
Gecode::Options::profiler_info
bool profiler_info(void) const
Return whether solution info should be sent to profiler.
Definition options.hpp:535
Gecode::Options::_seed
Driver::UnsignedIntOption _seed
Seed option.
Definition driver.hh:376
Gecode::Options::_time
Driver::UnsignedIntOption _time
Cutoff for time.
Definition driver.hh:390
Gecode::Options::_step
Driver::DoubleOption _step
Step option.
Definition driver.hh:377
Gecode::Options::_profiler_port
Driver::UnsignedIntOption _profiler_port
Connect to this port.
Definition driver.hh:414
Gecode::Options::_r_scale
Driver::UnsignedIntOption _r_scale
Restart scale factor.
Definition driver.hh:395
Gecode::Options::_profiler_id
Driver::IntOption _profiler_id
Use this execution id for the CP-profiler.
Definition driver.hh:413
Gecode::Options::solutions
unsigned int solutions(void) const
Return number of solutions to search for.
Definition options.hpp:287
Gecode::Options::_interrupt
Driver::BoolOption _interrupt
Whether to catch SIGINT.
Definition driver.hh:399
Gecode::Options::_a_d
Driver::UnsignedIntOption _a_d
Adaptive recomputation distance.
Definition driver.hh:386
Gecode::Options::decay
double decay(void) const
Return decay factor.
Definition options.hpp:242
Gecode::Options::_r_base
Driver::DoubleOption _r_base
Restart base.
Definition driver.hh:394
Gecode::Options::_symmetry
Driver::StringOption _symmetry
General symmetry options.
Definition driver.hh:371
Gecode::Options::step
double step(void) const
Return step value.
Definition options.hpp:260
Gecode::Options::_out_file
Driver::StringValueOption _out_file
Where to print solutions.
Definition driver.hh:408
Gecode::Options::samples
unsigned int samples(void) const
Return number of samples.
Definition options.hpp:456
Gecode::Options::_node
Driver::UnsignedIntOption _node
Cutoff for number of nodes.
Definition driver.hh:388
Gecode::Options::fail
unsigned int fail(void) const
Return failure cutoff.
Definition options.hpp:341
Gecode::Options::profiler_id
int profiler_id(void) const
Return profiler execution id.
Definition options.hpp:519
Gecode::Options::d_l
unsigned int d_l(void) const
Return discrepancy limit for LDS.
Definition options.hpp:323
Gecode::Options::restart
RestartMode restart(void) const
Return restart mode.
Definition options.hpp:377
Gecode::Options::_samples
Driver::UnsignedIntOption _samples
How many samples.
Definition driver.hh:405
Gecode::Options::trace
int trace(void) const
Return trace flags.
Definition options.hpp:504
Gecode::Options::out_file
const char * out_file(void) const
Get file name for solutions.
Definition options.hpp:484
Gecode::Options::_fail
Driver::UnsignedIntOption _fail
Cutoff for number of failures.
Definition driver.hh:389
Gecode::Options::relax
double relax(void) const
Return default relax probability.
Definition options.hpp:422
Gecode::Options::interrupt
bool interrupt(void) const
Return interrupt behavior.
Definition options.hpp:433
Gecode::Options::slice
unsigned int slice(void) const
Return slice size in a portfolio.
Definition options.hpp:368
Gecode::Options::branching
int branching(void) const
Return branching value.
Definition options.hpp:233
Gecode::Options::nogoods_limit
unsigned int nogoods_limit(void) const
Return depth limit for nogoods.
Definition options.hpp:413
Gecode::Options::restart_base
double restart_base(void) const
Return restart base.
Definition options.hpp:386
Gecode::Options::ipl
IntPropLevel ipl(void) const
Return integer propagation level.
Definition options.hpp:220
Gecode::Options::restart_scale
unsigned int restart_scale(void) const
Return restart scale factor.
Definition options.hpp:395
Gecode::SizeOptions::size
unsigned int size(void) const
Return size.
Definition options.hpp:590
Gecode::SizeOptions::_size
unsigned int _size
Size value.
Definition driver.hh:677
Gecode::heap
Heap heap
The single global heap.
Definition heap.cpp:44
Gecode::ScriptMode
ScriptMode
Different modes for executing scripts.
Definition driver.hh:94
Gecode::RestartMode
RestartMode
Different modes for restart-based search.
Definition driver.hh:106
Gecode::IntPropLevel
IntPropLevel
Propagation levels for integer propagators.
Definition int.hh:974
Gecode::Driver
Script commandline driver.
Gecode
Gecode toplevel namespace
forceinline
#define forceinline
Definition config.hpp:187