/*Implementation of PStep_Algorithm::SolveRootNode.

*/

#include "PStep_Algorithm.h"

//Solve the rootnode
//This function initializes the algorithm and applies column generation to solve the
//LP-relaxation of the p-step formulation.
void PStep_Algorithm::SolveRootNode(const CVRPInstance &NewInstance, const PStep_AlgorithmSettings &NewAlgorithmSettings){

	//Initialize intitialization time
	timePoint tic, toc;
	tic = HomeMadeclock::now();

	//Initialize algorithm
	Initialize(NewInstance, NewAlgorithmSettings);

	//Select the rootnode to be the current node which is to be solved by column generation.
	AlgorithmMembers.CurrentTreeNode = AlgorithmMembers.Nodes.begin();

	//Obtain end time of initialization
	toc = HomeMadeclock::now();
	//Note that we do not yet set the initialization time, as ColumnGeneration resets this.

	//Solve rootnode
	ColumnGeneration();

	//Set initialization time
	AlgorithmMembers.CurrentCGStatistics.InitializationTime = HomeMadeclock::seconds(tic, toc);

}