//  -*- C++  -*-
//
//======================================================================
//  File:          maximize.c
//  Author:        Thomas G. Dietterich
//  Description:   This program reads in a probaility table and
//                 prompts the user for a list of variables to max marginalize
//                 over.  It writes the resulting table on cout.
//                 
//  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, table2;

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

  table2 = table1;

  cout << "Enter variables to maximize over (list): ";
  list<int> vars;
  cin >> vars;
  
  variableSet vs(vars);

  table2.maximize(vs);

  cout << "Results:" << endl;
  cout << table2;

  return 0;
}
