Esempio n. 1
0
 public void Reset()
 {
     for (int i = 0; i != Dimension * Dimension; ++i)
     {
         Matrix[i] = new DBMNode(Zero);
     }
 }
Esempio n. 2
0
        public void Close()
        {
            for (int k = 0; k < Dimension; k++)
            {
                for (int i = 0; i < Dimension; i++)
                {
                    for (int j = 0; j < Dimension; j++)
                    {
                        if (i != k && k != j && j != i)
                        {
                            if (Matrix[Pos(i, k)] != Infinite && Matrix[Pos(k, j)] != Infinite)
                            {
                                DBMNode newNode = Matrix[Pos(i, k)] + Matrix[Pos(k, j)];
                                if (newNode < Matrix[Pos(i, j)])
                                {
                                    Matrix[Pos(i, j)] = newNode;
                                }
                            }
                        }
                    }

                    if (Matrix[Pos(i, i)] < Zero)
                    {
                        Matrix[0] = new DBMNode(Invalid);
                        return;
                    }
                }
            }
        }
Esempio n. 3
0
 public void Delay()
 {
     for (int i = 1; i < Dimension; i++)
     {
         Matrix[Pos(i, 0)] = new DBMNode(Infinite);
     }
 }
Esempio n. 4
0
 public void Reset(short x)
 {
     for (int i = 0; i != Dimension; ++i)
     {
         Matrix[Pos(x, i)] = new DBMNode(Matrix[Pos(0, i)]);
         Matrix[Pos(i, x)] = new DBMNode(Matrix[Pos(i, 0)]);
     }
 }
Esempio n. 5
0
 public FullDiffDBM(int dimension)
 {
     Dimension = dimension;
     Matrix    = new DBMNode[Dimension * Dimension];
     for (int i = 0; i != Dimension * Dimension; ++i)
     {
         Matrix[i] = new DBMNode();
     }
 }
Esempio n. 6
0
        public void TotalFree(short x)
        {
            for (int i = 0; i != Dimension; ++i)
            {
                if (i == x)
                {
                    continue;
                }

                Matrix[Pos(x, i)] = new DBMNode(Infinite);
                Matrix[Pos(i, x)] = new DBMNode(Infinite);
            }
        }
Esempio n. 7
0
 public void Extrapolation(int[,] bound)
 {
     for (int i = 0; i != Dimension; ++i)
     {
         for (int j = 0; j != Dimension; ++j)
         {
             if (Matrix[Pos(i, j)].Value > -1 * bound[Pos(j, i), 0])
             {
                 Matrix[Pos(i, j)] = new DBMNode(Infinite);
             }
             else if (Matrix[Pos(i, j)].Value < -1 * bound[Pos(j, i), 1])
             {
                 Matrix[Pos(i, j)] = new DBMNode(-1 * bound[Pos(j, i), 1], true);
             }
         }
     }
 }
