Fawkes API Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * astar_state.h - Abstract class of a astar state. 00004 * 00005 * Generated: Mon Sep 15 18:48:00 2002 00006 * Copyright 2002-2007 Stefan Jacobs, Martin Liebenberg 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef _ASTAR_ABSTRACT_STATE_H_ 00025 #define _ASTAR_ABSTRACT_STATE_H_ 00026 00027 #include <vector> 00028 00029 namespace fawkes { 00030 00031 /** @class AStarState <utils/search/astar_state.h> 00032 * This is the abstract(!) class for an A* State. 00033 * 00034 * @author Stefan Jacobs 00035 */ 00036 class AStarState 00037 { 00038 public: 00039 00040 /** Constructor. */ 00041 AStarState() {}; 00042 00043 /** Destructor. */ 00044 virtual ~AStarState() {}; 00045 00046 00047 // ***** You have to implement the following 4 methods! ***** // 00048 // ***** ============================================== ***** // 00049 00050 /** Generates a unique key for this state. 00051 * There has to be a unique key for each state (fast closed list -> bottleneck!) 00052 * @return unique long key 00053 */ 00054 virtual long calculateKey() = 0; 00055 00056 /** Estimate the heuristic cost to the goal. 00057 * @return estimated cost as double 00058 */ 00059 virtual double estimate() = 0; 00060 00061 /** Check, wether we reached a goal or not. 00062 * @return true, if this state is a goal, else false 00063 */ 00064 virtual bool isGoal() = 0; 00065 00066 /** Generate all successors and put them to this vector. 00067 * @return a vector of pointers of AStarState to a successor 00068 */ 00069 virtual std::vector< AStarState * > generateChildren() = 0; 00070 00071 /** Predecessor. */ 00072 AStarState *father; 00073 00074 /** Past cost. */ 00075 double pastCost; 00076 /** Total estimated cost. */ 00077 double totalEstimatedCost; 00078 00079 /** The unique key of this state. */ 00080 long key; 00081 }; 00082 00083 } // end namespace fawkes 00084 00085 #endif