/*****************************************************************//**
 * \file   CutFamilyInformation.h
 * \brief  Stores the information about what happens in an iteration of cutting in node solving
 * 
 * \author talmefta
 * \date   November 2022
 *********************************************************************/
#ifndef CUTFAMILYINFORMATION_H
#define CUTFAMILYINFORMATION_H

#include "Header.h"
#include "RMPCutInformationObserver.h"

/**
 * \class CutFamilyInformation.
 */
class CutFamilyInformation: public RMPCutInformationObserver {

protected:
	string							  name_cutter;
	int									  node_id;
	int							    cut_iteration;
	int						 number_violated_cuts;
	double			dual_bound_before_adding_cuts;
	double									 time;
	double						minimum_violation;
	double						maximum_violation;

public:

	CutFamilyInformation() {
		this->name_cutter = "none";
		this->node_id = -1;
		this->cut_iteration = -1;
		this->number_violated_cuts = -1;
		this->dual_bound_before_adding_cuts = -1;
		this->time = -1;
		this->minimum_violation = -1;
		this->maximum_violation = -1;
	}

	CutFamilyInformation(const string& name, const int& node_id, const int& it, const int& number, const double& db,
		const double& time, const double& min_viol, const double& max_viol) {
		this->name_cutter = name;
		this->node_id = node_id;
		this->cut_iteration = it;
		this->number_violated_cuts = number;
		this->dual_bound_before_adding_cuts = db;
		this->time = time;
		this->minimum_violation = min_viol;
		this->maximum_violation = max_viol;
	}

	~CutFamilyInformation() {
	}

	const string& get_name_cutter() const {
		return this->name_cutter;
	}

	const int& get_cut_iteration() const {
		return this->cut_iteration;
	}

	const int& get_number_violated_cuts() const {
		return this->number_violated_cuts;
	}

	const double& get_dual_bound_before_adding_cuts() const {
		return this->dual_bound_before_adding_cuts;
	}

	const int& get_node_id() const {
		return this->node_id;
	}

	const double& get_time() const {
		return this->time;
	}

	const double& get_minimum_violation() const {
		return this->minimum_violation;
	}
	
	const double& get_maximum_violation() const {
		return this->maximum_violation;
	}

	void update_information(const vector<double>& new_information) override {
		/*if (new_information.size() == 4) {
			set_lower_bound_after_adding_cuts(new_information[0]);
			set_dual_bound_after_adding_cuts_at_root(new_information[0]);
			set_is_solution_integer_after_adding_cuts((new_information[1] == 1) ? true : false);
			set_number_columns_after_adding_cuts(new_information[2]);
			set_solving_rmp_time(new_information[3]);
		}*/
	}

	string toString() const {
		string str = "ITERATION " + to_string(this->cut_iteration) + "\tNODE " + to_string(this->node_id) + "\tSEPARATED CUTS "  + this->name_cutter + "\n";
		str.append("\tNUMBER " + to_string(this->number_violated_cuts) + "\tMIN. VIOL. " + to_string(this->minimum_violation) + "\tMAX. VIOL. " + to_string(this->maximum_violation) + "\n");
		str.append("\tDUAL BOUND BEFORE " + to_string(this->dual_bound_before_adding_cuts) + "\tTIME" + to_string(this->time) + "\n");
		return str;
	}


};

#endif //CUTFAMILYINFORMATION_H