Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jagot/solvertraces.jl
https://github.com/jagot/solvertraces.jl
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jagot/solvertraces.jl
- Owner: jagot
- License: other
- Created: 2018-11-29T10:27:34.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-07-09T08:05:33.000Z (7 months ago)
- Last Synced: 2024-11-15T18:34:52.524Z (2 months ago)
- Language: Julia
- Size: 604 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.org
- License: LICENSE.md
Awesome Lists containing this project
README
#+TITLE: SolverTraces.jl
#+AUTHOR: Stefanos Carlström
#+EMAIL: [email protected][[https://jagot.github.io/SolverTraces.jl/stable][https://img.shields.io/badge/docs-stable-blue.svg]]
[[https://jagot.github.io/SolverTraces.jl/dev][https://img.shields.io/badge/docs-dev-blue.svg]]
[[https://github.com/jagot/SolverTraces.jl/actions][https://github.com/jagot/SolverTraces.jl/workflows/CI/badge.svg]]
[[https://codecov.io/gh/jagot/SolverTraces.jl][https://codecov.io/gh/jagot/SolverTraces.jl/branch/master/graph/badge.svg]]Small utility library for printing solver traces. Based around
[[https://github.com/JuliaString/Format.jl][Format.jl]] and [[https://github.com/KristofferC/Crayons.jl][Crayons.jl]].* Usage example
#+BEGIN_SRC julia
using SolverTraces
using Format
using Crayons# Custom column type, needs to inherit TraceColumn and have a fmt
# field.
struct Random{R<:Real} <: TraceColumn
fmt::FormatExpr
lc::LinearColorant{R}
header::String
endRandom(::Type{R}=Float64) where R =
Random{R}(FormatExpr("{1:s}{2:9.3e}$(crayon"reset")"),
LinearColorant(1.0, 0.0, SolverTraces.red_green_scale()),
" Random")# Also needs to be callable with current step as argument.
function (c::Random)(i::Integer)
n = rand()
c.lc(n), n
endnum_steps = 1000
load = 10
trace = SolverTrace(num_steps,
CurrentStep(num_steps),
Performance(load), # How much load per second can be handled
Random())print_header(trace)
for i = 1:num_steps
sleep(0.0001rand())
SolverTraces.next!(trace)
end
#+END_SRCOutput on Linux with 24 bit colours available:
[[file:figures/linux.png]]Output on Windows with 16 colours available:
[[file:figures/windows.png]]* Future ideas
- Nested solver traces for algorithms where each step necessitates
inner solves. It would be interesting to support such cases and
have togglable visibility of nested traces.
- Output to other backends than the terminal,
e.g. HTML: asynchronous display of solver trace in the web browser
of a computation running remotely.