SolverOptions.h
Go to the documentation of this file.
1 /* Copyright 2020 CNRS-AIST JRL */
2 
3 #pragma once
4 
5 #include <iosfwd>
6 #include <string>
7 
8 #include <jrl-qp/api.h>
9 #include <jrl-qp/enums.h>
10 
11 namespace jrl::qp
12 {
15 {
16  int maxIter_ = 500;
17  double bigBnd_ = 1e100;
18  bool warmStart_ = false;
19  std::uint32_t logFlags_ = 0;
20  std::ostream * logStream_ = &defaultStream_;
21 
22  static std::ostream & defaultStream_;
23 
24  std::uint32_t logFlags() const
25  {
26  return logFlags_;
27  }
29  {
30  logFlags_ = static_cast<std::uint32_t>(f);
31  return *this;
32  };
33  SolverOptions & logFlags(std::uint32_t f)
34  {
35  logFlags_ = f;
36  return *this;
37  };
39  {
40  logFlags_ |= static_cast<std::uint32_t>(f);
41  return *this;
42  }
44  {
45  logFlags_ &= ~static_cast<std::uint32_t>(f);
46  return *this;
47  }
48 
49  int maxIter() const
50  {
51  return maxIter_;
52  }
54  {
55  maxIter_ = max;
56  return *this;
57  }
58 
59  double bigBnd() const
60  {
61  return bigBnd_;
62  }
63  SolverOptions & bigBnd(double big)
64  {
65  bigBnd_ = big;
66  return *this;
67  }
68 
69  bool warmStart() const
70  {
71  return warmStart_;
72  }
73  SolverOptions & warmStart(bool warm)
74  {
75  warmStart_ = warm;
76  return *this;
77  }
78 
79  std::ostream & logStream() const
80  {
81  return *logStream_;
82  }
83  SolverOptions & logStream(std::ostream & os)
84  {
85  logStream_ = &os;
86  return *this;
87  }
88 };
89 } // namespace jrl::qp
jrl::qp::SolverOptions::warmStart
bool warmStart() const
Definition: SolverOptions.h:69
jrl::qp::SolverOptions
Definition: SolverOptions.h:14
jrl::qp::SolverOptions::logFlags
SolverOptions & logFlags(std::uint32_t f)
Definition: SolverOptions.h:33
jrl::qp::SolverOptions::bigBnd
double bigBnd() const
Definition: SolverOptions.h:59
jrl::qp::SolverOptions::warmStart
SolverOptions & warmStart(bool warm)
Definition: SolverOptions.h:73
jrl::qp::SolverOptions::removeLogFlag
SolverOptions & removeLogFlag(LogFlags f)
Definition: SolverOptions.h:43
jrl::qp::SolverOptions::logStream
std::ostream & logStream() const
Definition: SolverOptions.h:79
jrl::qp::SolverOptions::maxIter
SolverOptions & maxIter(int max)
Definition: SolverOptions.h:53
jrl::qp::SolverOptions::logFlags
SolverOptions & logFlags(LogFlags f)
Definition: SolverOptions.h:28
jrl::qp::SolverOptions::bigBnd
SolverOptions & bigBnd(double big)
Definition: SolverOptions.h:63
jrl::qp
Definition: blockArrowLLT.h:12
jrl::qp::SolverOptions::logStream
SolverOptions & logStream(std::ostream &os)
Definition: SolverOptions.h:83
jrl::qp::SolverOptions::defaultStream_
static std::ostream & defaultStream_
Definition: SolverOptions.h:22
jrl::qp::SolverOptions::maxIter
int maxIter() const
Definition: SolverOptions.h:49
jrl::qp::LogFlags
LogFlags
Definition: enums.h:40
jrl::qp::SolverOptions::logFlags
std::uint32_t logFlags() const
Definition: SolverOptions.h:24
JRLQP_DLLAPI
#define JRLQP_DLLAPI
Definition: api.h:35
enums.h
jrl::qp::SolverOptions::addLogFlag
SolverOptions & addLogFlag(LogFlags f)
Definition: SolverOptions.h:38
api.h