//  -*- C++  -*-
//
//======================================================================
//  File:          project.c
//  Author:        Thomas G. Dietterich
//  Description:   Reads in a probability table.  Then prompts the
//                 user for a variable and value to project out of the
//                 table (i.e., to treat as observed).  The table is
//                 projected onto the remaining variables and written
//                 on the output.
//                 
//  Copyright (c) 1995 by Thomas G. Dietterich.  All Rights Reserved.
//       may be reproduced by any non-commercial purpose.
//======================================================================
#include "ptable.h"
#include <iostream.h>
#include <fstream.h>

int main(int argc, char * argv[])
{
  probabilityTable table1;

  {
    ifstream str(argv[1]);
    str >> table1;
  }

  cout << "Enter variable to observe: ";
  int var;
  cin >> var;
  cout << "Enter value observed (0 or 1): ";
  int value;
  cin >> value;
  
  table1.project(var,value);

  cout << "Results:" << endl;
  cout << table1;
  return 0;
}
