/* Header file of the PStep_EdgeAndCoefficientCut class

This class is used to represent a cut to the p-step formulation, only pertaining to edge
flow variables, and a coefficient is provided per edge.

*/

#ifndef _PSTEP_TWOEDGEHYPOTOURCUT_H
#define _PSTEP_TWOEDGEHYPOTOURCUT_H

#include <list>
#include <iostream>
#include <sstream>
#include <fstream>

//Auxiliary class to represent an edge index and a coefficient
class PStep_EdgeAndCoefficient{
public:
	//Edge index
	short int EdgeIndex;
	double Coefficient;
};

//Class used to represent a cut to the p-step formulation.
class PStep_EdgeAndCoefficientCut{
public:

	//The indices of the used edges
	std::list<PStep_EdgeAndCoefficient> EdgeAndCoefficients;

	//Bound (the number of nodes in W)
	double Bound;

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

	void print(){

		if (!EdgeAndCoefficients.empty()){
			auto i = EdgeAndCoefficients.begin();
			if (i->Coefficient == -1){
				std::cout << "-";
			}
			else if (i->Coefficient == 1){

			}
			else{
				std::cout << i->Coefficient;
			}
			std::cout << "(" << i->EdgeIndex << ")";
			++i;
			for (; i != EdgeAndCoefficients.end(); ++i){
				if (i->Coefficient == -1){
					std::cout << "-";
				}
				else if (i->Coefficient == 1){
					std::cout << "+";
				}
				else if (i->Coefficient > 0){
					std::cout << "+" << i->Coefficient;
				}
				else{
					std::cout << "-" << i->Coefficient;
				}
				std::cout << "(" << i->EdgeIndex << ")";
			}
			std::cout << " Bound by " << Bound << std::endl;
		}
	};

};

#endif