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::BranchControl. 00025 */ 00026 00027 namespace bande { 00028 00029 /** 00030 * Central control of branching algorithm 00031 * 00032 * This class coordinates the search for solutions. It is probably 00033 * the most interesting class of the whole project. 00034 */ 00035 class BranchControl { 00036 public: 00037 00038 /** 00039 * Constructor. 00040 * 00041 * @param sols the object where solutions will be collected. 00042 */ 00043 BranchControl(Solutions& sols) : sols(sols) { } 00044 00045 /** 00046 * Destructor. 00047 */ 00048 virtual ~BranchControl() { } 00049 00050 /** 00051 * Public access to private ip member. 00052 */ 00053 IntegerProgram& getIP() { return ip; } 00054 00055 void run(); 00056 00057 private: 00058 00059 /** 00060 * Current integer program. 00061 * 00062 * Initially this corresponds to the input program, but as the 00063 * algorithm proceeds, tighter bounds will be placed on the 00064 * variables, to reflect branching decisions. 00065 * 00066 * The ip is part of BranchControl, not initialized as a separate 00067 * object in Settings::run(), in order to avoid one pointer 00068 * indirection when accessing this object. It can still be 00069 * accessed fully through getIP(). 00070 */ 00071 IntegerProgram ip; 00072 00073 /** 00074 * Keep track of changes, used for switching between branches. 00075 */ 00076 UndoManager um; 00077 00078 /** 00079 * Record solutions. 00080 */ 00081 Solutions& sols; 00082 00083 /** 00084 * Collect some statistical informations. 00085 */ 00086 Statistics statistics; 00087 00088 void branch(int depth); 00089 int branchCol(); 00090 }; 00091 00092 }
1.6.0