/*Implementation of PStep_ColumnGenerator.h

It contains the member functions of PStep_ColumnGenerator18

*/

#include "PStep_ColumnGenerator.h"

//PStep_ColumnGenerator18:
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

//Generate columns
//------------------------------------------------------------------------------------
//Apply local search first, if it fails apply heuristic labeling while not
//considering reachability when checking dominance. If that fails apply exact labeling.
//For exact labeling, bi-directional layered labeling is used.
void PStep_ColumnGenerator18::GenerateColumns(){

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

	//Apply column generator 2, local search.
	GenerateColumns2();

	//Check if p-steps are added
	if (AlgorithmMembers.NumberOfCurrentPSteps == NumberOfCurrentPStepsBefore){

		//Store the original setting os DoNotCheckReachability
		bool OriginalDoNotCheckReachability = DoNotCheckReachability;
		//Update the column generator setting to only use a limited number of arcs
		DoNotCheckReachability = true;
		//Generate columns with limited arcs and while not checking reachability
		GenerateColumns14();
		//Restore the original setting of DoNotCheckReachability
		DoNotCheckReachability = OriginalDoNotCheckReachability;

		//Check if p-steps are added
		if (AlgorithmMembers.NumberOfCurrentPSteps == NumberOfCurrentPStepsBefore){
			//Heuristic labeling failed, apply exact labeling

			//Generate columns exactly
			GenerateColumns14();

		}

	}

}