Wikunia / ConstraintSolver.jl

ConstraintSolver in Julia: Blog posts ->
https://opensourc.es/blog/constraint-solver-1
MIT License
136 stars 14 forks source link

Performance memory addbacktrackobj2backtrack #260

Closed Wikunia closed 3 years ago

Wikunia commented 3 years ago

Try to use a better data structure to save the changes of each variable. It now saves the changes made per step and not backtrack_idx which can reduce the size dramatically and it does never save empty tuples instead a new struct VariableChanges saves indices to the changes in the following way:

indices = [1,1,3,5]
changes = [t1, t2, t3, t4]

would mean that step_nr did no change for this variable, step 2 and 3 made two changes each.

codecov[bot] commented 3 years ago

Codecov Report

Merging #260 (62687af) into master (77c0adf) will increase coverage by 0.69%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #260      +/-   ##
==========================================
+ Coverage   96.56%   97.26%   +0.69%     
==========================================
  Files          49       49              
  Lines        3843     4161     +318     
==========================================
+ Hits         3711     4047     +336     
+ Misses        132      114      -18     
Impacted Files Coverage Δ
src/ConstraintSolver.jl 98.57% <ø> (-0.53%) :arrow_down:
src/MOI_wrapper/variables.jl 99.48% <ø> (+0.01%) :arrow_up:
src/constraints/table.jl 97.84% <ø> (+0.13%) :arrow_up:
src/type_inits.jl 96.07% <ø> (+0.84%) :arrow_up:
src/Variable.jl 100.00% <100.00%> (ø)
src/branching.jl 99.51% <100.00%> (+0.03%) :arrow_up:
src/constraints/equal_set.jl 95.87% <100.00%> (+0.32%) :arrow_up:
src/logs.jl 95.68% <100.00%> (+0.36%) :arrow_up:
src/pruning.jl 100.00% <100.00%> (ø)
src/traversing.jl 96.93% <100.00%> (+0.38%) :arrow_up:
... and 50 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 77c0adf...62687af. Read the comment docs.

Wikunia commented 3 years ago

Benchmark Report for ConstraintSolver

Job Properties

Results

A ratio greater than 1.0 denotes a possible regression (marked with :x:), while a ratio less than 1.0 denotes a possible improvement (marked with :white_check_mark:). Only significant results - results that indicate possible regressions or improvements - are shown below (thus, an empty table means that all benchmark results remained invariant between builds).

