Dear Sergey,
Thank you very much for your response!
I have tried what you said but I think I am getting something wrong. Could you please take a look at the following? I tried different alternatives consider the following:
class my_class: mother_class { public: ... void Calibrate(); ... private: void Objective_Function(const alglib::real_1d_array &x, double &func, void *ptr); ... }
void Proxy_Function(const alglib::real_1d_array &x, double &func, void *ptr) { my_class::Objective_Function(const alglib::real_1d_array &x, double &func, void *ptr); //Or, I tried the following as well: ptr->Objective_Function(x, func, ptr);
}
void my_class::Objective_Function(const alglib::real_1d_array &x, double &func, void *ptr) { ... ... func=...;
}
void my_class::Calibrate() // It calibrates all the MPRs { alglib::real_1d_array x = "[1]"; //Initial Value for the MPR alglib::real_1d_array bndl = "[-10]"; //Lower Bound alglib::real_1d_array bndu = "[+10]"; // Upper Bound alglib::minbcstate state; alglib::minbcreport rep;
double epsg = 0.000001; double epsf = 0; double epsx = 0; alglib::ae_int_t maxits = 0;
double diffstep = 1.0e-6;
minbccreatef(x, diffstep, state); minbcsetbc(state, bndl, bndu); minbcsetcond(state, epsg, epsf, epsx, maxits); minbcoptimize(state, Proxy_Function,NULL, this); minbcresults(state, x, rep);
printf("%d\n", int(rep.terminationtype)); printf("%s\n", x.tostring(10).c_str()); } }
I get various compile errors and I think I am getting it completely wrong.
Thank you,
Mario
|