//============================================================================
//                                  I B E X                                   
// File        : Fix-point of a contractor
// Author      : Gilles Chabert
// Copyright   : Ecole des Mines de Nantes (France)
// License     : See the LICENSE file
// Created     : May 01, 2012
// Last Update : May 01, 2012
//============================================================================

#ifndef __IBEX_CTC_FIX_POINT_H__
#define __IBEX_CTC_FIX_POINT_H__

#include "ibex_Ctc.h"

namespace ibex {

/**
 * \ingroup contractor
 * \brief FixPoint of a contractor
 *
 */
class CtcFixPoint : public Ctc {
public:
	/**
	 * \brief build a fix point.
	 *
	 * When the Hausdorff distance between
	 * two iterations is less than ratio*diameter
	 * the fix-point is considered to be reached.
	 */
	CtcFixPoint(Ctc& ctc, double ratio=default_ratio);

	/**
	 * \brief Contract a box.
	 */
	virtual void contract(IntervalVector& box);

	/** The sub-contractor */
	Ctc& ctc;

	/**
	 * Ratio. When the Hausdorff distance between
	 * two iterations is less than ratio*diameter
	 * the fix-point is considered to be reached.
	 */
	double ratio;

	/** Default ratio used, set to 0.1. */
	static const double default_ratio;
};

} // end namespace ibex
#endif // __IBEX_CTC_FIX_POINT_H__
