# forum.alglib.net

ALGLIB forum
 It is currently Mon Aug 15, 2022 12:07 am

 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.

 Page 1 of 1 [ 1 post ]
 Print view Previous topic | Next topic
Author Message
 Post subject: termination and minlmrequesttermination(state) issuesPosted: Tue Jun 01, 2021 10:36 am

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

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 1 post ]

 All times are UTC

#### Who is online

Users browsing this forum: Bing [Bot] and 2 guests

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

Search for:
 Jump to:  Select a forum ------------------ ALGLIB forum    ALGLIB-discuss
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group