solver
CvxInfoPrinter.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include <memory>
16 
17 namespace solver {
18 
19  enum class Msg {
20  MatrixFactorization,
21  SearchDirection,
22  NumericalProblem,
23  LineSearchStagnation,
24  VariablesLeavingCone,
25  MaxItersReached,
26  OptimalityReached,
27  PrimalInfeasibility,
28  DualInfeasibility,
29  OptimizationProgress,
30  };
31 
36  {
37  public:
38  OptimizationInfo() : iteration_(-1){}
39  ~OptimizationInfo(){}
40 
41  bool isBetterThan(const OptimizationInfo& info) const;
42  OptimizationInfo& operator=(const OptimizationInfo& other);
43 
44  int& get(const SolverIntParam& param);
45  double& get(const SolverDoubleParam& param);
46  PrecisionConvergence& mode() { return mode_; }
47 
48  const int& get(const SolverIntParam& param) const;
49  const double& get(const SolverDoubleParam& param) const;
50  const PrecisionConvergence& mode() const { return mode_; }
51 
52  private:
53  PrecisionConvergence mode_;
54  int iteration_, linear_solve_refinements_, affine_linear_solve_refinements_, correction_linear_solve_refinements_;
55  double primal_cost_, dual_cost_, primal_residual_, dual_residual_, primal_infeasibility_, dual_infeasibility_,
56  tau_, kappa_, kappa_over_tau_, merit_function_, duality_gap_, relative_duality_gap_, correction_step_length_,
57  step_length_, affine_step_length;
58  };
59 
61  {
62  public:
63  CvxInfoPrinter(){}
64  ~CvxInfoPrinter(){}
65 
66  void initialize(const SolverSetting& stgs) { stgs_ = std::make_shared<SolverSetting>(stgs); }
67  void display(const Msg& msg, const OptimizationInfo& info);
68 
69  private:
70  std::shared_ptr<SolverSetting> stgs_;
71  };
72 }
SolverIntParam
Definition: SolverParams.hpp:14
SolverDoubleParam
Definition: SolverParams.hpp:47
Definition: CvxInfoPrinter.hpp:60
Class that provides access to all environment variables required by the solver.
Definition: SolverSetting.hpp:43
Definition: Cone.hpp:20
Helper class that contains information about the status of the optimization problem.
Definition: CvxInfoPrinter.hpp:35
ECOS - Embedded Conic Solver.