forum.alglib.net

ALGLIB forum
It is currently Tue Dec 10, 2024 12:21 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: termination and minlmrequesttermination(state) issues
PostPosted: Tue Jun 01, 2021 10:36 am 
Offline

Joined: Tue Jun 01, 2021 10:26 am
Posts: 1
Hello,

I'm using the Levenberg Marquardt algorithm to optimize a simulation based problem. Algo works fine but I have some issues with the termination. I'm tracking the different iterations and the final solution is not the best that have been tested for my problem. I tried to call "minlmrequesttermination(state);" in my call-back function to force termination at the right moment, but i'm not sure how to do it. If you have any suggestions on why the final result of optimisation isn't the best one and/or can I code "minlmrequesttermination(state) properly, I'll be glad.

Thanks in advance !

Here is my call back function :

void functionRT_fvec(const real_1d_array &x, real_1d_array &fi, void *ptr)
{
InputDataRT temp = *((InputDataRT *)ptr);
int size = temp.vec.size();
std::ofstream indices("./data/indices/TEMP-Optimisation.dat");
for (size_t j = 0; j<size-2; ++j)
{
indices << temp.vec[j] << " ";

}
indices << x[0] << " " << x[1];
indices.close();

double freq, R,Tr, rad,E;

system("MCRT.exe");

std::string path = "./temp/OutForOpti_1_RTERad.dat";
std::ifstream RTERad(path.c_str());
std::string line;

if (RTERad.good())
{
while(std::getline(RTERad,line))
{
char firstChar = line[0];

if (firstChar != '#')
{
RTERad >> freq; RTERad >> R; RTERad >> Tr; RTERad >> rad; RTERad >> E;
}
}
}
else {std::cout << "Can't open MCRT output file !" << std::endl;}

//std::cout << "indexes are : " << x[0] << " " << x[1] << std::endl;

fi[0] = temp.data_R-R;
fi[1] = temp.data_T-Tr;

if(abs(fi[0]) <= 1e-2 && abs(fi[1]) <= 1e-2)
{
minlmstate state; /* redefining state is certainly not the right way */
std::cout << "STOP REQUIRED" << std::endl;
minlmrequesttermination(state);
}

};


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group