Example #1
0
        ///<summary>
        /// Create a set of octagonal constraints from a given interval, and an integer that stands for the dimension to constraint
        ///</summary>
        static public ICollection <OctagonConstraint> CreateConstraintsFromInterval(int dim, Interval interval)
        {
            ICollection <OctagonConstraint> constraints = new List <OctagonConstraint>();

            if (interval.IsBottom)
            {
                return(constraints);
            }

            if (interval.LowerBound == interval.UpperBound)
            {       // it is 'dim = val'
                OctagonConstraint con = new OctagonConstraintXEqualConst(dim, interval.LowerBound);
                constraints.Add(con);
            }

            // Do the lower bound
            if (!interval.LowerBound.IsInfinity)
            {
                OctagonConstraint con = new OctagonConstraintMinusX(dim, -interval.LowerBound);
                constraints.Add(con);
            }

            // Do the upper bound
            if (!interval.UpperBound.IsInfinity)
            {
                OctagonConstraint con = new OctagonConstraintX(dim, interval.UpperBound);
                constraints.Add(con);
            }

            return(constraints);
        }
Example #2
0
    ///<summary>
    /// Create a set of octagonal constraints from a given interval, and an integer that stands for the dimension to constraint
    ///</summary>
    static public ICollection<OctagonConstraint> CreateConstraintsFromInterval(int dim, Interval interval)
    {
      ICollection<OctagonConstraint> constraints = new List<OctagonConstraint>();

      if (interval.IsBottom)
        return constraints;

      if (interval.LowerBound == interval.UpperBound)
      {		// it is 'dim = val'
        OctagonConstraint con = new OctagonConstraintXEqualConst(dim, interval.LowerBound);
        constraints.Add(con);
      }

      // Do the lower bound
      if (!interval.LowerBound.IsInfinity)
      {
        OctagonConstraint con = new OctagonConstraintMinusX(dim, -interval.LowerBound);
        constraints.Add(con);
      }

      // Do the upper bound
      if (!interval.UpperBound.IsInfinity)
      {
        OctagonConstraint con = new OctagonConstraintX(dim, interval.UpperBound);
        constraints.Add(con);
      }

      return constraints;
    }