Ejemplo n.º 1
0
 public SearchProblem(IGoalTest <S> goalTest, IStepCostFunction <A, S, C> stepCost, ISuccessorFunction <A, S> successor, IHeuristicFunction <S, C> heuristicFn)
 {
     this.goalTest    = goalTest;
     this.stepCost    = stepCost;
     this.successorFn = successor;
     this.heuristicFn = heuristicFn;
 }
 public OnlineSearchProblem(IActionsFunction actionsFunction,
                            IGoalTest goalTest, IStepCostFunction stepCostFunction)
 {
     this.ActionsFunction  = actionsFunction;
     this.GoalTest         = goalTest;
     this.StepCostFunction = stepCostFunction;
 }
Ejemplo n.º 3
0
 /**
  * Constructor
  */
 public NondeterministicProblem(S initialState,
                                IActionsFunction <S, A> actionsFn, IResultsFunction <S, A> resultsFn,
                                GoalTest <S> goalTest, IStepCostFunction <S, A> stepCostFn)
 {
     this.initialState = initialState;
     this.actionsFn    = actionsFn;
     this.resultsFn    = resultsFn;
     this.goalTest     = goalTest;
     this.stepCostFn   = stepCostFn;
 }
Ejemplo n.º 4
0
 public Problem(object initialState, IActionsFunction actionsFunction,
                IResultFunction resultFunction, IGoalTest goalTest,
                IStepCostFunction stepCostFunction)
 {
     this.InitialState     = initialState;
     this.ActionsFunction  = actionsFunction;
     this.ResultFunction   = resultFunction;
     this.GoalTest         = goalTest;
     this.StepCostFunction = stepCostFunction;
 }
Ejemplo n.º 5
0
        public void setUp()
        {
            ExtendableMap aMap = new ExtendableMap();

            aMap.addBidirectionalLink("A", "B", 5.0);
            aMap.addBidirectionalLink("A", "C", 6.0);
            aMap.addBidirectionalLink("B", "C", 4.0);
            aMap.addBidirectionalLink("C", "D", 7.0);
            aMap.addUnidirectionalLink("B", "E", 14.0);

            actionsFn  = MapFunctions.createActionsFunction(aMap);
            resultFn   = MapFunctions.createResultFunction();
            stepCostFn = MapFunctions.createDistanceStepCostFunction(aMap);
        }
Ejemplo n.º 6
0
 public Problem(
     string initialState,
     MoveToActionsFunction actionsFunction,
     IResultFunction resultFunction,
     IGoalTest goalTest,
     IStepCostFunction stepCostFunction
     )
 {
     m_initialState = initialState;
     m_actionsFunction = actionsFunction;
     m_resultFunction = resultFunction;
     m_goalTest = goalTest;
     m_stepCostFunction = stepCostFunction;
 }
Ejemplo n.º 7
0
        public IList <Node> ExpandNode(Node node, Problem problem)
        {
            IList <Node> childNodes = new List <Node>();

            IActionsFunction  actionsFunction  = problem.ActionsFunction;
            IResultFunction   resultFunction   = problem.ResultFunction;
            IStepCostFunction stepCostFunction = problem.StepCostFunction;

            foreach (IAction action in actionsFunction.Actions(node.State))
            {
                object successorState = resultFunction.Result(node.State, action);

                double stepCost = stepCostFunction.C(node.State, action, successorState);
                childNodes.Add(new Node(successorState, node, action, stepCost));
            }
            this.Metrics.Set(MetricNodesExpanded, this.Metrics.GetInt(MetricNodesExpanded) + 1);

            return(childNodes);
        }
Ejemplo n.º 8
0
 public SearchProblem(IGoalTest <S> goalTest, IStepCostFunction <A, S, C> stepCost, ISuccessorFunction <A, S> successor)
     : this(goalTest, stepCost, successor, null)
 {
 }