コード例 #1
0
 private void CheckMatrix(UMatrix U, int k)
 {
     for (int i = 0; i < this.dim; i++)
     {
         CheckMatrixRow(i, U, k);
     }
     CheckBelowInTheColumn(U, k);
 }
コード例 #2
0
ファイル: Factorization.cs プロジェクト: nbulp/CodeContracts
    static internal Factorization CreateFactorization(Matrix B, UMatrix U)
    {
      Contract.Requires(B != null);
      Contract.Requires(U != null);

      //if( System.Environment.GetEnvironmentVariable("BartelsGolub")=="on")
      //    return new BartelsGolubFactorization(B);
      return StandardFactorization.Create(B, U);
    }
コード例 #3
0
        static internal Factorization CreateFactorization(Matrix B, UMatrix U)
        {
            Contract.Requires(B != null);
            Contract.Requires(U != null);

            //if( System.Environment.GetEnvironmentVariable("BartelsGolub")=="on")
            //    return new BartelsGolubFactorization(B);
            return(StandardFactorization.Create(B, U));
        }
コード例 #4
0
        internal static Factorization Create(Matrix A, UMatrix U)
        {
            Contract.Requires(A != null);
            Contract.Requires(U != null);

            StandardFactorization f = new StandardFactorization(A, U);

            if (f.failure)
            {
                return(null);
            }
            return(f);
        }
コード例 #5
0
        /// <summary>
        /// create the initial factorization of the form Ln*Pn*...*L1*P1*A=Un-1*...U0
        /// </summary>
        /// <param name="APar"></param>
        internal StandardFactorization(Matrix APar, UMatrix Upar)
        {
            Contract.Requires(APar != null);
            Contract.Requires(Upar != null);

            this.A   = (BMatrix)APar;
            this.dim = A.NumberOfColumns;
            this.U   = Upar;
            InitMatrixUAndMarkovichNumbers();
            CalculateInitialFactorization();

#if DEBUGGLEE
            //   if(calls>=63)
            //     CheckFactorization();
#endif
        }
コード例 #6
0
    /// <summary>
    /// create the initial factorization of the form Ln*Pn*...*L1*P1*A=Un-1*...U0
    /// </summary>
    /// <param name="APar"></param>
    internal StandardFactorization(Matrix APar, UMatrix Upar)
    {
      Contract.Requires(APar != null);
      Contract.Requires(Upar != null);

      this.A = (BMatrix)APar;
      this.dim = A.NumberOfColumns;
      this.U = Upar;
      InitMatrixUAndMarkovichNumbers();
      CalculateInitialFactorization();

#if DEBUGGLEE
         //   if(calls>=63)
       //     CheckFactorization();
#endif

    }
コード例 #7
0
        private void CheckMatrixRow(int i, UMatrix U, int k)
        {
            bool allZero = false;
            int  j       = 0;

            for (; j < dim; j++)
            {
                if (U[i, j] != 0)
                {
                    allZero = false;
                    break;
                }
            }

            if (allZero)
            {
                Console.WriteLine("all zero row");
            }
        }
コード例 #8
0
        private void CheckBelowInTheColumn(UMatrix U, int k)
        {
            if (U[k, k] != 1)
            {
                Console.WriteLine();
            }
            bool allZero = true;

            for (int j = k + 1; j < dim && allZero; j++)
            {
                if (U[j, k] != 0)
                {
                    allZero = false;
                }
            }
            if (allZero == false)
            {
                Console.WriteLine();
            }
        }
コード例 #9
0
        internal RevisedSolver(int[] basisArray,
                               double[] xSt,
                               int startOfArtificials,
                               ExtendedConstraintMatrix APar,
                               double[] costsPar,
                               bool[] lowBounds,
                               double[] lowBoundValues,
                               bool[] upperBounds,
                               double[] upperBoundValues,
                               int[] forbiddenPairsPar,
                               List <Constraint> constrs,
                               double etaEps
                               )
        {
            etaEpsilon       = etaEps;
            constraints      = constrs;
            forbiddenPairs   = forbiddenPairsPar;
            basis            = basisArray;
            xStar            = xSt;
            artificialsStart = startOfArtificials;
            nVars            = APar.NumberOfColumns;
            A     = APar;
            costs = costsPar;
            y     = new double[BasisSize];
            index = new int[nVars];
            for (int i = 0; i < nVars; i++)
            {
                index[i] = notInBasis;
            }
            for (int i = 0; i < basis.Length; i++)
            {
                index[basis[i]] = i; //that is the i-th element of basis
            }
            lowBoundIsSet    = lowBounds;
            this.lowBounds   = lowBoundValues;
            upperBoundIsSet  = upperBounds;
            this.upperBounds = upperBoundValues;

            U = new UMatrix(basis.Length);
        }
コード例 #10
0
    internal static Factorization Create(Matrix A, UMatrix U)
    {
      Contract.Requires(A != null);
      Contract.Requires(U != null);

      StandardFactorization f = new StandardFactorization(A, U);
      if (f.failure)
        return null;
      return f;
    }
コード例 #11
0
        private void CheckMatrixRow(int i, UMatrix U, int k) {
            bool allZero=false;
            int j=0;
            for (; j < dim; j++)
                if (U[i, j]!= 0) {
                    allZero = false;
                    break;
                }

            if (allZero)
                Console.WriteLine("all zero row");


        }
コード例 #12
0
 private void CheckBelowInTheColumn(UMatrix U, int k) {
     if(U[k,k]!=1)
         Console.WriteLine();
     bool allZero=true;
     for (int j = k + 1; j < dim&&allZero; j++)
         if (U[j, k] != 0)
             allZero = false;
     if (allZero==false)
         Console.WriteLine();
 }
コード例 #13
0
        private void CheckMatrix(UMatrix U,int k) {
            for (int i = 0; i < this.dim; i++)
                CheckMatrixRow(i, U,k);
            CheckBelowInTheColumn(U, k);

        }
コード例 #14
0
    internal RevisedSolver(int[] basisArray,
                           double[] xSt,
                           int startOfArtificials,
                           ExtendedConstraintMatrix APar,
                           double[] costsPar,
                           bool[] lowBounds,
                           double[] lowBoundValues,
                           bool[] upperBounds,
                           double[] upperBoundValues,
                           int[] forbiddenPairsPar,
                           List<Constraint> constrs,
                           double etaEps
        )
    {
      etaEpsilon = etaEps;
      constraints = constrs;
      forbiddenPairs = forbiddenPairsPar;
      basis = basisArray;
      xStar = xSt;
      artificialsStart = startOfArtificials;
      nVars = APar.NumberOfColumns;
      A = APar;
      costs = costsPar;
      y = new double[BasisSize];
      index = new int[nVars];
      for (int i = 0; i < nVars; i++)
        index[i] = notInBasis;
      for (int i = 0; i < basis.Length; i++)
        index[basis[i]] = i; //that is the i-th element of basis

      lowBoundIsSet = lowBounds;
      this.lowBounds = lowBoundValues;
      upperBoundIsSet = upperBounds;
      this.upperBounds = upperBoundValues;

      U = new UMatrix(basis.Length);
    }