ID time ratio memory ratio
["eternity", "5x5_all"] 0.83 (5%) :white_check_mark: 0.83 (1%) :white_check_mark:
["eternity", "5x5_opt"] 0.96 (5%) 0.97 (1%) :white_check_mark:
["eternity", "5x5_opt_ind"] 0.95 (5%) :white_check_mark: 0.97 (1%) :white_check_mark:
["eternity", "5x5_opt_rei"] 0.97 (5%) 0.97 (1%) :white_check_mark:
["eternity", "6x5"] 0.79 (5%) :white_check_mark: 0.84 (1%) :white_check_mark:
["eternity", "6x5_ABS"] 0.87 (5%) :white_check_mark: 0.85 (1%) :white_check_mark:
["graph_coloring", "US_50colors"] 0.95 (5%) :white_check_mark: 0.89 (1%) :white_check_mark:
["graph_coloring", "US_50colors+equal"] 0.96 (5%) 0.91 (1%) :white_check_mark:
["graph_coloring", "US_50colors+equal_ABS"] 0.91 (5%) :white_check_mark: 0.89 (1%) :white_check_mark:
["graph_coloring", "US_8+equal"] 0.96 (5%) 0.91 (1%) :white_check_mark:
["graph_coloring", "US_8+equal_ABS"] 0.91 (5%) :white_check_mark: 0.85 (1%) :white_check_mark:
["killer_sudoku", "niall_5500"] 0.91 (5%) :white_check_mark: 0.91 (1%) :white_check_mark:
["killer_sudoku", "niall_5500_ABS"] 0.86 (5%) :white_check_mark: 0.89 (1%) :white_check_mark:
["killer_sudoku", "niall_5500_special"] 0.87 (5%) :white_check_mark: 0.84 (1%) :white_check_mark:
["killer_sudoku", "niall_5501"] 0.90 (5%) :white_check_mark: 0.90 (1%) :white_check_mark:
["killer_sudoku", "niall_5501_ABS"] 1.00 (5%) 1.11 (1%) :x:
["killer_sudoku", "niall_5501_special"] 0.78 (5%) :white_check_mark: 0.82 (1%) :white_check_mark:
["lp", "issue_83"] 0.99 (5%) 0.92 (1%) :white_check_mark:
["scheduling", "all_different_except_0_len10"] 0.86 (5%) :white_check_mark: 0.90 (1%) :white_check_mark:
["scheduling", "all_different_except_0_len12"] 0.84 (5%) :white_check_mark: 0.90 (1%) :white_check_mark:
["scheduling", "furniture_moving"] 0.93 (5%) :white_check_mark: 0.90 (1%) :white_check_mark:
["scheduling", "organize_day"] 0.98 (5%) 0.94 (1%) :white_check_mark:
["steiner", "steiner_7"] 0.98 (5%) 0.94 (1%) :white_check_mark:
["sudoku", "25x25_89"] 0.73 (5%) :white_check_mark: 0.88 (1%) :white_check_mark:
["sudoku", "25x25_90"] 0.74 (5%) :white_check_mark: 0.86 (1%) :white_check_mark:
["sudoku", "top95_1"] 0.95 (5%) :white_check_mark: 0.99 (1%) :white_check_mark:
["sudoku", "top95_11"] 0.92 (5%) :white_check_mark: 0.94 (1%) :white_check_mark:
["sudoku", "top95_16"] 0.92 (5%) :white_check_mark: 0.94 (1%) :white_check_mark:
["sudoku", "top95_21"] 0.94 (5%) :white_check_mark: 0.99 (1%) :white_check_mark:
["sudoku", "top95_26"] 0.94 (5%) :white_check_mark: 0.99 (1%) :white_check_mark:
["sudoku", "top95_31"] 0.92 (5%) :white_check_mark: 0.94 (1%) :white_check_mark:
["sudoku", "top95_36"] 0.95 (5%) :white_check_mark: 0.99 (1%) :white_check_mark:
["sudoku", "top95_41"] 0.93 (5%) :white_check_mark: 0.99 (1%)
["sudoku", "top95_46"] 0.93 (5%) :white_check_mark: 0.93 (1%) :white_check_mark:
["sudoku", "top95_51"] 0.92 (5%) :white_check_mark: 0.95 (1%) :white_check_mark:
["sudoku", "top95_56"] 0.91 (5%) :white_check_mark: 0.94 (1%) :white_check_mark:
["sudoku", "top95_6"] 0.95 (5%) :white_check_mark: 0.99 (1%) :white_check_mark:
["sudoku", "top95_61"] 0.93 (5%) :white_check_mark: 0.97 (1%) :white_check_mark:
["sudoku", "top95_66"] 0.91 (5%) :white_check_mark: 0.89 (1%) :white_check_mark:
["sudoku", "top95_71"] 0.94 (5%) :white_check_mark: 0.97 (1%) :white_check_mark:
["sudoku", "top95_76"] 0.93 (5%) :white_check_mark: 0.96 (1%) :white_check_mark:
["sudoku", "top95_81"] 0.93 (5%) :white_check_mark: 0.94 (1%) :white_check_mark:
["sudoku", "top95_86"] 0.93 (5%) :white_check_mark: 0.97 (1%) :white_check_mark:
["sudoku", "top95_91"] 0.93 (5%) :white_check_mark: 0.97 (1%) :white_check_mark:

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

Julia versioninfo

Target

Julia Version 1.5.0
Commit 96786e22cc (2020-08-01 23:44 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      "Arch Linux"
  uname: Linux 5.9.14-arch1-1 #1 SMP PREEMPT Sat, 12 Dec 2020 14:37:12 +0000 x86_64 unknown
  CPU: Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz: 
                 speed         user         nice          sys         idle          irq
       #1-12  3578 MHz   10230254 s     969973 s    5385134 s  7758202467 s     878006 s

  Memory: 46.9886360168457 GB (1098.125 MB free)
  Uptime: 6.481982e6 sec
  Load Avg:  1.2177734375  1.1845703125  0.86474609375
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, sandybridge)

Baseline

Julia Version 1.5.0
Commit 96786e22cc (2020-08-01 23:44 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      "Arch Linux"
  uname: Linux 5.9.14-arch1-1 #1 SMP PREEMPT Sat, 12 Dec 2020 14:37:12 +0000 x86_64 unknown
  CPU: Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz: 
                 speed         user         nice          sys         idle          irq
       #1-12  1626 MHz   10230915 s    1055523 s    5388163 s  7759165586 s     878221 s

  Memory: 46.9886360168457 GB (721.14453125 MB free)
  Uptime: 6.48286e6 sec
  Load Avg:  1.03857421875  1.0751953125  1.0
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, sandybridge)