/*Header file of the BiDirectionalLabels classes

Implementation can be found in BiDirectionalLabels.cpp

These classes represents labels for a bi-directional labeling algorithm for the pricing problem of the CVRP.

*/

#ifndef _BIDIRECTIONALLABELS_H
#define _BIDIRECTIONALLABELS_H

#include <iostream>
#include <bitset>

//ForwardLabel:
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

//Class used to represent a forward label for the pricing problem of the CVRP.
class ForwardLabel{
public:

	//Resources:
	//------------------------------------------------------------------------------------

	//Cost
	double Cost;

	//Cummulative load
	double Load;

	//Reachability
	//Reachable[i] is true if the i-th location can still be reached,
	//i=0 represents the first customer.
	std::bitset<PSTEP_MAXLOCATIONS> Reachable;

	//Other statistics
	//------------------------------------------------------------------------------------

	//Number of customers excluding the depot.
	short int NumberOfCustomers;

	//Last location visited on the partial path represented by this label.
	//Location 0 is the depot.
	short int LastLocation;

	//Pointer to a label representing the partial path up to the semi-last location of
	//the partial path represented by this label.
	ForwardLabel *PreviousLabel;

	//Constructor functions:
	//------------------------------------------------------------------------------------

	//Default Constructor
	ForwardLabel()
		:Cost(0), Load(0), NumberOfCustomers(0), LastLocation(0), PreviousLabel(0)
	{};

	//Print functions
	//------------------------------------------------------------------------------------

	//Print resources
	void PrintResources();

};

//BackwardLabel:
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

//Class used to represent a backward label for the pricing problem of the CVRP.
class BackwardLabel{
public:

	//Resources:
	//------------------------------------------------------------------------------------

	//Cost
	double Cost;

	//Cummulative load
	double Load;

	//Reachability
	//Reachable[i] is true if the i-th location can still be reached,
	//i=0 represents the first customer.
	std::bitset<PSTEP_MAXLOCATIONS> Reachable;

	//Other statistics
	//------------------------------------------------------------------------------------

	//Number of customers excluding the depot.
	short int NumberOfCustomers;

	//First location visited on the partial path represented by this label.
	//Location 0 is the depot.
	short int FirstLocation;

	//Pointer to a label representing the partial path from the next location of
	//the partial path represented by this label.
	BackwardLabel *NextLabel;

	//Constructor functions:
	//------------------------------------------------------------------------------------

	//Default Constructor
	BackwardLabel()
		:Cost(0), Load(0), NumberOfCustomers(0), FirstLocation(0), NextLabel(0)
	{};

	//Print functions
	//------------------------------------------------------------------------------------

	//Print resources
	void PrintResources();

};

#endif