C:/Programme/home/Administrator/CD/stableSetCode/StableSetBranchRule.cpp

Go to the documentation of this file.
00001 
00002 //
00003 //  Module           : StableSetBranchRule.cpp
00004 //  Description      : 
00005 //  Author           : Steffen Rebennack
00006 //  Email            : srebenac@ix.urz.uni-heidelberg.de;
00007 //                     steffen.rebennack@web.de
00008 //  Copyright        : (C) 2006 by the University of Heidelberg
00009 //  Created on       : Wed Apr 05 16:48:06 2006
00010 //  Last modified by : -
00011 //  Last modified on : -
00012 //  Update count     : 0
00013 //
00015 //
00016 //  Date        Name            Changes/Extensions
00017 //  ----        ----            ------------------
00018 //
00020 
00021 #include "abacus/master.h"
00022 #include "StableSetBranchRule.hh"
00023 #include "StableSetSub.hh"
00024 
00025 
00026 
00027 // -----------------------------------------------------------------------------
00028 // C o n s t r u c t o r
00029 // -----------------------------------------------------------------------------
00030 StableSetBranchRule::StableSetBranchRule(ABA_MASTER *master, int node,
00031                                          vector<int> *nodes):
00032     ABA_BRANCHRULE(master),
00033     master_(master),
00034     setToOne(node)
00035 {
00036 
00037     setToZeroSize = nodes->size();
00038 
00039     if (setToZeroSize > 0) {
00040         setToZero = new int[setToZeroSize];
00041         for (int i=0; i<setToZeroSize; i++) {
00042             setToZero[i] = (*nodes)[i];
00043         }
00044     }
00045 }
00046 
00047 
00048 // -----------------------------------------------------------------------------
00049 // D e s t r u c t o r
00050 // -----------------------------------------------------------------------------
00051 StableSetBranchRule::~StableSetBranchRule() {
00052 
00053     if (setToZeroSize > 0) {
00054         delete [] setToZero;
00055     }
00056 
00057 }
00058 
00059 
00060 // -----------------------------------------------------------------------------
00061 // e x t r a c t
00062 //
00063 // Activate this node of the branching tree.
00064 // -----------------------------------------------------------------------------
00065 int StableSetBranchRule::extract(ABA_SUB *sub) {
00066 
00067     int  i, j;
00068     int  size;
00069 
00070     ((StableSetSub *)sub)->setVertex(setToOne, true);
00071 
00072 
00073     for (i=0; i<setToZeroSize; i++) {
00074         // Check for contradictions.
00075         if(sub->variable(setToZero[i])->fsVarStat()->set()) {
00076             return 1;
00077         }
00078         ((StableSetSub *)sub)->setVertex(setToZero[i], false);
00079     }
00080 
00081     return 0;
00082 }
00083 
00084 

Generated on Fri Apr 28 15:49:59 2006 for Branch and Cut algorithm for the Maximum Stable Set Problem by  doxygen 1.4.6-NO