About the Optimization: How to optimize the functon with N dimention? example: minlm Improved Levenberg-Marquardt optimizer int main(int argc, char **argv) { // // This example demonstrates minimization of F(x0,x1) = f0^2+f1^2, where // // f0(x0,x1) = 10*(x0+3)^2 // f1(x0,x1) = (x1-3)^2 // // using "V" mode of the Levenberg-Marquardt optimizer. // // Optimization algorithm uses: // * function vector f[] = {f1,f2} // // No other information (Jacobian, gradient, etc.) is needed. // real_1d_array x = "[0,0]"; double epsg = 0.0000000001; double epsf = 0; double epsx = 0; ae_int_t maxits = 0; minlmstate state; minlmreport rep;
minlmcreatev(2, x, 0.0001, state); minlmsetcond(state, epsg, epsf, epsx, maxits); minlmoptimize(state, function1_fvec); minlmresults(state, x, rep);
printf("%d\n", int(rep.terminationtype)); // EXPECTED: 4 printf("%s\n", x.tostring(2).c_str()); // EXPECTED: [-3,+3] return 0; }
///********************************************///////////// real_1d_array x = "[0,0]"; I have a function to optimize, sunch as f(x1,x2,x3,x4,,,,,,,x500) in C++,it can be do like this : float x[500]; or. float *x = new float[500];
But in alglib, How to declaration the array x with N(N is big,such as N>100)?????
Like this:????? real_1d_array x = "[0,0,0,0,0,0,0,0,0,0,0,0,00,0,0,0,0,0,0,0,0,0,0,0,0,0,0,00,0,0,0,0,0,.......]";
|