/*Implementation of PStep_ColumnGenerator.h

It contains the member functions of PStep_ColumnGenerator7

*/

#include "PStep_ColumnGenerator.h"

//PStep_ColumnGenerator7:
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

//Generate columns
//------------------------------------------------------------------------------------

//Use neighborhood search heuristic, column generator 2, if it fails apply decremental
//state-space relaxation, column generator 5.
void PStep_ColumnGenerator7::GenerateColumns(){

	//Obtain the number of p-steps currently added
	int NumberOfCurrentPStepsBefore = AlgorithmMembers.NumberOfCurrentPSteps;

	//Apply column generator2
	GenerateColumns2();

	//Check if p-steps are added
	if (AlgorithmMembers.NumberOfCurrentPSteps == NumberOfCurrentPStepsBefore){
		//The heuristic did not identify negative reduced cost p-steps,
		//use heuristic labeling
		
		//Reinitialize the decremental state-space information, if required
		if (AlgorithmMembers.DSSRUsed && AlgorithmMembers.AlgorithmSettings.DSSRReset == 3){
			ResetDSSRNeighbourhoods();
		}

		//Initialize the decremental state-space relaxation loop
		RerunRequired = true;

		//Resolve the pricing problem as long as RerunRequired is true
		while (RerunRequired){

			//Generate columns
			GenerateColumns3();

		}

		//Check if p-steps are added
		if (AlgorithmMembers.NumberOfCurrentPSteps == NumberOfCurrentPStepsBefore){
			//The heuristic did not identify negative reduced cost p-steps,
			//use exact labeling

			//Initialize the decremental state-space relaxation loop
			RerunRequired = true;

			//Resolve the pricing problem as long as RerunRequired is true
			while (RerunRequired){

				//Generate columns
				GenerateColumns1();
			}

		}

	}

}