/** 
* @file CascadeOptimization.h
* @brief optimization of a previously built cascade
* @author Erik Rodner
* @date 11/13/2008

*/
#ifndef CASCADEOPTIMIZATIONINCLUDE
#define CASCADEOPTIMIZATIONINCLUDE

#include "core/vector/VectorT.h"
#include "core/vector/MatrixT.h"

#include <vector>
#include <list>

#include "core/basics/triplet.h"
  

namespace OBJREC {

/** optimization of a previously built cascade */
class CascadeOptimization
{

    protected:

    public:
  
	/** simple constructor */
	CascadeOptimization();
      
	/** simple destructor */
	virtual ~CascadeOptimization();
 
	bool calcOptimalCascade ( const std::vector<std::vector< NICE::triplet<double, double, double> > > & matrix,
				       std::list<int> & path,
				       double & besttprate,
				       double tprate,
				       double fprate,
				       double minimumFPRate,
				       uint round );

	void calcOptimalCascade ( const std::vector<std::vector< NICE::triplet<double, double, double> > > & matrix,
				  double minimumFPRate,
				    std::vector<double> & thresholds );
	
	/** side-effect @param results will be sorted */
	bool evaluateCascade ( std::vector<std::pair<double, int> > & results,
				  long N, long P,
				  int negativeClassDST,
				  double requiredDetectionRate,
				  double & bestthreshold,
				  double & tprate,
				  double & fprate,
				  std::vector< NICE::triplet<double, double, double> > & statistics );

};


} // namespace

#endif
