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


#if !defined(_BBATSP_H_)

#define _BBATSP_H_

#include <bbscheme.h>
#include <spsdig.h>


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

    abstractMixedGraph &G; // The original graph
    diGraph *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
    
    BBATSP(abstractMixedGraph &,TNode) throw();
    BBATSP(BBATSP &) throw();
    ~BBATSP() 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
