I am trying to use the BLEIC optimiser. However, everytime my code gets to minbleicsetscale it terminates after throwing an instance of 'alglib::ap_error'.
Code:
#include <stdio.h>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <stdlib.h>
#define TWO_PI 6.28318530732959
#define PI 3.14159255
//include libraries
#include <string> //for joining the strings
#include <sstream> //for naming the output files.
#include <iostream>
#include <omp.h>
#include <ctime> //for random numbers
#include <cstdlib> //for srand() and rand()
#include <iostream>
#include "/hwdisks/home/al544/ALGLIB/cpp/src/stdafx.h"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/ap.h"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/ap.cpp"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/linalg.h"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/linalg.cpp"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/alglibinternal.h"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/alglibmisc.h"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/alglibinternal.cpp"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/alglibmisc.cpp"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/solvers.h"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/solvers.cpp"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/interpolation.h"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/interpolation.cpp"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/specialfunctions.cpp"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/specialfunctions.h"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/statistics.cpp"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/statistics.h"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/optimization.cpp"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/optimization.h"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/integration.cpp"
#include "/hwdisks/home/al544/ALGLIB/cpp/src/integration.h"
using namespace std;
int main (int argc, char* argv[]) {
int lenJ = 400;
double diffstep = 1e-6;
alglib::minbleicstate bleicstate;
alglib::minbleicreport bleicrep;
alglib::real_1d_array lambdaJguess;
lambdaJguess.setlength(lenJ);
alglib::real_1d_array lscale;
lscale.setlength(lenJ);
for (int i = 0; i < lenJ; i++) {
lambdaJguess[i] = 0.0;
lscale[i] = 10.*double(i);
}
alglib::minbleiccreatef(lenJ, lambdaJguess, diffstep, bleicstate);
printf("after creating minbleiccreatef\n");
alglib::minbleicsetscale(bleicstate, lscale);
printf("after setting scale\n");
return 0;
}
This is simply a cut-down code, to show the problem. Any suggestions would be welcomed.
Thanks.