Esempio n. 8
0
        // constraint of the form: (x - y < c) or (x - y <= c)
        protected void AddConstraint(short x, short y, bool strict, int constant)
        {
            DBMNode node = new DBMNode(constant, strict);
            DBMNode tmp;

            if (Matrix[Pos(y, x)] != Infinite && node != Infinite && Matrix[Pos(y, x)] + node < Zero)
            {
                Matrix[0] = new DBMNode(Invalid);
                return;
            }
            else if (node < Matrix[Pos(x, y)])
            {
                Matrix[Pos(x, y)] = node;
                for (int i = 0; i != Dimension; ++i)
                {
                    for (int j = 0; j != Dimension; ++j)
                    {
                        if (Matrix[Pos(i, x)] != Infinite && Matrix[Pos(x, j)] != Infinite)
                        {
                            tmp = Matrix[Pos(i, x)] + Matrix[Pos(x, j)];
                            if (tmp < Matrix[Pos(i, j)])
                            {
                                Matrix[Pos(i, j)] = tmp;
                            }
                        }
                        if (Matrix[Pos(i, y)] != Infinite && Matrix[Pos(y, j)] != Infinite)
                        {
                            tmp = Matrix[Pos(i, y)] + Matrix[Pos(y, j)];
                            if (tmp < Matrix[Pos(i, j)])
                            {
                                Matrix[Pos(i, j)] = tmp;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 9
0
 public FullDiffDBM(int dim, DBMNode[] matrix)
 {
     Dimension = dim;
     Matrix = matrix;
 }
Esempio n. 10
0
 public DBMNode(DBMNode node)
 {
     Value = node.Value;
     Strict = node.Strict;
 }
Esempio n. 11
0
 public void Reset(short x)
 {
     for (int i = 0; i != Dimension; ++i)
     {
         Matrix[Pos(x, i)] = new DBMNode(Matrix[Pos(0, i)]);
         Matrix[Pos(i, x)] = new DBMNode(Matrix[Pos(i, 0)]);
     }
 }
Esempio n. 12
0
 public void Reset()
 {
     for (int i = 0; i != Dimension * Dimension; ++i)
     {
         Matrix[i] = new DBMNode(Zero);
     }
 }
Esempio n. 13
0
 public void Extrapolation(int[,] bound)
 {
     for (int i = 0; i != Dimension; ++i)
     {
         for (int j = 0; j != Dimension; ++j)
         {
             if (Matrix[Pos(i, j)].Value > -1 * bound[Pos(j, i), 0])
             {
                 Matrix[Pos(i, j)] = new DBMNode(Infinite);
             }
             else if (Matrix[Pos(i, j)].Value < -1 * bound[Pos(j, i), 1])
             {
                 Matrix[Pos(i, j)] = new DBMNode(-1 * bound[Pos(j, i), 1], true);
             }
         }
     }
 }
Esempio n. 14
0
 public void Delay()
 {
     for (int i = 1; i < Dimension; i++)
     {
         Matrix[Pos(i, 0)] = new DBMNode(Infinite);
     }
 }
Esempio n. 15
0
        public void Close()
        {
            for (int k = 0; k < Dimension; k++)
            {
                for (int i = 0; i < Dimension; i++)
                {
                    for (int j = 0; j < Dimension; j++)
                    {
                        if (i != k && k != j && j != i)
                        {
                            if (Matrix[Pos(i, k)] != Infinite && Matrix[Pos(k, j)] != Infinite)
                            {
                                DBMNode newNode = Matrix[Pos(i, k)] + Matrix[Pos(k, j)];
                                if (newNode < Matrix[Pos(i, j)])
                                {
                                    Matrix[Pos(i, j)] = newNode;
                                }
                            }
                        }
                    }

                    if (Matrix[Pos(i, i)] < Zero)
                    {
                        Matrix[0] = new DBMNode(Invalid);
                        return;
                    }
                }
            }
        }
Esempio n. 16
0
 public DBMNode(DBMNode node)
 {
     Value  = node.Value;
     Strict = node.Strict;
 }
Esempio n. 17
0
        public void TotalFree(short x)
        {
            for (int i = 0; i != Dimension; ++i)
            {
                if (i == x)
                {
                    continue;
                }

                Matrix[Pos(x, i)] = new DBMNode(Infinite);
                Matrix[Pos(i, x)] = new DBMNode(Infinite);
            }
        }
Esempio n. 18
0
        // constraint of the form: (x - y < c) or (x - y <= c)
        protected void AddConstraint(short x, short y, bool strict, int constant)
        {
            DBMNode node = new DBMNode(constant, strict);
            DBMNode tmp;

            if (Matrix[Pos(y, x)] != Infinite && node != Infinite && Matrix[Pos(y, x)] + node < Zero)
            {
                Matrix[0] = new DBMNode(Invalid);
                return;
            }
            else if (node < Matrix[Pos(x, y)])
            {
                Matrix[Pos(x, y)] = node;
                for (int i = 0; i != Dimension; ++i)
                {
                    for (int j = 0; j != Dimension; ++j)
                    {
                        if (Matrix[Pos(i, x)] != Infinite && Matrix[Pos(x, j)] != Infinite)
                        {
                            tmp = Matrix[Pos(i, x)] + Matrix[Pos(x, j)];
                            if (tmp < Matrix[Pos(i, j)])
                            {
                                Matrix[Pos(i, j)] = tmp;
                            }
                        }
                        if (Matrix[Pos(i, y)] != Infinite && Matrix[Pos(y, j)] != Infinite)
                        {
                            tmp = Matrix[Pos(i, y)] + Matrix[Pos(y, j)];
                            if (tmp < Matrix[Pos(i, j)])
                            {
                                Matrix[Pos(i, j)] = tmp;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 19
0
 public FullDiffDBM(int dimension)
 {
     Dimension = dimension;
     Matrix = new DBMNode[Dimension * Dimension];
     for (int i = 0; i != Dimension * Dimension; ++i)
     {
         Matrix[i] = new DBMNode();
     }
 }