Exemplo n.º 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
 }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 3
0
 public MDPPlanner(RepairActionSearcher repairActionSearcher, BatchCostEstimator costeEstimator, int k)
     : base(repairActionSearcher, costeEstimator, k)
 {
     visitedStates = new HashSet <SystemState>();
 }
Exemplo n.º 4
0
 public HeuristicBatchPlanner(RepairActionSearcher repairActionSearcher, BatchCostEstimator costEstimator)
 {
     this.costEstimator        = costEstimator;
     this.repairActionSearcher = repairActionSearcher;
     Bound = repairActionSearcher.K;
 }
Exemplo n.º 5
0
 public AStarPlanner(BatchCostEstimator costEstimator)
 {
     this.costEstimator = costEstimator;
 }
Exemplo n.º 6
0
 public MDPPlanner(RepairActionSearcher repairActionSearcher, BatchCostEstimator costeEstimator, int iterations, int depth)
     : this(repairActionSearcher, costeEstimator)
 {
     Iterations = iterations;
     Depth      = depth;
 }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
 public AStarVertex(RepairAction repairAction, BatchCostEstimator costEstimator, SystemState state)
     : this(repairAction, costEstimator, state, 0)
 {
 }
Exemplo n.º 9
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);
                }
            }
        }
Exemplo n.º 10
0
 public AStarUnionPlanner(BatchCostEstimator costEstimator) : base(costEstimator)
 {
 }
Exemplo n.º 11
0
 public AStarUnionPlanner(BatchCostEstimator costEstimator, int bound) : base(costEstimator, bound)
 {
 }
Exemplo n.º 12
0
 public KHPBatchPlanner(int k, BatchCostEstimator bce)
 {
     this.k        = k;
     costEstimator = bce;
 }
Exemplo n.º 13
0
 public AStarPowerSetPlanner(BatchCostEstimator costEstimator) : base(costEstimator)
 {
 }
Exemplo n.º 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;
        }
Exemplo n.º 15
0
 public GHSBatchPlanner(BatchCostEstimator costEstimator)
 {
     this.costEstimator = costEstimator;
 }
Exemplo n.º 16
0
 public GHSBatchPlanner(BatchCostEstimator costEstimator, int bound) : this(costEstimator)
 {
     Bound = bound;
 }
Exemplo n.º 17
0
        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);
            }
        }