ExactConstraintSatisfaction.hh 1.86 KB
Newer Older
1
2
3
4
#ifndef EXACTCONSTRAINTSATISFACTION_HH
#define EXACTCONSTRAINTSATISFACTION_HH

#include <CoMISo/Config/config.hh>
Robin Brost's avatar
Robin Brost committed
5
#include <CoMISo/Config/CoMISoDefines.hh>
6
7
8

#include <CoMISo/NSolver/NProblemInterface.hh>
#include <vector>
9
#include <list>
10

Robin Brost's avatar
Robin Brost committed
11
class COMISODLLEXPORT ExactConstraintSatisfaction
12
13
14
15
{
public:
    ExactConstraintSatisfaction();

16
17
    typedef Eigen::SparseVector<int>::InnerIterator iteratorV;
    typedef Eigen::SparseVector<int> sparsVec;
18
19

    //-----------------------helpfull methods---------------------------------
Robin Brost's avatar
Robin Brost committed
20
21
    void   printMatrix(Eigen::SparseMatrix<int> A);
    void   printVector(Eigen::VectorXi b);
22
23


Robin Brost's avatar
Robin Brost committed
24
25
26
27
    int    gcd(const int a, const int b);
    int    gcdRow(const Eigen::SparseMatrix<int>::RowXpr row, const int b);
    int    lcm(const int a, const int b);
    int    lcm_list(const std::list<int> D);
28

Robin Brost's avatar
Robin Brost committed
29
30
31
    void   swapRows(Eigen::SparseMatrix<int>& A, Eigen::VectorXi& b,  int row1, int row2);
    int    largestExponent(const Eigen::SparseMatrix<int>& A, const Eigen::VectorXd& x);
    int    indexPivot(const Eigen::SparseMatrix<int>& A, int row);
Robin Brost's avatar
Robin Brost committed
32
    double F_delta(double x);
33
    double get_delta();
Robin Brost's avatar
Robin Brost committed
34

35
36
    //--------------------matrix transformation-------------------------------

Robin Brost's avatar
Robin Brost committed
37
38
    void   IREF_Gaussian(Eigen::SparseMatrix<int>& A, Eigen::VectorXi& b);
    void   IRREF_Jordan(Eigen::SparseMatrix<int>& A, Eigen::VectorXi& b);
39
40
41

    //-------------------Evaluation--------------------------------------------

Robin Brost's avatar
Robin Brost committed
42
    void   evaluation(Eigen::SparseMatrix<int>& A, Eigen::VectorXi& b, Eigen::VectorXd& x);
43
    double makeDiv(const std::list<int>& D, double x);
44
45
46
47
48
49
    double safeDot(const std::list<std::pair<int, double>>& S);

private:

    //-----------------------helpfull variables-------------------------------

Robin Brost's avatar
Robin Brost committed
50
51
52
    int    number_pivots_ = 0; //number of rows with a pivot;
    int    largest_exponent_ = 0;
    double delta_ = 0;
53
54
55
};

#endif // EXACTCONSTRAINTSATISFACTION_HH