solver
SolverSetting.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include <string>
15 #include <limits>
17 
18 namespace solver {
19 
20  enum class ExitCode {
21  Optimal,
22  OptimalInacc,
23  PrimalInf,
24  PrimalInfInacc,
25  DualInf,
26  DualInfInacc,
27  ReachMaxIters,
28  NotConverged,
29  Indeterminate,
30  PrSearchDirection,
31  PrSlacksLeaveCone,
32  PrProjection,
33  };
34 
35  enum class ConeStatus { Inside, Outside };
36  enum class FactStatus { Optimal, Failure };
37  enum class PrecisionConvergence { Full, Reduced };
38  enum class QuadConstrApprox { None, TrustRegion, SoftConstraint };
39 
44  {
45  public:
46  SolverSetting(){}
47  ~SolverSetting(){}
48 
49  void initialize(const std::string cfg_file, const std::string solver_vars_yaml = "solver_variables");
50 
51  int get(SolverIntParam param) const;
52  bool get(SolverBoolParam param) const;
53  double get(SolverDoubleParam param) const;
54 
55  void set(SolverIntParam param, int value);
56  void set(SolverBoolParam param, bool value);
57  void set(SolverDoubleParam param, double value);
58 
59  static constexpr double nan = ((double)0x7ff8000000000000);
60  static constexpr double inf = ((double)std::numeric_limits<double>::infinity());
61 
62  private:
63  // Branch and Bound solver
64  bool BnB_verbose_;
65  int BnB_max_iterations_;
66  double BnB_integer_tolerance_, BnB_absolute_suboptimality_gap_, BnB_relative_suboptimality_gap_;
67 
68  // Convergence tolerances
69  double feasibility_tolerance_, absolute_suboptimality_gap_, relative_suboptimality_gap_,
70  feasibility_tolerance_inaccurate_, absolute_suboptimality_gap_inaccurate_, relative_suboptimality_gap_inaccurate_;
71 
72  // Equilibration parameters
73  int equil_iterations_;
74 
75  // Linear System parameters
76  int num_iter_ref_lin_solve_;
77  double dyn_reg_thresh_, lin_sys_accuracy_, err_reduction_factor_, static_regularization_, dynamic_regularization_;
78 
79  // Algorithm parameters
80  double safeguard_, min_step_length_, max_step_length_, min_centering_step_, max_centering_step_, step_length_scaling_;
81 
82  // Model parameters
83  bool verbose_;
84  double trust_region_threshold_, soft_constraint_weight_full_, soft_constraint_weight_reduced_;
85  int max_iters_, num_itrefs_trustregion_, ipsolver_warm_iters_, ipsolver_max_iters_;
86  };
87 
88 }
SolverIntParam
Definition: SolverParams.hpp:14
SolverDoubleParam
Definition: SolverParams.hpp:47
Class that provides access to all environment variables required by the solver.
Definition: SolverSetting.hpp:43
Definition: Cone.hpp:20
SolverBoolParam
Definition: SolverParams.hpp:41