public void setUp() { WumpusCave completeCave = new WumpusCave(4, 4); actionFn = WumpusFunctionFunctions.createActionsFunction(completeCave); resultFn = WumpusFunctionFunctions.createResultFunction(); }
/** * Constructs a problem with the specified components, and a default step * cost function (i.e. 1 per step). * * @param initialState * the initial state that the agent starts in. * @param actionsFn * a description of the possible actions available to the agent. * @param resultFn * 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. */ public GeneralProblem(S initialState, IActionsFunction <S, A> actionsFn, IResultFunction <S, A> resultFn, GoalTest <S> goalTest) : this(initialState, actionsFn, resultFn, goalTest, new DefaultStepCostFunction <S, A>()) { }
/// <summary> /// Returns a RESULT function for the n-queens problem. /// </summary> /// <returns></returns> public static IResultFunction GetResultFunction() { if (_resultFunction == null) { _resultFunction = new NQResultFunction(); } return(_resultFunction); }
public static IResultFunction getResultFunction() { if (null == resultFunction) { resultFunction = new EPResultFunction(); } return resultFunction; }
public static IResultFunction GetResultFunction() { if (null == resultFunction) { resultFunction = new MapResultFunction(); } return(resultFunction); }
public void setUp() { oneBoard = new NQueensBoard(1); eightBoard = new NQueensBoard(8); board = new NQueensBoard(8); actionsFn = NQueensFunctions.getIFActionsFunction(); resultFn = NQueensFunctions.getResultFunction(); goalTest = NQueensFunctions.testGoal; }
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; }
/** * Constructs a problem with the specified components, which includes a step * cost function. * * @param initialState * the initial state of the agent. * @param actionsFn * a description of the possible actions available to the agent. * @param resultFn * 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 stepCostFn * 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 GeneralProblem(S initialState, IActionsFunction <S, A> actionsFn, IResultFunction <S, A> resultFn, GoalTest <S> goalTest, IStepCostFunction <S, A> stepCostFn) { this.initialState = initialState; this.actionsFn = actionsFn; this.resultFn = resultFn; this.goalTest = goalTest; this.stepCostFn = stepCostFn; }
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); }
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; }
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); }
public Problem(object initialState, IActionsFunction actionsFunction, IResultFunction resultFunction, IGoalTest goalTest) : this(initialState, actionsFunction, resultFunction, goalTest, new DefaultStepCostFunction()) { }