//---------------------------------------------------------------------------

#ifndef HeurCoverH
#define HeurCoverH
//---------------------------------------------------------------------------

class HeurCover {
	private:
		const CovMatrix *CM;

		unsigned int rownum;			// # current of rows
		unsigned int colnum;			// # current of columns

		list<unsigned int> columns;		// list of current columns
		list<unsigned int> solution;

		void Contrib_SelectColumn(void);	// select one column by the combined contribution heuristic
		void Essentials();				// moves essential columns to the solution
		list<unsigned int>::iterator MoveToSolution( list<unsigned int>::iterator col_it );
		void DeleteRow(int row);

		int* col_contrib;	// column contributions (# of uncovered rows covered by the column)

		float* float_col_contrib;	// column contributions (# uncovered rows * their row float contributions )

		int* row_contrib;	// row contributions (# of columns not in solution covering the uncovered row)

		float* float_row_contrib;	// row contributions ( 1 / # of columns not in solution covering the uncovered row )

		/** \brief number of rows covered*/
		int covered_rows;

		/** \brief Vector of rows covered*/
		bool* row_is_covered;

		/** \brief Vector of costs of columns */
		unsigned int* costs;

		void initialize();

		/** \brief Array with indexes of rows covered by columns */
		unsigned int** rows_covered_by_column;

		/** \brief Number of rows covered by given column */
		unsigned int* rows_covered_by_column_count;

		/** \brief Array with indexes of columns covered by rows */
		unsigned int** columns_covered_by_row;

		/** \brief Number of columns covered by given row */
		unsigned int* columns_covered_by_row_count;

		/** \brief Vector of the LP solution */
		int* x;



	public:
		HeurCover( const CovMatrix *_matrix );
		~HeurCover(void);

		list<unsigned int> Run(void);
		list<unsigned int> RunServit(void);
		list<unsigned int> RunContribAdd(void);

};

#endif
