/*****************************************************************//**
 * \file   BranchingRule.h
 * \brief  Reperesents the interface of pricing subproblem algorithm with a virtual pure algorithm to override by inherent classes depending on the choosed algorithm to solve the pricing subproblem.
 *
 * \author talmefta
 * \date   October 2022
 *********************************************************************/
#ifndef BRANCHINGRULE_H
#define BRANCHINGRULE_H

#include "Header.h"
#include "Node.h"

 /**
  * \class BranchingRule
  * \brief Interface of Chain of responsability design pattern dealing with the choice of the branching rule (strategy) when branching a node with fractional solution in branch and price and cut.
  */

template<class RestrictedMasterProblem, class PricingSubProblem, class ColumnGeneration, class ConstraintType>
class BranchingRule {

public:
    /**
     * Virtual destructor.
     *
     */
    virtual ~BranchingRule() {}

    /**
    * \brief Sets the next algorithm operator in the chain of responsibility in the base handler class (here, the BranchingRuleAbstract).
    * \param _next_cutter : BranchingRule< PricingSubProblem>*
    * \return _next_cutter to let us link the algorithms operators in a convenient way (algorithm1->set_next_cutter(handler2)->set_next_cutter(handler3)) : BranchingRule<Instance, ColumnsType, DualVariables>*.
    */
    virtual BranchingRule<RestrictedMasterProblem, PricingSubProblem, ColumnGeneration, ConstraintType>* set_next_branching_rule(BranchingRule<RestrictedMasterProblem, PricingSubProblem, ColumnGeneration, ConstraintType>* _next_branching_rule) = 0;

    /**
      * Branches a node into different children. This method has to be implemented by inherent classes to define how to branch the node.
      *
      * \param node: const Node<class RestrictedMasterProblem, class PricingSubProblem, class ColumnGeneration>&
      * \return list<Node<RestrictedMasterProblem, PricingSubProblem,
         ColumnGeneration, ConstraintType>>
      */
    virtual list<Node<RestrictedMasterProblem, PricingSubProblem,
        ColumnGeneration, ConstraintType>> branch(Node<RestrictedMasterProblem, PricingSubProblem,
            ColumnGeneration, ConstraintType>& node) const = 0;
};

#endif //BranchingRule_H