%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Siddhartha Kasivajhula
% PSYCH 221/ EE 362 (Winter 2007-2008)
% Final Project: A Probabilistic Model of the Visual System
% 
% TestModel.m
% Tests the model by:
% 1. generating an initial random scene,
% 2. evolving it through the Hidden Markov Model
% 3. Simulating an observation (as defined in the model)
% 4. Representing a prior knowledge of objects on the part of the observer
%    - objects are represented as vectors of feature weights (see paper)
% 5. interpreting the observation as defined in the model -- by assigning weights
%    to hypothesis objects, and identifying the object as the max. weight hypothesis
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

NUM_FEATURES = 10;
NUM_SCENE_FEATURES = 6;
NUM_TIMESTEPS = 10;

scene_0 = GenerateInitialScene(NUM_FEATURES, NUM_SCENE_FEATURES);
known_objects = RepresentObserverKnowledge(NUM_FEATURES);

disp('The initial scene is:'); disp(scene_0);
disp('The observers knowledge of objects is represented as:'); disp(known_objects);

scene_t = scene_0;
% evolve the scene through 10 timesteps
for i = 1:NUM_TIMESTEPS
	scene_tprime = HMM_scene(NUM_FEATURES, scene_t);
	disp('The current scene is:'); disp(scene_tprime);
	observation = MakeObservation(scene_tprime);
	disp('The current observation is:'); disp(observation);
	interpretation = NoisyOrBN_interpret(observation, known_objects);
	disp('The scene has been interpreted as:'); disp(interpretation);
	input('Press any key to continue to next timestep');
end

