
/*
**  This file forms part of the GOBLIN C++ Class Library.
**
**  Written by Christian Fremuth-Paeger, February 2004.
**  
**  Copying, compiling, distribution and modification
**  of this source code is permitted only in accordance
**  with the GOBLIN general licence information.
*/             


#if !defined(_BRANCHMAXCUT_H_)

#define _BRANCHMAXCUT_H_

#include "bbscheme.h"
#include "absmix.h"


class branchMaxCut : public goblinBBNode<TNode,TFloat>
{
private:

    char* colour;
    TFloat* leftWeight;
    TFloat* rightWeight;
    
    TFloat totalWeight;
    TFloat selectedWeight;
    TFloat dismissedWeight;

    TNode source;
    TNode target;

public:

    abstractMixedGraph &G;
    TNode currentVar;

    branchMaxCut(abstractMixedGraph&,TNode = NoNode,TNode = NoNode) throw();
    branchMaxCut(branchMaxCut&) throw();
    ~branchMaxCut() throw();
    
    unsigned long   Size() throw();     
    unsigned long   Allocated() throw();     
    
    TFloat          SumWeight(TNode) throw();   // Estimation for the heuristic relevance of a node
    TFloat          MinWeight(TNode) throw();   // Minimum Profit if the node is coloured now
    TFloat          MaxWeight(TNode) throw();   // Maximum Profit if the node is coloured now

    TNode           SelectVariable() throw();         // Select variable to branch with
    char            Direction1(TNode) throw(ERRange); // Select branching direction
    char            Direction2(TNode) throw(ERRange); // Select branching direction

    goblinBBNode<TNode,TFloat>* Clone() throw();   // Generate a copy of the branch node
    void            Raise(TNode) throw(ERRange);   // Raise lower variable bound
    void            Lower(TNode) throw(ERRange);   // Lower upper variable bound
    TFloat          SolveRelaxation() throw();     // Returns the objective value of the relaxed
                                                   // subproblem and a corresponding solution
    TFloat          Infinity() throw() {return InfFloat;};
    void            SaveSolution() throw();      // Copy the current solution to the original instance
    TFloat          LocalSearch() throw();       // Post-Optimization for improved feasible solutions

};


#endif
