CondensationTracker::CondensationTracker(
		std::shared_ptr<TransitionModel> transitionModel, std::shared_ptr<MeasurementModel> measurementModel,
		std::shared_ptr<ResamplingAlgorithm> resamplingAlgorithm, std::shared_ptr<StateExtractor> extractor,
		size_t count, double randomRate, int minSize, int maxSize) :
				count(count),
				randomRate(randomRate),
				minSize(minSize),
				maxSize(maxSize),
				samples(),
				oldSamples(),
				state(),
				adapted(false),
				image(make_shared<VersionedImage>()),
				transitionModel(transitionModel),
				measurementModel(measurementModel),
				resamplingAlgorithm(resamplingAlgorithm),
				extractor(extractor),
				validators(),
				generator(boost::mt19937(time(0))),
				intDistribution(boost::uniform_int<>()),
				realDistribution(boost::uniform_real<>()) {
	if (minSize < 1)
		throw invalid_argument("ResamplingSampler: the minimum size must be greater than zero");
	if (maxSize < minSize)
		throw invalid_argument("ResamplingSampler: the maximum size must not be smaller than the minimum size");
	setRandomRate(randomRate);
	shared_ptr<StateValidator> validator = std::dynamic_pointer_cast<StateValidator>(measurementModel);
	if (validator)
		addValidator(validator);
}
ResamplingSampler::ResamplingSampler(unsigned int count, double randomRate,
		shared_ptr<ResamplingAlgorithm> resamplingAlgorithm, shared_ptr<TransitionModel> transitionModel, int minSize, int maxSize) :
				count(count),
				randomRate(randomRate),
				resamplingAlgorithm(resamplingAlgorithm),
				transitionModel(transitionModel),
				minSize(minSize),
				maxSize(maxSize),
				generator(boost::mt19937(time(0))),
				intDistribution(boost::uniform_int<>()),
				realDistribution(boost::uniform_real<>()) {
	if (minSize < 1)
		throw invalid_argument("ResamplingSampler: the minimum size must be greater than zero");
	if (maxSize < minSize)
		throw invalid_argument("ResamplingSampler: the maximum size must not be smaller than the minimum size");
	setRandomRate(randomRate);
}