Scippy

SCIP

Solving Constraint Integer Programs

cmd_line_args.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program PolySCIP */
4 /* */
5 /* Copyright (C) 2012-2022 Konrad-Zuse-Zentrum */
6 /* fuer Informationstechnik Berlin */
7 /* */
8 /* PolySCIP is distributed under the terms of the ZIB Academic License. */
9 /* */
10 /* You should have received a copy of the ZIB Academic License */
11 /* along with PolySCIP; see the file LICENCE. */
12 /* */
13 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
14 
15 /**
16  * @file cmd_line_args.h
17  * @brief PolySCIP command line arguments
18  * @author Sebastian Schenker
19  *
20  */
21 
22 #ifndef POLYSCIP_SRC_CMD_LINE_ARGS_H_INCLUDED
23 #define POLYSCIP_SRC_CMD_LINE_ARGS_H_INCLUDED
24 
25 #include <string>
26 #include <limits>
27 
28 namespace polyscip {
29 
30  /**
31  * @class CmdLineArgs
32  * @brief Command line arguments for PolySCIP
33  */
34  class CmdLineArgs {
35  public:
36  /// Value type used for cmd line parameter -t | - - timeLimit
37  using TimeLimitType = long;
38 
39  /// Constant used for default value of cmd line parameter -t | - - timeLimit
40  constexpr static auto kTimeLimitInf = std::numeric_limits<TimeLimitType>::max();
41 
42  /**
43  * Constructor
44  * @param argc Argument count
45  * @param argv Argument vector
46  */
47  CmdLineArgs(int argc, const char *const *argv);
48 
49  /**
50  * For cmd line parameter -v | - -verbose
51  * @return true if -v was set on cmd line
52  */
53  bool beVerbose() const {return be_verbose_;};
54 
55  /**
56  * For cmd line parameter -x | - -extremal
57  * @return true if -x was set on cmd line
58  */
59  bool onlyExtremal() const {return only_extremal_;};
60 
61  /**
62  * For cmd line parameter -w | - -writeResults
63  * @return true if -w was set on cmd line
64  */
65  bool writeResults() const {return write_results_;};
66 
67  /**
68  * For cmd line parameter -o | - -noOutcomes
69  * @return false if -o was set on cmd line
70  */
71  bool outputOutcomes() const { return output_outcomes_;};
72 
73  /**
74  * For cmd line parameter -s | - -noSolutions
75  * @return false if -s was set on cmd line
76  */
77  bool outputSols() const {return output_solutions_;};
78 
79  /**
80  * For cmd line parameter -t | - -timeLimit
81  * @return true if -t "<seconds>" was set on cmd line
82  */
83  bool hasTimeLimit() const {return time_limit_ != kTimeLimitInf;}
84 
85  /**
86  * For cmd line parameter -p | - -params
87  * @return true if -p <paramFile.set> was set on cmd line
88  */
89  bool hasParameterFile() const {return !param_file_.empty();};
90 
91  /**
92  * For cmd line parameter -r | - -round
93  * @return corresponding integer if -r <5|10|15> was set on cmd line
94  */
95  int roundWeightedObjCoeff() const {return round_weighted_obj_coeff_;};
96 
97  /**
98  * For cmd line parameter -t | - -timeLimit
99  * @return corresponding seconds given for parameter -t "<seconds>"
100  */
101  TimeLimitType getTimeLimit() const {return time_limit_;};
102 
103  /**
104  * For cmd line parameter -d | - -delta
105  * @return corresponding double value given for -d "<double>"
106  */
107  double getDelta() const {return delta_;};
108 
109  /**
110  * For cmd line parameter -e | - -epsilon
111  * @return corresponding double value given for -e "<double>"
112  */
113  double getEpsilon() const {return epsilon_;};
114 
115  /**
116  * For cmd line parameter -p | - -params
117  * @return corresponding parameter file given for -p "<paramFile.set>"
118  */
119  std::string getParameterFile() const {return param_file_;};
120 
121  /**
122  * For cmd line argument problemFile.mop
123  * @return corresponding problem file given for "<problemFile.mop>" on cmd line
124  */
125  std::string getProblemFile() const {return prob_file_;};
126 
127  /**
128  * For cmd line parameter -W | - -writeSolsPath
129  * @return corresponding path given -W "<PATH>"
130  */
131  std::string getWritePath() const {return write_results_path_;};
132 
133  private:
134  std::string executable_name_; ///< Name of the executable binary
135  std::string version_no_; ///< Current version number of PolySCIP
136  bool be_verbose_; ///< -v parameter value
137  bool only_extremal_; ///< -e parameter value
138  bool write_results_; ///< -w paramter value
139  bool output_solutions_; ///< -s paramter value
140  bool output_outcomes_; ///< -o parameter value
141  int round_weighted_obj_coeff_; ///< -r parameter value
142  TimeLimitType time_limit_; ///< -t parameter value
143  double delta_; ///< -d parameter value
144  double epsilon_; ///< -e parameter value
145  std::string param_file_; ///< -p parameter value
146  std::string prob_file_; ///< Name of the given problem file
147  std::string write_results_path_; ///< Path where result file is written to
148  };
149 
150 }
151 #endif //POLYSCIP_SRC_CMD_LINE_ARGS_H_INCLUDED
bool outputOutcomes() const
Definition: cmd_line_args.h:71
bool hasParameterFile() const
Definition: cmd_line_args.h:89
bool beVerbose() const
Definition: cmd_line_args.h:53
static constexpr auto kTimeLimitInf
Constant used for default value of cmd line parameter -t | - - timeLimit.
Definition: cmd_line_args.h:40
bool writeResults() const
Definition: cmd_line_args.h:65
TimeLimitType getTimeLimit() const
bool hasTimeLimit() const
Definition: cmd_line_args.h:83
Command line arguments for PolySCIP.
Definition: cmd_line_args.h:34
double getEpsilon() const
double getDelta() const
CmdLineArgs(int argc, const char *const *argv)
bool outputSols() const
Definition: cmd_line_args.h:77
int roundWeightedObjCoeff() const
Definition: cmd_line_args.h:95
long TimeLimitType
Value type used for cmd line parameter -t | - - timeLimit.
Definition: cmd_line_args.h:37
std::string getProblemFile() const
std::string getParameterFile() const
bool onlyExtremal() const
Definition: cmd_line_args.h:59
std::string getWritePath() const