Skip to content

ProgressMeter #442

@cortner

Description

@cortner

Reviving #84

printing the iteration history is useful when you are developing and experimenting, but as user you probably don't want to see it and still get some progress information?

Here are two variants I cooked up, which I both like, and both can probably be fine-tuned quite nicely.

using ProgressMeter
prog = ProgressThresh(1e-8, "Minimizing:")
df(x) = 4*x^3 - 2*x + 0.8
x = 1.0
h = 0.1
while df(x) > 1e-8
  x -= h * df(x)
  ProgressMeter.update!(prog, abs(df(x)))
  sleep(0.3)
end
using ProgressMeter
TOL = 1e-8
GRAN = 100
prog = Progress(floor(Int, GRAN * abs(log(TOL))), desc = "Minimizing:")
df(x) = 4*x^3 - 2*x + 0.8
x = 1.0
h = 0.1
while df(x) > TOL
  x -= h * df(x)
  ProgressMeter.update!(prog, ceil(Int, GRAN * abs(log(abs(df(x))))))
  sleep(0.3)
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions