00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <QObject>
00027 #include "search.h"
00028
00029 class GraspPlanningState;
00030 class VariableSet;
00031 class SearchEnergy;
00032 class Hand;
00033 class Body;
00034
00035 class SoSensor;
00036
00037 #include <stdio.h>
00038 #include <matvec3D.h>
00039 #include <vector>
00040
00046 class SimAnn : public QObject
00047 {
00048 Q_OBJECT
00049 public:
00051
00058 enum Result{FAIL = 0, JUMP = 1, KEEP =2};
00059 private:
00060
00061
00063 double YC;
00065 double HC;
00067 double YDIMS;
00069 double HDIMS;
00071 double NBR_ADJ;
00073 double ERR_ADJ;
00075 double DEF_T0;
00077 double DEF_K0;
00078
00080 long int mCurrentStep;
00082 double mT0;
00083
00085 int mTotalSteps;
00087 bool mWriteResults;
00089 FILE* mFile;
00090
00091 double prob(double e_old, double e_new, double t);
00092 double cooling(double t0, double c, int k, int d);
00094 GraspPlanningState* stateNeighbor(GraspPlanningState *s, double T, GraspPlanningState *t = NULL);
00096 void variableNeighbor(VariableSet *set, double T, VariableSet *target = NULL);
00097 double neighborDistribution(double T);
00098 double neighborInverse(double T, double y);
00100 double biasedNeighborDistribution(double T, double in, double conf);
00101
00102 public:
00103 SimAnn();
00104 ~SimAnn();
00105
00107 Result iterate(GraspPlanningState *currentState, SearchEnergy *energyCalculator, GraspPlanningState *targetState = NULL);
00108
00109 void reset();
00110 int getCurrentStep(){return mCurrentStep;}
00111 void setParameters(AnnealingType type);
00112 void writeResults(bool w);
00113 };