00001 /* 00002 * Copyright 2007 Martin von Gagern 00003 * 00004 * 00005 * This file is part of bande. 00006 * 00007 * bande is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * bande is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 00022 /** 00023 * @file 00024 * Interface of class bande::Statistics. 00025 */ 00026 00027 namespace bande { 00028 00029 /** 00030 * Performs some statistical calculations. 00031 */ 00032 class Statistics { 00033 public: 00034 00035 /** 00036 * Constructor. 00037 */ 00038 Statistics() { reset(); } 00039 00040 /** 00041 * Destructor. 00042 */ 00043 virtual ~Statistics() { } 00044 00045 /** 00046 * Clear the collected statistical data. 00047 * 00048 * Collection of statistics will start from scratch, the clock 00049 * will start to tick immediately. 00050 */ 00051 void reset() { startTime = getTime(); numSolutions = 0; } 00052 00053 void solution(int depth); 00054 00055 /** 00056 * An infeasible subproblem has been encountered. 00057 * 00058 * @param depth the depth in the search tree at which the 00059 * infeasibility has been detected. 00060 */ 00061 void infeasible(int depth) { } 00062 00063 private: 00064 00065 /** 00066 * The time when the calculation was started. 00067 */ 00068 double startTime; 00069 00070 /** 00071 * The number of solutions found. 00072 */ 00073 int numSolutions; 00074 00075 double getTime(); 00076 }; 00077 00078 }
1.6.0