Beispiel #1
0
        /// <summary>
        ///  Returns the row in which the given column is basic.
        /// </summary>
        /// <param name="col"></param>
        /// <returns></returns>
        private int?FindBasicRow(int col)
        {
            int?row = null;

            for (int i = 0; i < Height; i++)
            {
                T entry = GetEntry(i, col);
                if (Policy.Equals(entry, Policy.One()) && (row == null))
                {
                    row = i;
                }
                else if (!Policy.Equals(entry, Policy.Zero()))
                {
                    return(null);
                }
            }
            return(row);
        }
Beispiel #2
0
        /// <inheritdoc />
        public override bool Equals(object other)
        {
            if (this == other)
            {
                return(true);
            }
            if (other is LinearObjectiveFunction <T, TPolicy> )
            {
                var rhs = (LinearObjectiveFunction <T, TPolicy>)other;
                return(Policy.Equals(ConstantTerm, rhs.ConstantTerm) && Coefficients.Equals(rhs.Coefficients));
            }

            return(false);
        }
 /// <inheritDoc/>
 public override bool Equals(object other)
 {
     if (this == other)
     {
         return(true);
     }
     if (other is LinearConstraint <T, TPolicy> )
     {
         var rhs = (LinearConstraint <T, TPolicy>)other;
         return(Relationship == rhs.Relationship && Policy.Equals(Value, rhs.Value) &&
                Coefficients.Equals(rhs.Coefficients));
     }
     return(false);
 }