//------------------------------------------------------------------------------
// module bap.h //
// //
// batch interface for the PNC cluster/learn algorithm //
// //
// copyright (c) 2001-2002 by Lars Haendel //
// mail: lore@newty.de //
// home: www.newty.de //
// //
// This program 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 as version 2 of the License. //
// //
// This program 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 this program; if not, write to the Free Software //
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
// //
//------------------------------------------------------------------------------
#ifndef _BAP_H
#define _BAP_H
#include <time> // due to clock_t
#include <fstream> // ifstream ...
#include "SetResult.h" // TParaSetResult
#include "projectB.h" // TProject
//----------------------------------------------------------------------------------------------------------------------
// class encapsulates batch interface for TLearnMethod (TPnc)
class TBatchInterface
{
private:
bool f_Loaded;
// if study mode is enabled 'data1' is the base data from which learn and test data sets are generated
// else the two objects are the learn and test data
TData *data1, *data2;
TParaSetList* sets; // list with parameters (TParaSet) for tuning
TProjectB prj;
bool f_WriteProtectOutput; // write protect result files
ofstream resfile, optfile; // result files
char szCwd[STS], szFilename[STS]; // working directory and project filename
public:
// constructor/destructor
TBatchInterface(const bool& _f_WriteProtectOutput);
~TBatchInterface();
void DoIt(); // run all tests
void Load(char* szFilename); // load and parse batch file
const char* ProjectFile() const { return szFilename; };
// tune parameters
TParaSet TuneParameters(const unsigned int& seed, TData*const& data, const int& optId, ofstream*const& file);
void WriteStudyResults(const TParaSet*const& para, TParaSetResult& res, const clock_t& T_Opt);
void WriteSettings(ofstream& file, const TData**const& data_L=NULL);
};
#endif