Options for scripts with additional instance parameter More...
#include <gecode/driver.hh>
Public Member Functions | |
| InstanceOptions (const char *s) | |
| Initialize options for script with name s. | |
| InstanceOptions (const char *s, const char *spec) | |
| Initialize options for script s that reads instance files. | |
| virtual void | help (void) |
| Print help text. | |
| void | parse (int &argc, char *argv[]) |
| Parse options from arguments argv (number is argc). | |
| void | parse (int &argc, char *argv[], bool strict) |
| Parse options, optionally rejecting unrecognised arguments. | |
| void | parse_strict (int &argc, char *argv[]) |
Parse options with strict checking (equivalent to parse() with true). | |
| void | parse_permissive (int &argc, char *argv[]) |
Parse options partially (equivalent to parse() with false). | |
| void | instance (const char *s) |
| Set default instance name. | |
| const char * | instance (void) const |
| Return instance name. | |
| bool | builtin (unsigned int &i) const |
| Test whether the instance is the number of a built-in instance. | |
| void | spec (const char *s) |
| Set the reader spec for instance files. | |
| const char * | spec (void) const |
| Return the reader spec for instance files (may be null). | |
| void | spec_file (const char *f) |
| Set the file with a reader spec that replaces spec(). | |
| const char * | spec_file (void) const |
| Return the file with a reader spec (may be null). | |
| void | param (const char *p) |
Set the spec parameters (name=value, separated by commas). | |
| const char * | param (void) const |
| Return the spec parameters (may be null). | |
| bool | is_file (void) const |
| Test whether the instance names a readable file. | |
| Instance::Data | data (void) const |
| Read the instance file. | |
| ~InstanceOptions (void) | |
| Destructor. | |
| void | model (int v) |
| Set default model value. | |
| void | model (int v, const char *o, const char *h=nullptr) |
| Add model option value for value v, string o, and help h. | |
| int | model (void) const |
| Return model value. | |
| void | symmetry (int v) |
| Set default symmetry value. | |
| void | symmetry (int v, const char *o, const char *h=nullptr) |
| Add symmetry option value for value v, string o, and help h. | |
| int | symmetry (void) const |
| Return symmetry value. | |
| void | propagation (int v) |
| Set default propagation value. | |
| void | propagation (int v, const char *o, const char *h=nullptr) |
| Add propagation option value for value v, string o, and help h. | |
| int | propagation (void) const |
| Return propagation value. | |
| void | ipl (IntPropLevel i) |
| Set default integer propagation level. | |
| IntPropLevel | ipl (void) const |
| Return integer propagation level. | |
| void | branching (int v) |
| Set default branching value. | |
| void | branching (int v, const char *o, const char *h=nullptr) |
| Add branching option value for value v, string o, and help h. | |
| int | branching (void) const |
| Return branching value. | |
| void | decay (double d) |
| Set default decay factor. | |
| double | decay (void) const |
| Return decay factor. | |
| void | seed (unsigned int s) |
| Set default seed value. | |
| unsigned int | seed (void) const |
| Return seed value. | |
| void | step (double s) |
| Set default step value. | |
| double | step (void) const |
| Return step value. | |
| void | search (int v) |
| Set default search value. | |
| void | search (int v, const char *o, const char *h=nullptr) |
| Add search option value for value v, string o, and help h. | |
| int | search (void) const |
| Return search value. | |
| void | solutions (unsigned long long int n) |
| Set default number of solutions to search for. | |
| unsigned long long int | solutions (void) const |
| Return number of solutions to search for. | |
| void | threads (double n) |
| Set number of parallel threads. | |
| double | threads (void) const |
| Return number of parallel threads. | |
| void | c_d (unsigned int d) |
| Set default copy recomputation distance. | |
| unsigned int | c_d (void) const |
| Return copy recomputation distance. | |
| void | a_d (unsigned int d) |
| Set default adaptive recomputation distance. | |
| unsigned int | a_d (void) const |
| Return adaptive recomputation distance. | |
| void | d_l (unsigned int d) |
| Set default discrepancy limit for LDS. | |
| unsigned int | d_l (void) const |
| Return discrepancy limit for LDS. | |
| void | node (unsigned long long int n) |
| Set default node cutoff. | |
| unsigned long long int | node (void) const |
| Return node cutoff. | |
| void | fail (unsigned long long int n) |
| Set default failure cutoff. | |
| unsigned long long int | fail (void) const |
| Return failure cutoff. | |
| void | time (double t) |
| Set default time cutoff. | |
| double | time (void) const |
| Return time cutoff. | |
| void | assets (unsigned int n) |
| Set default number of assets in a portfolio. | |
| unsigned int | assets (void) const |
| Return slice size in a portfolio. | |
| void | slice (unsigned int n) |
| Set default slice size in a portfolio. | |
| unsigned int | slice (void) const |
| Return slice size in a portfolio. | |
| void | restart (RestartMode r) |
| Set default restart mode. | |
| RestartMode | restart (void) const |
| Return restart mode. | |
| void | restart_base (double base) |
| Set default restart base. | |
| double | restart_base (void) const |
| Return restart base. | |
| void | restart_scale (unsigned int scale) |
| Set default restart scale factor. | |
| unsigned int | restart_scale (void) const |
| Return restart scale factor. | |
| void | restart_limit (unsigned long long int n) |
| Set default restart cutoff. | |
| unsigned long long int | restart_limit (void) const |
| Return restart cutoff. | |
| void | nogoods (bool b) |
| Set default nogoods posting behavior. | |
| bool | nogoods (void) const |
| Return whether nogoods are used. | |
| void | nogoods_limit (unsigned int l) |
| Set default nogoods depth limit. | |
| unsigned int | nogoods_limit (void) const |
| Return depth limit for nogoods. | |
| void | relax (double d) |
| Set default relax probability. | |
| double | relax (void) const |
| Return default relax probability. | |
| void | interrupt (bool b) |
| Set default interrupt behavior. | |
| bool | interrupt (void) const |
| Return interrupt behavior. | |
| Options (const char *s) | |
| Initialize options for script with name s. | |
| void | mode (ScriptMode em) |
| Set default mode. | |
| ScriptMode | mode (void) const |
| Return mode. | |
| void | samples (unsigned int s) |
| Set default number of samples. | |
| unsigned int | samples (void) const |
| Return number of samples. | |
| void | iterations (unsigned int i) |
| Set default number of iterations. | |
| unsigned int | iterations (void) const |
| Return number of iterations. | |
| void | print_last (bool p) |
| Set whether to print only last solution found. | |
| bool | print_last (void) const |
| Return whether to print only last solution found. | |
| void | out_file (const char *f) |
| Set default output file name for solutions. | |
| const char * | out_file (void) const |
| Get file name for solutions. | |
| void | log_file (const char *f) |
| Set default output file name for Gecode stats. | |
| const char * | log_file (void) const |
| Get file name for Gecode stats. | |
| void | trace (int f) |
| Set trace flags. | |
| int | trace (void) const |
| Return trace flags. | |
| void | profiler_id (int i) |
| Set profiler execution identifier. | |
| int | profiler_id (void) const |
| Return profiler execution id. | |
| void | profiler_port (unsigned int p) |
| Set profiler port. | |
| unsigned int | profiler_port (void) const |
| Return profiler execution id. | |
| void | guidance (const Search::HeuristicGuidance *g) |
| Set guidance for heuristic search (not copied). | |
| const Search::HeuristicGuidance * | guidance (void) const |
| Return guidance for heuristic search. | |
| Public Member Functions inherited from Gecode::BaseOptions | |
| BaseOptions (const char *s) | |
| Initialize options for script with name s. | |
| void | add (Driver::BaseOption &o) |
| Add new option o. | |
| void | parse (int &argc, char *argv[]) |
| Parse options from arguments argv (number is argc). | |
| void | parse (int &argc, char *argv[], bool strict) |
| Parse options, optionally rejecting unrecognised arguments. | |
| void | parse_strict (int &argc, char *argv[]) |
Parse options with strict checking (equivalent to parse() with true). | |
| void | parse_permissive (int &argc, char *argv[]) |
Parse options partially (equivalent to parse() with false). | |
| const char * | name (void) const |
| Return name of script. | |
| void | name (const char *) |
| Set name of script. | |
| virtual | ~BaseOptions (void) |
| Destructor. | |
Protected Member Functions | |
| void | forget (void) const |
Additional Inherited Members | |
| class Gecode::Options::I_ | inspect |
| Set guidance for heuristic search (not copied). | |
Detailed Description
Options for scripts with additional instance parameter
The instance is given as the last command line argument. It is either the name of an instance built into the script, or an instance file. A script that reads instance files gives the reader spec for its file format (see Instance::Spec) to the constructor, for example
The option -spec then reads instance files with the spec in another file instead, and -param gives a value to one of the spec's parameters as name=value (for example instance=3 to select an instance in a file with several instances). For several parameters, -param is given several times, or the pairs are separated by commas as in -param a=1,b=2. A script may rely on the checks in its own spec, so a replacement spec must define the same data and is responsible for the same checks.
Reading an instance reports errors by throwing Instance::Error; the command line itself is parsed as for all options. The driver library requires the instance library.
Constructor & Destructor Documentation
◆ InstanceOptions() [1/2]
| Gecode::InstanceOptions::InstanceOptions | ( | const char * | s | ) |
Initialize options for script with name s.
Definition at line 783 of file options.cpp.
◆ InstanceOptions() [2/2]
| Gecode::InstanceOptions::InstanceOptions | ( | const char * | s, |
| const char * | spec ) |
Initialize options for script s that reads instance files.
Instance files are read with the reader spec spec. Only scripts created with this constructor accept the options -spec and -param.
Definition at line 788 of file options.cpp.
◆ ~InstanceOptions()
| Gecode::InstanceOptions::~InstanceOptions | ( | void | ) |
Destructor.
Definition at line 912 of file options.cpp.
Member Function Documentation
◆ forget()
|
protected |
Definition at line 795 of file options.cpp.
◆ help()
|
virtual |
Print help text.
Reimplemented from Gecode::BaseOptions.
Reimplemented in JobShopOptions.
Definition at line 826 of file options.cpp.
◆ parse() [1/2]
| void Gecode::InstanceOptions::parse | ( | int & | argc, |
| char * | argv[] ) |
Parse options from arguments argv (number is argc).
Definition at line 833 of file options.cpp.
◆ parse() [2/2]
| void Gecode::InstanceOptions::parse | ( | int & | argc, |
| char * | argv[], | ||
| bool | strict ) |
Parse options, optionally rejecting unrecognised arguments.
With strict set to true, the only argument that may remain after the options is the instance. An argument that starts with a hyphen is an unrecognised option rather than an instance. Any other remaining argument causes an error message and help text to be printed, followed by exit with failure.
Definition at line 843 of file options.cpp.
◆ parse_strict()
|
inline |
Parse options with strict checking (equivalent to parse() with true).
Definition at line 657 of file options.hpp.
◆ parse_permissive()
|
inline |
Parse options partially (equivalent to parse() with false).
Definition at line 661 of file options.hpp.
◆ instance() [1/2]
| void Gecode::InstanceOptions::instance | ( | const char * | s | ) |
Set default instance name.
Definition at line 800 of file options.cpp.
◆ instance() [2/2]
|
inline |
Return instance name.
Definition at line 666 of file options.hpp.
◆ builtin()
| bool Gecode::InstanceOptions::builtin | ( | unsigned int & | i | ) | const |
Test whether the instance is the number of a built-in instance.
Returns true and sets i to the number if the instance is a non-negative decimal number of at most nine digits (so that it cannot overflow). Otherwise returns false and leaves i unchanged. Whether there is a built-in instance with that number is up to the script.
Definition at line 862 of file options.cpp.
◆ spec() [1/2]
| void Gecode::InstanceOptions::spec | ( | const char * | s | ) |
Set the reader spec for instance files.
Definition at line 807 of file options.cpp.
◆ spec() [2/2]
|
inline |
Return the reader spec for instance files (may be null).
Definition at line 671 of file options.hpp.
◆ spec_file() [1/2]
| void Gecode::InstanceOptions::spec_file | ( | const char * | f | ) |
Set the file with a reader spec that replaces spec().
Definition at line 814 of file options.cpp.
◆ spec_file() [2/2]
|
inline |
Return the file with a reader spec (may be null).
Definition at line 676 of file options.hpp.
◆ param() [1/2]
| void Gecode::InstanceOptions::param | ( | const char * | p | ) |
Set the spec parameters (name=value, separated by commas).
Definition at line 820 of file options.cpp.
◆ param() [2/2]
|
inline |
Return the spec parameters (may be null).
Definition at line 681 of file options.hpp.
◆ is_file()
| bool Gecode::InstanceOptions::is_file | ( | void | ) | const |
Test whether the instance names a readable file.
Definition at line 882 of file options.cpp.
◆ data()
| Instance::Data Gecode::InstanceOptions::data | ( | void | ) | const |
Read the instance file.
The file is read once; later calls return the same data. Throws Instance::Error if there is no spec, if the file cannot be read, or if it does not match the spec.
Definition at line 893 of file options.cpp.
Member Data Documentation
◆ _inst
|
protected |
◆ _spec
|
protected |
◆ _spec_file
|
protected |
◆ _param
|
protected |
◆ _data
|
mutableprotected |
The documentation for this class was generated from the following files:
- gecode/driver.hh
- gecode/driver/options.cpp
- gecode/driver/options.hpp
