# forum.alglib.net

ALGLIB forum
 It is currently Sun Sep 08, 2024 12:51 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.

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: How to get the objective function value minbleic in 3.8.0?Posted: Mon Nov 04, 2013 3:45 am

Joined: Mon Feb 28, 2011 7:23 am
Posts: 9
minbleic
In the previous version , I can get the objective function value and others.
But in 3.8.0,I Don't know how to get the objective function value with minbleic ?

void function1_grad(const real_1d_array &x, double &func, real_1d_array &grad, void *ptr)
{
//
// this callback calculates f(x0,x1) = 100*(x0+3)^4 + (x1-3)^4
// and its derivatives df/d0 and df/dx1
//
func = 100*pow(x[0]+3,4) + pow(x[1]-3,4);
}

int main(int argc, char **argv)
{
//
// This example demonstrates minimization of f(x,y) = 100*(x+3)^4+(y-3)^4
// subject to bound constraints -1<=x<=+1, -1<=y<=+1, using BLEIC optimizer.
//
real_1d_array x = "[0,0]";
real_1d_array bndl = "[-1,-1]";
real_1d_array bndu = "[+1,+1]";
minbleicstate state;
minbleicreport rep;

//
// These variables define stopping conditions for the optimizer.
//
// We use very simple condition - |g|<=epsg
//
double epsg = 0.000001;
double epsf = 0;
double epsx = 0;
ae_int_t maxits = 0;

//
// Now we are ready to actually optimize something:
// * first we create optimizer
// * we add boundary constraints
// * we tune stopping conditions
// * and, finally, optimize and obtain results...
//
minbleiccreate(x, state);
minbleicsetbc(state, bndl, bndu);
minbleicsetcond(state, epsg, epsf, epsx, maxits);
minbleicresults(state, x, rep);

//
// ...and evaluate these results
//
printf("%d\n", int(rep.terminationtype)); // EXPECTED: 4
printf("%s\n", x.tostring(2).c_str()); // EXPECTED: [-1,1]

cout<<"rep.iterationscount= "<<rep.iterationscount<<endl;
cout<<"rep.nfev= "<<rep.nfev<<endl;
cout<<"rep.debugdx= "<<rep.debugdx<<endl;
cout<<"rep.debugff= "<<rep.debugff<<endl;
cout<<"rep.debugfs= "<<rep.debugfs<<endl;

// rep.iterationscount= 3
// rep.nfev= 5
// rep.debugdx= nan
// rep.debugff= nan
// rep.debugfs= nan
return 0;
}

Top

 Post subject: Re: How to get the objective function value minbleic in 3.8.Posted: Tue Nov 05, 2013 8:06 pm

Joined: Fri May 07, 2010 7:06 am
Posts: 922
The reason is that you use debug fields, which are not documented and not intended for external use. They may change in future versions without notice, no backward compatibility guarantee is provided.

Top

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

 All times are UTC

#### Who is online

Users browsing this forum: No registered users and 1 guest

 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