/*
    Copyright (C) 2011 Brendon J. Brewer
    This file is part of DNest, the Diffusive Nested Sampler.

    DNest is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    DNest 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
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with DNest.  If not, see <http://www.gnu.org/licenses/>.
*/


#ifndef _Model_
#define _Model_

#include "LikelihoodType.h"
#include "Level.h"
#include <ostream>

namespace DNest
{
	class Model
	{
		protected:
			LikelihoodType logl;

		public:
			virtual ~Model();
			virtual Model* factory() const = 0;
			virtual Model* clone() const = 0;
			virtual void copyFrom(const Model* other) = 0;

			virtual void calculateLogLikelihood() = 0;
			virtual void fromPrior();
			virtual double perturb();

			bool update(const LikelihoodType& cutoff);
			void explore(const LikelihoodType& cutoff, int numSteps);
			void update(); // Just target the posterior
			virtual void print(std::ostream& out) const;
			LikelihoodType getLogLikelihood() const;

			friend bool operator < (const Level& level, const Model* model);
	};
}

#endif

