I'm not aware of any way to tell nlopt to automatically print
information to the screen, but you can do it yourself inside of the
function you pass to nlopt. For example:

```
double nlopt_nll(unsigned int n, const double *x, double *grad, void *params)
{
    double fval;
    struct timeval tv_start, tv_stop;

    gettimeofday(&tv_start, NULL);
    fval = nll(x, ...);
    gettimeofday(&tv_stop, NULL);

    long long elapsed = (tv_stop.tv_sec - tv_start.tv_sec)*1000 +
(tv_stop.tv_usec - tv_start.tv_usec)/1000;

    printf("%5zu %10.2f %7.2f %7.2f %7.2f %5.2f %5.2f %6.2f %5.2f
%5.2f f() = %7.3e took %lld ms\n",
               iter++,
               x[0],
               x[1],
               x[2],
               x[3],
               x[4],
               x[5],
               x[6],
               x[7],
               x[8],
               fval,
               elapsed);

    return fval;
}
```

Tony


On Sun, Mar 10, 2019 at 11:42 PM Manav Bhatia <bhatiama...@gmail.com> wrote:
>
> Hi,
>
>    I have linked my C code to NLopt and am able to successfully call 
> nlopt_optimize(). However, I don’t get any information printed to screen 
> about the optimization iterations, etc.
>
>    Is there a flag I can set to get this information?
>
>    Also, is there a method that allows me to link a monitor to the optimizer 
> such that I can perform specific tasks at the conclusion of each iteration? I 
> would like to output the data on variable and constraint values.
>
> Thanks,
> Manav
> _______________________________________________
> NLopt-discuss mailing list
> NLopt-discuss@ab-initio.mit.edu
> http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss

_______________________________________________
NLopt-discuss mailing list
NLopt-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss

Reply via email to