Problem = SenseProblem(); KB += StaticPartOf(Problem); CurrentState = DynamicPartOf(Problem); NewStates = {CurrentState}; DynamicStateSpace = {}; FrontierStates = {}; while (! SolutionFound(NewStates)) { FrontierStates += NewStates; StateToTransform = ExtractStateToTransform(FrontierStates,KB,DynamicStateSpace); NewStates = ApplyAllTransformations(StateToTransform); DynamicStateSpace += StateToTransform; }
SolutionFound(NewStates,FrontierStates)and install ...
SolutionFound(NewStates,FrontierStates) { static BestSolutionSoFar = NULL; //----Update best state so far foreach (State in NewStates) { if (IsSolution(State) && State > BestSolutionSoFar) { BestSolutionSoFar = State; } } //----Check if there is hope for improvement foreach (State in NewStates + FrontierStates) { if (State could get better than BestSolutionSoFar) { return(FALSE); } } return(TRUE); }
Problem = SenseProblem(); KB += StaticPartOf(Problem); CurrentState = DynamicPartOf(Problem); DynamicStateSpace = {}; while (! SolutionFound(CurrentState)) { Transformation = ChooseTransformationFromCurrentState(CurrentState,KB,DynamicStateSpace); if (Transformation == "backtrack") { CurrentState = PreviousState(CurrentState,DynamicStateSpace); } else { DynamicStateSpace += (CurrentState,Transformation); CurrentState = ApplyTransformation(CurrentState,Transformation); } }
Environment = SenseEnvironment(); Problem = SenseProblem(); KB += StaticPartOf(Problem) + Environment; CurrentState = DynamicPartOf(Problem); DynamicStateSpace = {}; while (! SolutionFound(CurrentState)) { Transformation = ChooseTransformationFromCurrentState(CurrentState,KB,DynamicStateSpace); DynamicStateSpace += CurrentState; ApplyTransformation(CurrentState,Transformation); CurrentState = DynamicPartOf(SenseProblem()); }
Problem = SenseProblem(); KB += StaticPartOf(Problem); CurrentState = DynamicPartOf(Problem); DynamicStateSpace = {}; while (! SolutionFound(CurrentState)) { DynamicStateSpace += CurrentState; Environment = SenseEnvironment(); (FromState,Transformation) = ChooseStateAndTransformation(Environment,KB,DynamicStateSpace); CurrentState = ApplyTransformation(FromState,Transformation); }