Esempio n. 1
0
		public Problem(Object initialState, SuccessorFunction successorFunction,
			GoalTest goalTest, StepCostFunction stepCostFunction,
			HeuristicFunction heuristicFunction) : this(initialState, successorFunction, goalTest, stepCostFunction)
		{
			
			this.heuristicFunction = heuristicFunction;
		}
Esempio n. 2
0
 /**
  * Constructs an online search problem with the specified action function,
  * goal test, and a default step cost function.
  *
  * @param actionsFunction
  *            ACTIONS(s), which returns a list of actions allowed in state s
  * @param goalTest
  *            GOAL-TEST(s), which the agent can apply to a single state
  *            description to determine if it is a goal state
  * @param stepCostFunction
  *            the step-cost function c(s, a, s') - note that this cannot be
  *            used until the agent knows that s' is the outcome
  */
 public OnlineSearchProblem(ActionsFunction actionsFunction,
                            GoalTest goalTest, StepCostFunction stepCostFunction)
 {
     this.actionsFunction  = actionsFunction;
     this.goalTest         = goalTest;
     this.stepCostFunction = stepCostFunction;
 }
Esempio n. 3
0
 /**
  * Constructs an online search problem with the specified action function,
  * goal test, and a default step cost function.
  *
  * @param actionsFunction
  *            ACTIONS(s), which returns a list of actions allowed in state s
  * @param goalTest
  *            GOAL-TEST(s), which the agent can apply to a single state
  *            description to determine if it is a goal state
  */
 public OnlineSearchProblem(ActionsFunction actionsFunction,
                            GoalTest goalTest)
 {
     this.actionsFunction  = actionsFunction;
     this.goalTest         = goalTest;
     this.stepCostFunction = new DefaultStepCostFunction();
 }
 /**
  * Constructs an online search problem with the specified action function,
  * goal test, and a default step cost function.
  *
  * @param actionsFunction
  *            ACTIONS(s), which returns a list of actions allowed in state s
  * @param goalTest
  *            GOAL-TEST(s), which the agent can apply to a single state
  *            description to determine if it is a goal state
  */
 public OnlineSearchProblem(ActionsFunction actionsFunction,
     GoalTest goalTest)
 {
     this.actionsFunction = actionsFunction;
     this.goalTest = goalTest;
     this.stepCostFunction = new DefaultStepCostFunction();
 }
 /**
  * Constructs an online search problem with the specified action function,
  * goal test, and a default step cost function.
  *
  * @param actionsFunction
  *            ACTIONS(s), which returns a list of actions allowed in state s
  * @param goalTest
  *            GOAL-TEST(s), which the agent can apply to a single state
  *            description to determine if it is a goal state
  * @param stepCostFunction
  *            the step-cost function c(s, a, s') - note that this cannot be
  *            used until the agent knows that s' is the outcome
  */
 public OnlineSearchProblem(ActionsFunction actionsFunction,
     GoalTest goalTest, StepCostFunction stepCostFunction)
 {
     this.actionsFunction = actionsFunction;
     this.goalTest = goalTest;
     this.stepCostFunction = stepCostFunction;
 }
Esempio n. 6
0
 // Crea un problema partiendo de todos sus componentes
 public Problem(object iSetup, ApplicableOperatorsFunction aoFunction, TransitionModel tModel, GoalTest gTest, StepCostFunction scFunction)
 {
     this.InitialSetup = iSetup;
     this.ApplicableOperatorsFunction = aoFunction;
     this.TransitionModel             = tModel;
     this.GoalTest         = gTest;
     this.StepCostFunction = scFunction;
 }
Esempio n. 7
0
 public Problem(Object initialState, SuccessorFunction successorFunction,
                GoalTest goalTest)
 {
     this.initialState      = initialState;
     this.successorFunction = successorFunction;
     this.goalTest          = goalTest;
     this.stepCostFunction  = new DefaultStepCostFunction();
     this.heuristicFunction = new DefaultHeuristicFunction();
 }
Esempio n. 8
0
 public Problem(Object initialState, ActionsFunction actionsFunction,
         ResultFunction resultFunction, GoalTest goalTest,
         StepCostFunction stepCostFunction)
 {
     this.initialState = initialState;
     this.actionsFunction = actionsFunction;
     this.resultFunction = resultFunction;
     this.goalTest = goalTest;
     this.stepCostFunction = stepCostFunction;
 }
Esempio n. 9
0
 /**
  * Constructs a problem with the specified components, which includes a step
  * cost function.
  *
  * @param initialState
  *            the initial state of the agent.
  * @param actionsFunction
  *            a description of the possible actions available to the agent.
  * @param resultFunction
  *            a description of what each action does; the formal name for
  *            this is the transition model, specified by a function
  *            RESULT(s, a) that returns the state that results from doing
  *            action a in state s.
  * @param goalTest
  *            test determines whether a given state is a goal state.
  * @param stepCostFunction
  *            a path cost function that assigns a numeric cost to each path.
  *            The problem-solving-agent chooses a cost function that
  *            reflects its own performance measure.
  */
 public Problem(Object initialState, ActionsFunction actionsFunction,
                ResultFunction resultFunction, GoalTest goalTest,
                StepCostFunction stepCostFunction)
 {
     this.initialState     = initialState;
     this.actionsFunction  = actionsFunction;
     this.resultFunction   = resultFunction;
     this.goalTest         = goalTest;
     this.stepCostFunction = stepCostFunction;
 }
