Beispiel #1
0
 public MDPPlanner(RepairActionSearcher repairActionSearcher, BatchCostEstimator costeEstimator)
     : base(repairActionSearcher, costeEstimator)
 {
     rnd = new Random();
     IterationDetails = new BatchPlannerIterationDetails();
     Iterations       = 100; //defult parameter
     Depth            = 2;   //defult parameter
 }
Beispiel #2
0
        public AStarVertex(RepairAction repairAction, BatchCostEstimator costEstimator, SystemState state, int depth)
        {
            if (repairAction == null || repairAction.Count == 0)
            {
                Action = null;
                FVal   = -1;
                Depth  = 0;
            }

            else
            {
                Action     = repairAction;
                Wastedcost = costEstimator.WastedCostUtility(repairAction, state);
                Depth      = depth;
                if (Bounded && Depth == Bound)
                {
                    FVal = Wastedcost;
                }
                else
                {
                    calcFval(costEstimator, state);
                }
            }
        }
Beispiel #3
0
 public MDPPlanner(RepairActionSearcher repairActionSearcher, BatchCostEstimator costeEstimator, int k)
     : base(repairActionSearcher, costeEstimator, k)
 {
     visitedStates = new HashSet <SystemState>();
 }
Beispiel #4
0
 public HeuristicBatchPlanner(RepairActionSearcher repairActionSearcher, BatchCostEstimator costEstimator)
 {
     this.costEstimator        = costEstimator;
     this.repairActionSearcher = repairActionSearcher;
     Bound = repairActionSearcher.K;
 }
Beispiel #5
0
 public AStarPlanner(BatchCostEstimator costEstimator)
 {
     this.costEstimator = costEstimator;
 }
Beispiel #6
0
 public MDPPlanner(RepairActionSearcher repairActionSearcher, BatchCostEstimator costeEstimator, int iterations, int depth)
     : this(repairActionSearcher, costeEstimator)
 {
     Iterations = iterations;
     Depth      = depth;
 }
        private List <BatchPlanner> createPlanners(List <RepairAlgorithmType> algorithms, List <int> bounds, BatchCostEstimator bce)
        {
            List <BatchPlanner> planners = new List <BatchPlanner>();

            foreach (RepairAlgorithmType algorithm in algorithms)
            {
                switch (algorithm)
                {
                case RepairAlgorithmType.AsP:
                    planners.Add(new AStarPowerSetPlanner(bce));
                    break;

                case RepairAlgorithmType.AsU:
                    planners.Add(new AStarUnionPlanner(bce));
                    foreach (int bound in bounds)
                    {
                        planners.Add(new AStarUnionPlanner(bce, bound));
                    }
                    break;

                case RepairAlgorithmType.HC:
                    planners.Add(new GHSBatchPlanner(bce));
                    foreach (int bound in bounds)
                    {
                        planners.Add(new GHSBatchPlanner(bce, bound));
                    }
                    break;

                case RepairAlgorithmType.KHP:
                    foreach (int bound in bounds)
                    {
                        planners.Add(new KHPBatchPlanner(bound, bce));
                    }
                    break;

                case RepairAlgorithmType.HP:
                    planners.Add(new KHPBatchPlanner(1, bce));
                    break;

                case RepairAlgorithmType.MDP:
                    foreach (int bound in bounds)
                    {
                        RepairActionSearcher ras = new UnionBasedSearcher(bound, false);
                        planners.Add(new MDPPlanner(ras, bce, 10000, 5));
                    }
                    break;

                case RepairAlgorithmType.UK:
                    foreach (int bound in bounds)
                    {
                        RepairActionSearcher ras = new UnionBasedSearcher(bound, false);
                        planners.Add(new HeuristicBatchPlanner(ras, bce));
                    }
                    break;
                }
            }
            return(planners);
        }
Beispiel #8
0
 public AStarVertex(RepairAction repairAction, BatchCostEstimator costEstimator, SystemState state)
     : this(repairAction, costEstimator, state, 0)
 {
 }
        public void RunIscas(string filesPath, List <RepairAlgorithmType> algorithms, List <int> bounds, BatchCostEstimator bce, int maxDiag, List <string> systems)
        {
            List <BatchPlanner> planners = createPlanners(algorithms, bounds, bce);

            foreach (BatchPlanner planner in planners)
            {
                foreach (string system in systems)
                {
                    RunISCASRepairAlgorithm(filesPath, planner, bce.Overhead, maxDiag, system);
                }
            }
        }
 public AStarUnionPlanner(BatchCostEstimator costEstimator) : base(costEstimator)
 {
 }
 public AStarUnionPlanner(BatchCostEstimator costEstimator, int bound) : base(costEstimator, bound)
 {
 }
 public KHPBatchPlanner(int k, BatchCostEstimator bce)
 {
     this.k        = k;
     costEstimator = bce;
 }
Beispiel #13
0
 public AStarPowerSetPlanner(BatchCostEstimator costEstimator) : base(costEstimator)
 {
 }
Beispiel #14
0
        //this function calculates the fvalue of this vertex
        private void calcFval(BatchCostEstimator costEstimator, SystemState state)
        {
            double        overhead = costEstimator.Overhead;
            List <double> l_fp     = new List <double>();
            List <double> l_sr     = new List <double>();

            foreach (Comp c in state.Diagnoses.Components)
            {
                if (!Action.Contains(c))
                {
                    double hs   = state.HealthState.GetCompHealthState(c);
                    double cost = ((1 - hs) * c.Cost);

                    l_fp.Add(cost);
                    l_sr.Add(hs);
                }
            }

            l_sr.Sort();
            l_sr.Reverse();
            l_fp.Sort();

            double fpv     = costEstimator.FPCost(Action, state.HealthState);
            double srv     = state.SystemRepair(Action);
            double fmin    = Wastedcost;
            double sum_hs  = l_sr.Sum();
            double sum_sr  = 0;
            double sum_dfp = 0;
            int    b       = Bound - Depth;
            int    size    = Math.Min(l_fp.Count, l_sr.Count);

            if (b > size || !Bounded)
            {
                b = size;
            }

            for (int i = 0; i < b; i++)
            {
                sum_dfp += l_fp[i];
                sum_sr  += l_sr[i];

                double srvi = sum_sr + srv;
                if (srvi > 1)
                {
                    srvi = 1;
                }

                double fnvi = (sum_hs - sum_sr) * overhead;

                if (fpv + ((1 - srv) * fnvi) > Wastedcost)
                {
                    fnvi = overhead;
                }
                if (fpv + ((1 - srv) * fnvi) > Wastedcost)
                {
                    fnvi = 0;
                }

                double fvi = fpv + sum_dfp + ((1 - srvi) * fnvi);

                if (fvi < fmin)
                {
                    fmin = fvi;
                }
            }
            FVal = fmin;
        }
Beispiel #15
0
 public GHSBatchPlanner(BatchCostEstimator costEstimator)
 {
     this.costEstimator = costEstimator;
 }
Beispiel #16
0
 public GHSBatchPlanner(BatchCostEstimator costEstimator, int bound) : this(costEstimator)
 {
     Bound = bound;
 }
        public void RunPhysio(string filesPath, List <RepairAlgorithmType> algorithms, List <int> bounds, BatchCostEstimator bce, int maxDiag)
        {
            List <BatchPlanner> planners = createPlanners(algorithms, bounds, bce);

            foreach (BatchPlanner planner in planners)
            {
                RunRepairAlgorithmPhysio(filesPath, planner, bce.Overhead, maxDiag);
            }
        }