I tried what you suggested and used the bounded CG method. It gets a lot
farther than the unconstrained CG method and finds a lower residual, but it
still experiences a line search failure after a while. Any thoughts? I'm
attaching the log output.

In case it's helpful, I also spent a few more hours working on the code and
now can compute the Hessian times an arbitrary vector (matrix-free using a
MATSHELL); even matrix-free, however, the Hessian is much slower to compute
than the gradient and objective. To answer a previous question, I am as
sure as I can be that the gradient is correct, since I'm using automatic
differentiation and not relying on a hand-coded function.

Thanks for your help,
Ellen

On Thu, Feb 27, 2020 at 11:40 AM Adam Denchfield <[email protected]>
wrote:

> Hi Ellen,
>
> It is as Alp said. To emphasize what he said, you don't need to worry
> about using a bounded CG method - the bounded CG methods can be used for
> unconstrained problems, and are much better than the old unconstrained CG
> code.
>
>
> On Thu, Feb 27, 2020, 9:55 AM Dener, Alp via petsc-users <
> [email protected]> wrote:
>
>> Hi Ellen,
>>
>> It looks like you’re using the old unconstrained CG code. This will be
>> deprecated in the near future in favor of the newer bound-constrained CG
>> algorithm (TAOBNCG) that can also solve unconstrained problems when the
>> user does not specify any bounds on the problem.
>>
>> The newer TAOBNCG algorithm implements a preconditioner that
>> significantly improves the scaling of the search direction and helps the
>> line search accept the unit step length most of the time. I would recommend
>> making sure that you’re on PETSc version 3.11 or newer, and then switching
>> to this with “-tao_type bncg”. You will not need to change any of your code
>> to do this. If you still fail to converge, please send a new log with the
>> new algorithm and we can evaluate the next steps.
>>
>> —
>> Alp Dener
>> Postdoctoral Researcher
>> Argonne National Laboratory
>> https://www.anl.gov/profile/alp-dener
>>
>> On February 26, 2020 at 6:01:34 PM, Ellen Price (
>> [email protected]) wrote:
>>
>> Hi Jed,
>>
>> Thanks for getting back to me! Here's the output for my CG config. Sorry
>> it's kind of a lot.
>>
>> Ellen
>>
>> On Wed, Feb 26, 2020 at 12:43 PM Jed Brown <[email protected]> wrote:
>>
>>> Could you share output for your current configuration with -tao_monitor
>>> -tao_ls_monitor -tao_view?
>>>
>>> "Ellen M. Price" <[email protected]> writes:
>>>
>>> > Hello PETSc users!
>>> >
>>> > I am using Tao for an unconstrained minimization problem. I have found
>>> > that CG works better than the other types for this application. After
>>> > about 85 iterations, I get an error about line search failure. I'm not
>>> > clear on what this means, or how I could mitigate the problem, and
>>> > neither the manual nor FAQ give any guidance. Can anyone suggest things
>>> > I could try to help the method converge? I have function and gradient
>>> > info, but no Hessian.
>>> >
>>> > Thanks,
>>> > Ellen Price
>>>
>>

Attachment: tao_bncg.out
Description: Binary data

Reply via email to