//------------------------------------------------------------------------------
//    module ProjectG.h                                                       //
//                                                                            //
//    Class TProject Encapsulates project settings. Derived from TProject.    //
//    See source or http://www.newty.de/pnc2/sdocu.html for more information. //
//                                                                            //
//    copyright (c) 2001-2003 by Lars Haendel                                 //
//    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 PROJECT_G_H
#define PROJECT_G_H

#include "project.h"


// section '[Gui]'
#define DEF_PRUNE_ANYWAY         (bool) true
#define DEF_KILL_CUBOIDS         (bool) false
#define DEF_WRITE_PREDICTIONS    (bool) true


// section '[Tuning]'
#define MIN_HEURISTIC_N_R_TUNE         (int)   10     // minimal value for automated initialization


//----------------------------------------------------------------------------------------------------------------------
// encapsulates settings for usage of PNC2 algorithm for the GUI
class TProjectG : public TProject
{
public:

   //-------------------------------------------------------------------------------------------------------------------
   // a) load and save settings from/to file
   void Load(ifstream& file, const char*const& _szProjectFilePath);
   void Save(ofstream& file, const bool& f_WriteTuningAnyway=true);

   // check project parameters against constraints and given data file, set output column and variable types,
   // set dependant variables and associate data -  WARNING: caller has to release returned TParaSetList !!
   TParaSetList* /*cr*/ Synchronize(TData*const& _data1, const bool& f_CheckTuningAnyway=true);

   // initialize project parameters with defaults, associate data
   void Initialize(TData*const& _data1);
   void Reset();



   //-------------------------------------------------------------------------------------------------------------------
   // b) section [Basic]
   void SetData1(TData*const& _data1);
   void SetData2(TData*const& _data2);
   void ClearData2() { data2 = NULL;   szData2[0] = '\0'; };



   //-------------------------------------------------------------------------------------------------------------------
   // c) section [Gui]

   // get and set simulation output file name with full path
   const char* GetSimulationOutputFileName()const{ return GetPrefixedPath(szSimulationOutputFile, szProjectFilePath); };
   void SetSimulationOutputFileName(const char* szFileName) { strcpy(szSimulationOutputFile, szFileName); };

   // get and set project's GUI settings
   bool&  PruneAnyway() { return f_PruneAnyway; };
   bool&  KillCuboids() { return f_KillCuboids; };
   bool&  Modify1() { return f_Modify1; };
   bool&  Modify2() { return f_Modify2; };
   bool&  Prune() { return f_Prune; };
   bool&  UseWeights() { return f_Weights; };
   bool&  Euclid() { return f_Euclid; };
   int&   p_min() { return _p_min ; };
   float& W_Kernel() { return _W_Kernel; };
   float& Sigma() { return _Sigma; };
   bool&  Model() { return f_Model; };
   bool&  TuningResults() { return f_TuningResults; };
   bool&  WritePredictions() { return f_WritePredictions; };

   void CorrectTasksIntervals();    // correct values of 'N_Int' for classification tasks


   //-------------------------------------------------------------------------------------------------------------------
   // d) section [Tuning]
   void SetTuneType(const TTestType& type);
   void Set_N_R_Tune(int _N_R_Tune);
   void DefDataSplitting();         // use heuristic to set default value for parameters 'DataSplitting' and 'N_R_Tune'
   void Def_N_R_Tune();
   int Peek_N_L();                  // peek learn data tuple count


private:

   //-------------------------------------------------------------------------------------------------------------------
   // section [GUI]
   char szSimulationOutputFile[STS];
   bool f_PruneAnyway;
   bool f_KillCuboids;
   bool f_Modify1, f_Modify2;          // flags for the state of the parameter modification check boxes on TS 'Deploy'
   bool f_Prune, f_Weights, f_Euclid;  // alternate parameters
   float _W_Kernel, _Sigma;
   int   _p_min;
   bool f_WritePredictions, f_Model, f_TuningResults;

   void SetDependants();               // set dependant variables
};
#endif