AndroMeta  2.0.0
AndroMeta/include/AndroMeta/MMage.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2009-2012 AndroMeta LLC. All rights reserved.
00003  *
00004  * AndroMeta LLC retains all intellectual property and proprietary 
00005  * rights to this software and related documentation and any modifications 
00006  * thereto.  Any use, reproduction, disclosure, or distribution of this 
00007  * software and related documentation without an express license agreement 
00008  * from AndroMeta LLC is strictly prohibited.
00009  * 
00010  */
00011 
00020 #ifndef ANDROMETA_M_MAGE_H
00021 #define ANDROMETA_M_MAGE_H
00022 
00023 #include <AndroMeta/MObject.h>
00024 #include <AndroMeta/MTime.h>
00025 
00026 namespace Meta{
00027 
00034 class MMage : public MObject{
00035 public:
00036 
00040   MMage();
00041 
00045   MMage(const mvar& v, RestoreOpt opt);
00046 
00050   virtual ~MMage();
00051 
00055   virtual void store(mvar& v) const;
00056 
00060   virtual mnode process(mnode n, uint32_t flags=0);
00061 
00065   bool hasObjective(const mstr& objective);
00066     
00093   void addObjective(const mstr& objective,
00094                     size_t population,
00095                     size_t maxDepth,
00096                     double evalTimeout=5.0,
00097                     double mutationRate=0.05,
00098                     double constMutationRate=0.0,
00099                     double selectionPressure=0.5,
00100                     size_t trials=1);
00101   
00119   void addObjectiveVariable(const mstr& objective,
00120                             const mstr& variable,
00121                             const mstr& production,
00122                             const mvar& train=undef);
00123   
00127   bool objectiveHasVariable(const mstr& objective,
00128                             const mstr& variable);
00129     
00141   void addObjectiveProduction(const mstr& objective,
00142                               const mstr& production,
00143                               mnode rules);
00144     
00148   bool objectiveHasProduction(const mstr& objective,
00149                               const mstr& production);
00150    
00160   void setObjectiveCode(const mstr& objective, mnode code);
00161     
00165   void clearObjectives();
00166 
00170   void clearObjective(const mstr& objective);
00171   
00176   bool runObjective(const mstr& objective,
00177                     const mtime& timeout,
00178                     double targetError);
00179 
00183   mnode iterateObjective(const mstr& objective);
00184   
00192   mnode objectiveSolution(const mstr& objective,
00193                           size_t rank,
00194                           double* error=0);
00195   
00200   void addObjectiveSolution(const mstr& objective, mnode n, double error);
00201   
00205   void clearObjectiveSolutions(const mstr& objective);
00206   
00210   double objectiveMaxError(const mstr& objective);
00211     
00215   double objectiveMinError(const mstr& objective);
00216     
00224   double objectiveAverageError(const mstr& objective,
00225                                double cutoff=mvar::inf());
00226 
00231   mnode Integral_(mnode f, mnode v);
00232 
00237   mnode Derivative_(mnode f, mnode v, mnode n);
00238   
00242   mnode Simplify_(mnode f);
00243 
00247   mnode Solve_(mnode f);
00248   
00253   mnode Solve_(mnode fs, mnode vs);
00254 
00255   mnode Coefficient_(mnode f, mnode v);
00256 
00257   mnode Coefficient_(mnode f, mnode v, mnode n);
00258 
00262   mnode Radix_(mnode n, mnode b);
00263 
00264   mnode Series_(mnode a, mnode b);
00265 
00269   mnode IsPrime_(mnode n);
00270 
00274   mnode GCD_(mnode a, mnode b);
00275 
00279   mnode LCM_(mnode a, mnode b);
00280 
00284   mnode Factorial_(mnode n);
00285 
00289   mnode Factor_(mnode n);
00290 
00294   mnode Tex_(mnode f);
00295 
00300   mnode Limit_(mnode f, mnode v);
00301   
00305   mnode Reduce_(mnode n);
00306 
00307 private:
00308   class MMage_* x_;
00309 };
00310 
00311 } // end namespace Meta
00312 
00313 #endif // ANDROMETA_M_MAGE_H