//------------------------------------------------------------------------------
// module task.h //
// //
// A kind of struct with load and save functionality. Encapsulates a task, //
// i.e. a set of parameter values for the PNC2 algorithm, that are used //
// to generate a TParaSetList by building all possible combinations. //
// //
// 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 TASKS_H
#define TASKS_H
#include <values> // due to: MAXFLOAT
#include "stdlist.h" // TStdList
#include "ParaSetList.h" // TParaSetList
//----------------------------------------------------------------------------------------------------------------------
class TTask; // forward declaration
typedef TStdList<TTask> TTaskList; // typedef for list with TTask objects
// parse parameter string: search for sub-strings terminated by ';', convert them to floats and store them in parameter
// array. return # parameters found
int ParseParameters(const char*const& szPar, float*& para, const float& defVal, const char*const& szName
, const float& min, const bool f_Integer=false, const float& max=MAXFLOAT);
// convert tasks to parameter set list
TParaSetList* /*cr*/ ToParaSetList(TTaskList*const& tasks, const TData*const& data, const bool& f_Regression);
//----------------------------------------------------------------------------------------------------------------------
// one tuning task: struct to encapsulate parameter strings for each parameter which are combined with eachother
// to generate the parameter set list
class TTask
{
public:
// constructor/destructor
TTask(){};
~TTask(){};
void Save(ofstream& file); // write task to file
void Load(ifstream& file); // read task from file
// used to replace ';' or space in task strings or vice versa
void Replace(const char& a, const char& b);
// private:
char szN_Int[STS], szW_COD[STS], szEta[STS]; // parameter strings
char szW_Kernel[STS], szSigma[STS];
char szP_Min[STS], szPrune[STS], szWeights[STS], szMetric[STS];
#ifndef RELEASE // obsolete in release versions
char szW_Kernel_Min[STS];
char szDifMax[STS], szNoise[STS];
#endif
// # parameter sets (all/learn); determined by parsing parameter strings
int nSets, nSetsLearn;
};
#endif