Пример #1
0
        public static CostFunction GetNullCostFunction()
        {
            uint[]       nullSegments = new uint[INSTU_COST_FUNC_LENGTH];
            CostFunction CostFunc     = new CostFunction(nullSegments, nullSegments);

            return(CostFunc);
        }
Пример #2
0
 public CostFuncVec(CostFunction[] arrayCostFunc)
 {
     if (arrayCostFunc == null)
     {
         throw new ArgumentNullException("arrayCostFunc");
     }
     else if (arrayCostFunc.Length < 1)
     {
         throw new ArgumentOutOfRangeException(string.Format("vecLen {0} < 1", arrayCostFunc.Length));
     }
     else if (arrayCostFunc.Length > OKTO_MAX_VEC_LEN)
     {
         throw new ArgumentOutOfRangeException(string.Format("vecLen {0} > MAX_VEC_LEN", arrayCostFunc.Length));
     }
     else if (arrayCostFunc.Length == OKTO_MAX_VEC_LEN)
     {
         vector = arrayCostFunc;
     }
     else
     {
         vector = new CostFunction[OKTO_MAX_VEC_LEN];
         for (int VecIdx = 0; VecIdx < OKTO_MAX_VEC_LEN; VecIdx++)
         {
             if (VecIdx < arrayCostFunc.Length)
             {
                 vector[VecIdx] = arrayCostFunc[VecIdx];
             }
             else
             {
                 vector[VecIdx] = CostFunction.GetIdentityCostFunction();
             }
         }
     }
 }
Пример #3
0
 public void SetCostFunc(CostFunction costFunc, uint index)
 {
     if (index >= OKTO_MAX_VEC_LEN)
     {
         throw new ArgumentOutOfRangeException("index");
     }
     vector[index] = costFunc;
 }
Пример #4
0
 public CostFuncVec()
 {
     vector = new CostFunction[OKTO_MAX_VEC_LEN];
     for (int VecIdx = 0; VecIdx < OKTO_MAX_VEC_LEN; VecIdx++)
     {
         vector[VecIdx] = CostFunction.GetIdentityCostFunction();
     }
 }
Пример #5
0
        public static CostFunction GetIdentityCostFunction()
        {
            CostFunction CostFunc = new CostFunction(new uint[] { 0, uint.MaxValue }, new uint[] { 0, uint.MaxValue });

            return(CostFunc);
        }
Пример #6
0
 public static CostFunction GetNullCostFunction()
 {
     uint[] nullSegments = new uint[INSTU_COST_FUNC_LENGTH];
     CostFunction CostFunc = new CostFunction(nullSegments, nullSegments);
     return CostFunc;
 }
Пример #7
0
 public static CostFunction GetIdentityCostFunction()
 {
     CostFunction CostFunc = new CostFunction(new uint[] { 0, uint.MaxValue }, new uint[] { 0, uint.MaxValue });
     return CostFunc;
 }
Пример #8
0
 public void SetCostFunc(CostFunction costFunc, uint index)
 {
     if (index >= OKTO_MAX_VEC_LEN)
         throw new ArgumentOutOfRangeException("index");
     vector[index] = costFunc;
 }
Пример #9
0
 public CostFuncVec(CostFunction[] arrayCostFunc)
 {
     if (arrayCostFunc == null)
         throw new ArgumentNullException("arrayCostFunc");
     else if (arrayCostFunc.Length < 1)
         throw new ArgumentOutOfRangeException(string.Format("vecLen {0} < 1", arrayCostFunc.Length));
     else if (arrayCostFunc.Length > OKTO_MAX_VEC_LEN)
         throw new ArgumentOutOfRangeException(string.Format("vecLen {0} > MAX_VEC_LEN", arrayCostFunc.Length));
     else if (arrayCostFunc.Length == OKTO_MAX_VEC_LEN)
         vector = arrayCostFunc;
     else
     {
         vector = new CostFunction[OKTO_MAX_VEC_LEN];
         for (int VecIdx = 0; VecIdx < OKTO_MAX_VEC_LEN; VecIdx++)
         {
             if (VecIdx < arrayCostFunc.Length)
                 vector[VecIdx] = arrayCostFunc[VecIdx];
             else
                 vector[VecIdx] = CostFunction.GetIdentityCostFunction();
         }
     }
 }