/*
    Copyright (C) 2012 Bartosz Broda, Jacek Bochenek, Łukasz Biłeńkij, 
    Damian Jaworski, Wojciech Mazur, Dominik Piasecki, Maciej Piasecki, 
    Radosław Ramocki
    
    This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your option)
any later version.

    This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. 

    See the LICENSE and COPYING files for more details.
*/

#pragma once
#include "../comparator_stdheaders.h"
#include "WeightFeature.h"

namespace smartcomparator
{

	namespace weights
	{
		/**
		  * Base class for weights that quantify other weights
		  * In this implementatation the quantization process is straightforward:
		  * the value is rounded up to 2nd place after the dot
		  */
		class SMART_COMPARATOR_API BoundaryScaledWeight : public WeightFeature
		{
		public:
                        BoundaryScaledWeight(Matrices::SuperMatrixPtr pMatrix, WeightFeaturePtr pBaseWeight, double AdjPw = 0.8, double AmISubjw = 0.6, double Coordw = 0.8, double NGenw = 0.6);
			/// does nothing, just virtual marker for subclasses
			virtual ~BoundaryScaledWeight();

			/**
			  * Calls base weight class weighting on a given vector and then performes quantization by calling to
			  * DoScaling() method, which simply rounds all the values at second decimal point.
			  */
			virtual void Weight(size_t rowindex, Matrices::CompressedVector *v, std::set<size_t> &filteredIndices);

		protected:
			/**
			  * Different quantization schemes should override this method
			  */
			virtual void DoScaling(size_t rowindex, Matrices::CompressedVector *v, std::set<size_t> &filteredIndices);

			virtual double getWeight(const size_t& col_no);

                        std::pair<size_t,size_t> AdjP_index;
			double AdjP_weight;
                        std::pair<size_t,size_t> AmISubj_index;
			double AmISubj_weight;
                        std::pair<size_t,size_t> Coord_index;
			double Coord_weight;
                        std::pair<size_t,size_t> NGen_index;
			double NGen_weight;

			WeightFeaturePtr m_pBaseWeight;
		};

	}// namespace weights
}// namespace smartcomparator
