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


#if !defined(_BBSTSP_H_)

#define _BBSTSP_H_

#include <bbscheme.h>
#include <spsgra.h>


class BBSTSP : public goblinBBNode<TArc,TFloat>
{
public:

    abstractGraph &G;   // The original graph
    graph *X;           // The copy which is manipulated
    THandle H;          // ... for searching this copy
    TNode selected;     // Cardinality of the partial tour
    TNode root;         // The excluded node of the tree subproblem
    
    BBSTSP(abstractGraph &,TNode) throw();
    BBSTSP(BBSTSP &) throw();
    ~BBSTSP() throw();
    
    unsigned long   Size() throw();     
    unsigned long   Allocated() throw();     
    
    void            SetCandidateGraph() throw(); // Compute candidate arcs
    
    TArc            SelectVariable() throw();        // Select variable to branch with
    char            Direction1(TArc) throw(ERRange); // Select branching direction
    char            Direction2(TArc) throw(ERRange); // Select branching direction

    goblinBBNode<TArc,TFloat> *  Clone() throw();    // Generate a copy of the branch node
    void            Raise(TArc) throw(ERRange);      // Raise lower variable bound
    void            Lower(TArc) throw(ERRange);      // Lower upper variable bound
    void            CheckNode(TNode) throw(ERRange); // Detect deg 2 nodes and restrict
    TFloat          SolveRelaxation() throw();       // Returns the objective value of the relaxed
                                                     // subproblem and a corresponding solution
    TFloat          Infinity() throw()
        {return InfFloat;};
    bool            Feasible() throw();          // Is the relaxed optimum feasible ?
    TFloat          LocalSearch() throw();       // Refine the B&B solution
    void            SaveSolution() throw();      // Copy the current solution to the original instance

};


#endif
