/*Implementation of PStep_SeparationAlgorithm.h

It contains the member functions of PStep_SeparationAlgorithm9

*/

#include "PStep_SeparationAlgorithm.h"

//PStep_SeparationAlgorithm9:
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

//Separate
//------------------------------------------------------------------------------------

//Separate capacity cuts using the algorithm of Lysgaard.
//These cuts are stored in AlgorithmMembers.CapacityCuts, new cuts are appended to the list.
//If it fails, separate homogeneous multistar cuts using the algorithm of Lysgaard.
//These cuts are stored in AlgorithmMembers.HomogeneousMultistarCuts, new cuts are appended to the list.
//If it fails, separate framed capacity cuts using the algorithm of Lysgaard.
//These cuts are stored in AlgorithmMembers.FramedCapacityCuts, new cuts are appended to the list.
//If that fails, separate strengthened comb cuts using the algorithm of Lysgaard.
//These cuts are stored in AlgorithmMembers.StrengthenedCombCuts, new cuts are appended to the list.
void PStep_SeparationAlgorithm9::Separate(){

	//Prepare the selected edges
	SetCurrentEdges();

	//Check whether there are any positively selected edges
	if (NumberOfEdgesPlusOne > 1){

		//Obtain current number of capacity cuts
		int NumberOfCCBeforeSeparation = AlgorithmMembers.NumberOfCapacityCuts;

		//Separate capacity cuts
		SeparateCCLysgaard();

		//Check whether new capacity cuts were added
		if (NumberOfCCBeforeSeparation == AlgorithmMembers.NumberOfCapacityCuts){

			//Obtain current number of framed capacity cuts
			int NumberOfFCCBeforeSeparation = AlgorithmMembers.NumberOfFramedCapacityCuts;

			//Separate framed capacity cuts
			SeparateFCCLysgaard();

			//Check whether new capacity cuts were added
			if (NumberOfFCCBeforeSeparation == AlgorithmMembers.NumberOfFramedCapacityCuts){
				//No violated capacity cuts were identified, separate homogeneous multistar cuts

				//Obtain current number of homogeneous mutlistar cuts
				int NumberOfHMCBeforeSeparation = AlgorithmMembers.NumberOfHomogeneousMultistarCuts;

				//Separate homogeneous multistar cuts
				SeparateHMCLysgaard();

				//Check whether new homogeneous multistar cuts were added
				if (NumberOfHMCBeforeSeparation == AlgorithmMembers.NumberOfHomogeneousMultistarCuts){
					//No violated homogeneous multistar cuts were identified, separate strengthened comb cuts

					//Separate strengthened comb cuts
					SeparateSCombLysgaard();

				}

			}

		}

	}

}