openModeller  Version 1.4.0
garp_run.hh
Go to the documentation of this file.
00001 
00031 #ifndef _GARP_RUN_HH_
00032 #define _GARP_RUN_HH_
00033 
00034 #include <openmodeller/om.hh>
00035 
00036 class AlgorithmImpl;
00037 class AlgParameter;
00038 class BSAlgorithmFactory;
00039 
00040 /****************************************************************/
00041 /************************* AlgorithmRun *************************/
00042 
00048 class AlgorithmRun
00049 {
00050 public:
00051   AlgorithmRun();
00052   AlgorithmRun( const AlgorithmPtr& alg );
00053   virtual ~AlgorithmRun();
00054 
00055   int initialize(int id, int comm_samples,
00056      const SamplerPtr& train_sampler, 
00057      const SamplerPtr& test_sampler, 
00058      int nparam, AlgParameter * param,
00059      BSAlgorithmFactory * factory);
00060   int run();
00061   int iterate();
00062   int finalize();
00063 
00064   int done() const;
00065   bool running() const;
00066   int getId() const { return _id; }
00067   float getProgress() const;
00068   double getOmission() const;
00069   double getCommission() const;
00070   double getError(int type) const;
00071   Scalar getValue(const Sample& x) const;
00072   AlgorithmPtr getAlgorithm() const { return _alg; }
00073 
00074   int calculateOmission();
00075   int calculateCommission();
00076 
00077 private:
00078 
00079   int _id;                   
00080   bool _running;             
00081   double _omission;          
00082   double _commission;        
00083   int _commission_samples;   
00084   AlgorithmPtr _alg;      
00085   SamplerPtr _train_sampler;
00086   SamplerPtr _test_sampler;
00087 
00088   AlgorithmRun( const AlgorithmRun& );
00089   AlgorithmRun& operator=(const AlgorithmRun& );
00090 };
00091 
00092 
00093 #endif
00094