Esempio n. 10
0
 public Problem(object initialSetup, OperatorsFunction operatorsFunction,
                ResultFunction resultFunction, GoalTest goalTest,
                StepCostFunction stepCostFunction)
 {
     this.initialSetup      = initialSetup;
     this.operatorsFunction = operatorsFunction;
     this.resultFunction    = resultFunction;
     this.goalTest          = goalTest;
     this.stepCostFunction  = stepCostFunction;
 }
Esempio n. 11
0
		public Problem(Object initialState, SuccessorFunction successorFunction,
			GoalTest goalTest) 
		{

			this.initialState = initialState;
			this.successorFunction = successorFunction;
			this.goalTest = goalTest;
			this.stepCostFunction = new DefaultStepCostFunction();
			this.heuristicFunction = new DefaultHeuristicFunction();

		}
Esempio n. 12
0
        // Devuelve la lista de todos los nodos hijos del nodo que se desea expandir
        public List <Node> ExpandNode(Node node, Problem problem)
        {
            List <Node> childNodes = new List <Node>();

            OperatorsFunction operatorsFunction = problem.GetOperatorsFunction();
            ResultFunction    resultFunction    = problem.GetResultFunction();
            StepCostFunction  stepCostFunction  = problem.GetStepCostFunction();

            foreach (Operator op in operatorsFunction.Operators(node.GetSetup()))
            {
                object successorSetup = resultFunction.GetResult(node.GetSetup(), op);
                double stepCost       = stepCostFunction.GetCost(node.GetSetup(), op, successorSetup);
                childNodes.Add(new Node(successorSetup, node, op, stepCost));
            }
            metrics.set(METRIC_NODES_EXPANDED, metrics.getInt(METRIC_NODES_EXPANDED) + 1);

            return(childNodes);
        }
Esempio n. 13
0
        public List <Node> expandNode(Node node, Problem problem)
        {
            List <Node> childNodes = new List <Node>();

            ActionsFunction  actionsFunction  = problem.getActionsFunction();
            ResultFunction   resultFunction   = problem.getResultFunction();
            StepCostFunction stepCostFunction = problem.getStepCostFunction();

            foreach (Action action in actionsFunction.actions(node.getState()))
            {
                System.Object successorState = resultFunction.result(node.getState(),
                                                                     action);

                double stepCost = stepCostFunction.c(node.getState(), action,
                                                     successorState);
                childNodes.Add(new Node(successorState, node, action, stepCost));
            }
            metrics.set(METRIC_NODES_EXPANDED, metrics
                        .getInt(METRIC_NODES_EXPANDED) + 1);

            return(childNodes);
        }
Esempio n. 14
0
        /**
         * Returns the children obtained from expanding the specified node in the
         * specified problem.
         *
         * @param node
         *            the node to expand
         * @param problem
         *            the problem the specified node is within.
         *
         * @return the children obtained from expanding the specified node in the
         *         specified problem.
         */
        public List <Node> expand(Node node, Problem problem)
        {
            List <Node> successors = new List <Node>();

            ActionsFunction  actionsFunction  = problem.getActionsFunction();
            ResultFunction   resultFunction   = problem.getResultFunction();
            StepCostFunction stepCostFunction = problem.getStepCostFunction();

            foreach (Action action in actionsFunction.actions(node.State))
            {
                System.Object successorState = resultFunction.result(node.State, action);

                double stepCost = stepCostFunction.c(node.State, action, successorState);
                successors.Add(createNode(successorState, node, action, stepCost));
            }

            foreach (NodeListener listener in nodeListeners)
            {
                listener.onNodeExpanded(node);
            }
            counter++;
            return(successors);
        }
Esempio n. 15
0
		public Problem(Object initialState, SuccessorFunction successorFunction,
			GoalTest goalTest, StepCostFunction stepCostFunction) : this(initialState, successorFunction, goalTest)
		{
			
			this.stepCostFunction = stepCostFunction;
		}
Esempio n. 16
0
 public Problem(Object initialState, SuccessorFunction successorFunction,
                GoalTest goalTest, StepCostFunction stepCostFunction,
                HeuristicFunction heuristicFunction) : this(initialState, successorFunction, goalTest, stepCostFunction)
 {
     this.heuristicFunction = heuristicFunction;
 }
Esempio n. 17
0
 public Problem(Object initialState, SuccessorFunction successorFunction,
                GoalTest goalTest, StepCostFunction stepCostFunction) : this(initialState, successorFunction, goalTest)
 {
     this.stepCostFunction = stepCostFunction;
 }