private void CheckMatrix(UMatrix U, int k)
 {
     for (int i = 0; i < this.dim; i++)
     {
         CheckMatrixRow(i, U, k);
     }
     CheckBelowInTheColumn(U, k);
 }
Exemple #2
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);
    }
        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));
        }
        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);
        }
        /// <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
        }
    /// <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

    }
        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");
            }
        }
        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();
            }
        }
        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);
        }
    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;
    }
        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");


        }
 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();
 }
        private void CheckMatrix(UMatrix U,int k) {
            for (int i = 0; i < this.dim; i++)
                CheckMatrixRow(i, U,k);
            CheckBelowInTheColumn(U, k);

        }
    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);
    }