knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
ModalFormula.h
Go to the documentation of this file.
1 /*
2  * This file is part of KnowRob, please consult
3  * https://github.com/knowrob/knowrob for license details.
4  */
5 
6 #ifndef KNOWROB_MODAL_FORMULA_H
7 #define KNOWROB_MODAL_FORMULA_H
8 
9 #include "CompoundFormula.h"
10 #include "ModalOperator.h"
11 #include "knowrob/TimeInterval.h"
12 
13 namespace knowrob {
17  class ModalFormula : public CompoundFormula {
18  public:
25 
29  const ModalOperatorPtr &modalOperator() const { return modalOperator_; }
30 
34  const FormulaPtr &modalFormula() const { return formulae_[0]; }
35 
39  bool isModalPossibility() const { return !isModalNecessity(); }
40 
44  bool isModalNecessity() const;
45 
46  // Override CompoundFormula
47  const char *operator_symbol() const override;
48 
49  // Override Formula
50  void write(std::ostream &os) const override;
51 
52  protected:
54 
55  bool isEqual(const Formula &other) const override;
56  };
57 
58  namespace modals {
64  std::shared_ptr<ModalFormula> B(const FormulaPtr &phi);
65 
70 
75  ModalOperatorPtr B(std::string_view perspective);
76 
82  ModalOperatorPtr B(std::string_view perspective, double confidence);
83 
87  ModalOperatorPtr B(double confidence);
88 
94  std::shared_ptr<ModalFormula> K(const FormulaPtr &phi);
95 
100 
105  ModalOperatorPtr K(std::string_view perspective);
106 
112  std::shared_ptr<ModalFormula> P(const FormulaPtr &phi);
113 
118 
122  ModalOperatorPtr P(const TimeInterval &timeInterval);
123 
129  std::shared_ptr<ModalFormula> H(const FormulaPtr &phi);
130 
135 
139  ModalOperatorPtr H(const TimeInterval &timeInterval);
140  } // modals
141 } // knowrob
142 
143 
144 #endif // KNOWROB_MODAL_FORMULA_H
const std::vector< FormulaPtr > formulae_
bool isEqual(const Formula &other) const override
bool isModalNecessity() const
bool isModalPossibility() const
Definition: ModalFormula.h:39
const ModalOperatorPtr & modalOperator() const
Definition: ModalFormula.h:29
void write(std::ostream &os) const override
bool isModalNecessity() const
const char * operator_symbol() const override
ModalFormula(ModalOperatorPtr modalOperator, const FormulaPtr &formula)
const ModalOperatorPtr modalOperator_
Definition: ModalFormula.h:53
const FormulaPtr & modalFormula() const
Definition: ModalFormula.h:34
std::shared_ptr< ModalFormula > K(const FormulaPtr &phi)
std::shared_ptr< ModalFormula > P(const FormulaPtr &phi)
std::shared_ptr< ModalFormula > B(const FormulaPtr &phi)
std::shared_ptr< ModalFormula > H(const FormulaPtr &phi)
FormulaRule & formula()
Definition: formula.cpp:283
std::shared_ptr< Formula > FormulaPtr
Definition: Formula.h:99
std::shared_ptr< const ModalOperator > ModalOperatorPtr