4 #include "../formula/Formula.h"
6 #include <bliss/graph.hh>
27 template<
typename Number>
32 std::map<carl::VariableType, unsigned>
mVT;
33 std::map<carl::Relation, unsigned>
mRel;
34 std::map<carl::FormulaType, unsigned>
mFT;
40 unsigned findOrInsert(std::map<T,unsigned>& container,
const T& value) {
41 auto it = container.emplace(value,
nextID);
43 return it.first->second;
70 std::vector<std::vector<unsigned>>
data;
73 void addGenerator(
void* p,
const unsigned int n,
const unsigned int* aut) {
74 static_cast<Permutation*
>(p)->data.emplace_back(aut, aut+n);
77 template<
typename Poly>
79 using Number =
typename Poly::NumberType;
86 assert(
mColor.next() == 0);
89 for (
const auto& v: vars) {
91 assert(res.first->second ==
mVariables.size());
98 for (
const auto& ve: *t.
monomial()) {
99 for (std::size_t i = 0; i < ve.second; ++i) {
101 mGraph.add_edge(vert, tmp);
110 for (
const auto& term: c.
lhs()) {
120 mGraph.add_edge(vert, ifvert);
123 mGraph.add_edge(vert, thenvert);
126 mGraph.add_edge(vert, elsevert);
146 mGraph.add_edge(vert, idvert);
181 for (
const auto& s: p.
data) {
182 bool foundChange =
false;
184 for (
unsigned i = 0; i <
mVariables.size(); ++i) {
187 if (s[i] != i) foundChange =
true;
190 varsymms.emplace_back(tmp);
carl is the main namespace for the library.
FormulaType
Represent the type of a formula to allow faster/specialized processing.
VariableType
Several types of variables are supported.
void variables(const BasicConstraint< Pol > &c, carlVariables &vars)
std::vector< std::pair< Variable, Variable > > Symmetry
A symmetry represents a bijection on a set of variables.
std::vector< Symmetry > Symmetries
Represents a list of symmetries.
void addGenerator(void *p, const unsigned int n, const unsigned int *aut)
SpecialColors
Special colors for structure nodes.
Represents a single term, that is a numeric coefficient and a monomial.
Coefficient & coeff()
Get the coefficient.
Monomial::Arg & monomial()
Get the monomial.
Represent a polynomial (in)equality against zero.
Relation relation() const
const Formula & subformula() const
carl::Variable::Arg boolean() const
const Constraint< Pol > & constraint() const
const Formulas< Pol > & subformulas() const
const Formula & first_case() const
const Formula & second_case() const
const Formula & condition() const
Provides unique ids (colors) for all kinds of different objects in the formula: variable types,...
std::map< carl::FormulaType, unsigned > mFT
unsigned operator()(carl::Relation v)
std::map< std::size_t, unsigned > mIndexes
std::map< SpecialColors, unsigned > mSpecial
std::map< Number, unsigned > mConst
unsigned operator()(const Number &v)
unsigned findOrInsert(std::map< T, unsigned > &container, const T &value)
std::map< carl::Relation, unsigned > mRel
unsigned operator()(SpecialColors v)
unsigned operator()(carl::FormulaType v)
unsigned operator()(std::size_t v)
unsigned operator()(carl::VariableType v)
std::map< carl::VariableType, unsigned > mVT
std::vector< std::vector< unsigned > > data
std::vector< carl::Variable > mVariables
unsigned addTerm(const Term< Number > &t)
typename Poly::NumberType Number
unsigned addFormula(const Formula< Poly > &f)
ColorGenerator< Number > mColor
void gatherVariables(const Formula< Poly > &f)
std::map< carl::Variable, unsigned > mVariableIDs
GraphBuilder(const Formula< Poly > &f)
unsigned addConstraint(const Constraint< Poly > &c)