00001 /************************************************************************** 00002 *** 00003 *** Copyright (c) 1995-2000 Regents of the University of California, 00004 *** Andrew E. Caldwell, Andrew B. Kahng and Igor L. Markov 00005 *** Copyright (c) 2000-2004 Regents of the University of Michigan, 00006 *** Saurabh N. Adya, Jarrod A. Roy and Igor L. Markov 00007 *** 00008 *** Contact author(s): abk@cs.ucsd.edu, imarkov@umich.edu 00009 *** Original Affiliation: UCLA, Computer Science Department, 00010 *** Los Angeles, CA 90095-1596 USA 00011 *** 00012 *** Permission is hereby granted, free of charge, to any person obtaining 00013 *** a copy of this software and associated documentation files (the 00014 *** "Software"), to deal in the Software without restriction, including 00015 *** without limitation 00016 *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 00017 *** and/or sell copies of the Software, and to permit persons to whom the 00018 *** Software is furnished to do so, subject to the following conditions: 00019 *** 00020 *** The above copyright notice and this permission notice shall be included 00021 *** in all copies or substantial portions of the Software. 00022 *** 00023 *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00024 *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 00025 *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00026 *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 00027 *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 00028 *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 00029 *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00030 *** 00031 *** 00032 ***************************************************************************/ 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 #ifndef BASEANNEALER_H 00044 #define BASEANNEALER_H 00045 00046 #include "CommandLine.h" 00047 #include "DB.h" 00048 #include "AnalytSolve.h" 00049 00050 // -------------------------------------------------------- 00051 class BaseAnnealer 00052 { 00053 public: 00054 BaseAnnealer(const parquetfp::Command_Line *const params, 00055 parquetfp::DB *const db); 00056 virtual ~BaseAnnealer(); 00057 00058 virtual bool go() = 0; // go() == entire annealing process 00059 virtual bool packOneBlock() = 0; // floorplan only one block 00060 00061 virtual void takePlfromDB() = 0; // get init soln from *db 00062 virtual void solveQP(); // get a quad-minimum soln and update *db 00063 virtual void compactSoln() = 0; 00064 void postHPWLOpt(); 00065 00066 // basic constants for readability 00067 static const int UNINITIALIZED; 00068 static const unsigned int UNSIGNED_UNINITIALIZED; 00069 static const int FREE_OUTLINE; 00070 static const int NOT_FOUND; 00071 00072 enum MOVE_TYPES {MISC = -1, 00073 NOOP = 0, 00074 REP_SPEC_MIN = 1, // representation-specific 00075 REP_SPEC_ORIENT = 2, 00076 REP_SPEC_MAX = 5, 00077 SLACKS_MOVE = 6, 00078 AR_MOVE = 7, 00079 ORIENT = 10, 00080 SOFT_BL = 11, 00081 HPWL = 12, 00082 ARWL = 13}; 00083 00084 class SolutionInfo 00085 { 00086 public: 00087 SolutionInfo() 00088 : area(UNINITIALIZED), 00089 width(UNINITIALIZED), 00090 height(UNINITIALIZED), 00091 HPWL(UNINITIALIZED) {} 00092 00093 double area; 00094 double width; 00095 double height; 00096 double HPWL; 00097 }; 00098 void printResults(const Timer& tm, 00099 const SolutionInfo& curr) const; 00100 double annealTime; 00101 00102 protected: 00103 parquetfp::DB *const _db; // _db, _params behaves like 00104 const parquetfp::Command_Line *const _params; // references, use ptrs for 00105 parquetfp::AnalytSolve *const _analSolve; // code backwd compatibility 00106 char _baseFileName[200]; 00107 00108 BaseAnnealer() 00109 : _db(NULL), _params(NULL), _analSolve(NULL) {} 00110 }; 00111 // -------------------------------------------------------- 00112 00113 #endif