示例#1
0
        public static double GetFuelPrice(Machinery1Input machinput)
        {
            double dbFuelPrice = 0;

            if (machinput.Constants.FuelType
                == GeneralRules.FUEL_PRICE_TYPES.diesel.ToString())
            {
                dbFuelPrice = machinput.Constants.PriceDiesel;
            }
            else if (machinput.Constants.FuelType
                     == GeneralRules.FUEL_PRICE_TYPES.electric.ToString())
            {
                dbFuelPrice = machinput.Constants.PriceElectric;
            }
            else if (machinput.Constants.FuelType
                     == GeneralRules.FUEL_PRICE_TYPES.gas.ToString())
            {
                dbFuelPrice = machinput.Constants.PriceGas;
            }
            else if (machinput.Constants.FuelType
                     == GeneralRules.FUEL_PRICE_TYPES.lpg.ToString())
            {
                dbFuelPrice = machinput.Constants.PriceLP;
            }
            else if (machinput.Constants.FuelType
                     == GeneralRules.FUEL_PRICE_TYPES.naturalgas.ToString())
            {
                dbFuelPrice = machinput.Constants.PriceNG;
            }
            return(dbFuelPrice);
        }
示例#2
0
        private static double TotalMachineryCost(TimelinessOpComp1 initialTimelinessOCStock,
                                                 Machinery1Input powerinput, Machinery1Input nonpowerinput)
        {
            double totalCost = 0;

            if (nonpowerinput.Constants.HPPTOMax > powerinput.Constants.HPPTOMax)
            {
                //powerinput - implement combos that are not possible must have a zero total cost
                //zero total cost tells best state to keep looking for a different combo
                totalCost = 0;
            }
            else
            {
                //stay consistent with other object structures used
                List <Machinery1Input> machInputs = new List <Machinery1Input>();
                machInputs.Add(powerinput);
                machInputs.Add(nonpowerinput);
                //total costs are operating costs plus allocated overhead plus timeliness
                //on a per acre or per hectare basis
                //need to run oc costs so that the power input and non power have same field capacity
                totalCost = OpCompCostPerUnitArea(machInputs)
                            + TimelinessCostPerUnitArea(initialTimelinessOCStock, machInputs);
            }
            return(totalCost);
        }
示例#3
0
        private bool CostIsMoreWithNewActualDate(TimelinessOpComp1 leastCostTOC)
        {
            bool bCostIsMoreWithNewActualDate = true;

            foreach (var boc in this.BestOpComps)
            {
                //these are mach1inputs that inherit from a base input
                if (boc.Inputs != null)
                {
                    if (leastCostTOC.Inputs != null)
                    {
                        List <Machinery1Input> sameBOCs = new List <Machinery1Input>();
                        foreach (var bocinput in boc.Inputs)
                        {
                            Machinery1Input machInput = (Machinery1Input)bocinput;
                            sameBOCs.Add(machInput);
                        }
                        foreach (var locinput in leastCostTOC.Inputs)
                        {
                            Machinery1Input machlocInput = (Machinery1Input)locinput;
                            bCostIsMoreWithNewActualDate = BIMachinery2aStockCalculator.HasPowerInput(machlocInput, sameBOCs);
                            if (bCostIsMoreWithNewActualDate == false)
                            {
                                bCostIsMoreWithNewActualDate = BIMachinery2aStockCalculator.HasNonPowerInput(machlocInput, sameBOCs);
                            }
                            else
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
            return(bCostIsMoreWithNewActualDate);
        }
示例#4
0
 private void MakeBestMachineryCombos(int[] state, double[][] problemData)
 {
     //implement
     for (int t = 0; t < state.Length; ++t)
     {
         //powerInput
         int w = state[t];
         //cost = problemData[w][t].ToString("F2")
         //add the corresponding nonpower inputs and power inputs
         //note that the unique key has to be the implement
         Machinery1Input np = this.NonPowerInputs.ElementAtOrDefault(t);
         Machinery1Input p  = this.PowerInputs.ElementAtOrDefault(w);
         if (!this.BestMachineryCombos.ContainsKey(this.NonPowerInputs.ElementAtOrDefault(t)))
         {
             this.BestMachineryCombos.Add(this.NonPowerInputs.ElementAtOrDefault(t), this.PowerInputs.ElementAtOrDefault(w));
         }
     }
 }
示例#5
0
        public static double GetLaborPrice(Machinery1Input machinput)
        {
            double dbLaborPrice = 0;

            if (machinput.Constants.LaborType
                == GeneralRules.LABOR_PRICE_TYPES.machinery.ToString())
            {
                dbLaborPrice = machinput.Constants.PriceMachineryLabor;
            }
            else if (machinput.Constants.LaborType
                     == GeneralRules.LABOR_PRICE_TYPES.regular.ToString())
            {
                dbLaborPrice = machinput.Constants.PriceRegularLabor;
            }
            else if (machinput.Constants.LaborType
                     == GeneralRules.LABOR_PRICE_TYPES.supervisory.ToString())
            {
                dbLaborPrice = machinput.Constants.PriceSupervisorLabor;
            }
            return(dbLaborPrice);
        }