ConstraintSolver.jl icon indicating copy to clipboard operation
ConstraintSolver.jl copied to clipboard

Feature change observer pattern

Open Wikunia opened this issue 4 years ago • 6 comments

Closes #269

Function notify_constraints_var_changed! calls changed_var! for the constraints that are affected. Currently only the linear constraint implements the function to compute new mins and maxs values.

Wikunia avatar Aug 01 '21 14:08 Wikunia

Codecov Report

Merging #271 (a1057f1) into master (68fd0b1) will decrease coverage by 0.01%. The diff coverage is 97.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #271      +/-   ##
==========================================
- Coverage   97.62%   97.61%   -0.02%     
==========================================
  Files          52       52              
  Lines        4344     4450     +106     
==========================================
+ Hits         4241     4344     +103     
- Misses        103      106       +3     
Impacted Files Coverage Δ
src/pruning.jl 100.00% <ø> (ø)
src/types.jl 99.00% <ø> (ø)
src/constraints/activator_constraints.jl 89.36% <55.55%> (-10.64%) :arrow_down:
src/ConstraintSolver.jl 98.35% <94.11%> (-0.24%) :arrow_down:
src/Variable.jl 100.00% <100.00%> (ø)
src/constraints.jl 100.00% <100.00%> (ø)
src/constraints/all_different.jl 100.00% <100.00%> (ø)
src/constraints/all_equal.jl 94.94% <100.00%> (ø)
src/constraints/and.jl 100.00% <100.00%> (ø)
src/constraints/boolset.jl 100.00% <100.00%> (ø)
... and 19 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 68fd0b1...a1057f1. Read the comment docs.

codecov[bot] avatar Aug 01 '21 15:08 codecov[bot]

Benchmark Report for ConstraintSolver

Job Properties

  • Time of benchmarks:
    • Target: 11 Sep 2021 - 13:29
    • Baseline: 11 Sep 2021 - 13:43
  • Package commits:
    • Target: 82b89f
    • Baseline: 2d857b
  • Julia commits:
    • Target: 6aaede
    • Baseline: 6aaede
  • Julia command flags:
    • Target: -O3
    • Baseline: -O3
  • Environment variables:
    • Target: None
    • Baseline: None

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"] 1.12 (5%) :x: 1.06 (1%) :x:
["eternity", "5x5_opt"] 1.09 (5%) :x: 1.03 (1%) :x:
["eternity", "5x5_opt_ind"] 1.12 (5%) :x: 1.04 (1%) :x:
["eternity", "5x5_opt_rei"] 1.08 (5%) :x: 1.04 (1%) :x:
["eternity", "6x5"] 1.06 (5%) :x: 1.06 (1%) :x:
["eternity", "6x5_ABS"] 1.05 (5%) :x: 1.06 (1%) :x:
["graph_coloring", "US_50colors"] 1.27 (5%) :x: 1.15 (1%) :x:
["graph_coloring", "US_50colors+equal"] 1.23 (5%) :x: 1.16 (1%) :x:
["graph_coloring", "US_50colors+equal_ABS"] 1.35 (5%) :x: 1.18 (1%) :x:
["graph_coloring", "US_8+equal"] 1.09 (5%) :x: 1.06 (1%) :x:
["graph_coloring", "US_8+equal_ABS"] 1.12 (5%) :x: 1.05 (1%) :x:
["graph_coloring", "le450_5d"] 1.31 (5%) :x: 1.36 (1%) :x:
["graph_coloring", "queen7_7"] 1.18 (5%) :x: 1.14 (1%) :x:
["killer_sudoku", "niall_5500"] 0.48 (5%) :white_check_mark: 0.54 (1%) :white_check_mark:
["killer_sudoku", "niall_5500_ABS"] 12.26 (5%) :x: 12.45 (1%) :x:
["killer_sudoku", "niall_5500_special"] 0.67 (5%) :white_check_mark: 0.72 (1%) :white_check_mark:
["killer_sudoku", "niall_5501"] 0.66 (5%) :white_check_mark: 0.69 (1%) :white_check_mark:
["killer_sudoku", "niall_5501_ABS"] 0.05 (5%) :white_check_mark: 0.06 (1%) :white_check_mark:
["killer_sudoku", "niall_5501_special"] 2.12 (5%) :x: 2.21 (1%) :x:
["lp", "issue_83"] 0.94 (5%) :white_check_mark: 1.01 (1%)
["scheduling", "all_different_except_0_len10"] 1.42 (5%) :x: 1.32 (1%) :x:
["scheduling", "all_different_except_0_len12"] 1.36 (5%) :x: 1.31 (1%) :x:
["scheduling", "furniture_moving"] 2.74 (5%) :x: 2.43 (1%) :x:
["scheduling", "organize_day"] 1.43 (5%) :x: 1.62 (1%) :x:
["steiner", "steiner_7"] 493.77 (5%) :x: 304.29 (1%) :x:
["sudoku", "25x25_89"] 1.01 (5%) 1.02 (1%) :x:
["sudoku", "25x25_90"] 1.00 (5%) 1.02 (1%) :x:
["sudoku", "top95_1"] 1.05 (5%) 1.06 (1%) :x:
["sudoku", "top95_11"] 0.99 (5%) 1.04 (1%) :x:
["sudoku", "top95_16"] 1.02 (5%) 1.04 (1%) :x:
["sudoku", "top95_21"] 1.01 (5%) 1.06 (1%) :x:
["sudoku", "top95_26"] 0.93 (5%) :white_check_mark: 1.06 (1%) :x:
["sudoku", "top95_31"] 1.01 (5%) 1.05 (1%) :x:
["sudoku", "top95_36"] 1.04 (5%) 1.06 (1%) :x:
["sudoku", "top95_41"] 1.04 (5%) 1.05 (1%) :x:
["sudoku", "top95_46"] 1.03 (5%) 1.05 (1%) :x:
["sudoku", "top95_51"] 0.95 (5%) 1.05 (1%) :x:
["sudoku", "top95_56"] 1.03 (5%) 1.04 (1%) :x:
["sudoku", "top95_6"] 1.02 (5%) 1.06 (1%) :x:
["sudoku", "top95_61"] 0.96 (5%) 1.05 (1%) :x:
["sudoku", "top95_66"] 0.98 (5%) 1.04 (1%) :x:
["sudoku", "top95_71"] 1.04 (5%) 1.05 (1%) :x:
["sudoku", "top95_76"] 0.98 (5%) 1.05 (1%) :x:
["sudoku", "top95_81"] 0.99 (5%) 1.05 (1%) :x:
["sudoku", "top95_86"] 1.01 (5%) 1.05 (1%) :x:
["sudoku", "top95_91"] 1.00 (5%) 1.05 (1%) :x:

Benchmark Group List

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

  • ["eternity"]
  • ["graph_coloring"]
  • ["killer_sudoku"]
  • ["lp"]
  • ["scheduling"]
  • ["steiner"]
  • ["sudoku"]

Julia versioninfo

Target

Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  uname: Linux 5.13.12-arch1-1 #1 SMP PREEMPT Wed, 18 Aug 2021 20:49:03 +0000 x86_64 unknown
  CPU: AMD Ryzen 7 PRO 4750U with Radeon Graphics: 
                 speed         user         nice          sys         idle          irq
       #1-16  1700 MHz    1775772 s       6259 s     840826 s    2557498 s          0 s
       
  Memory: 38.41743850708008 GB (1495.8359375 MB free)
  Uptime: 969387.0 sec
  Load Avg:  4.03  3.62  3.33
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, znver2)

Baseline

Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  uname: Linux 5.13.12-arch1-1 #1 SMP PREEMPT Wed, 18 Aug 2021 20:49:03 +0000 x86_64 unknown
  CPU: AMD Ryzen 7 PRO 4750U with Radeon Graphics: 
                 speed         user         nice          sys         idle          irq
       #1-16  2029 MHz    1787664 s       6259 s     845095 s    2675998 s          0 s
       
  Memory: 38.41743850708008 GB (1143.59375 MB free)
  Uptime: 970233.0 sec
  Load Avg:  1.71  2.41  2.88
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, znver2)

Wikunia avatar Aug 01 '21 16:08 Wikunia

Todo: Compare steiner to before. Probably the change to reverse the complement constraint made this slow. Those reverses should only happen if the constraint was called.

Wikunia avatar Aug 01 '21 17:08 Wikunia

Idea: For prune_constraint and still_feasible have a function in between which checks if it's the first node call (which is an attribute of Constraint) if that's the case then it calls a new function first_node_call which defaults to doing nothing. Then sets the attribute to false.

linear_constraints will be the only constraint so far to implement first_node_call which will recompute the extrema

Wikunia avatar Aug 21 '21 20:08 Wikunia

Okay we're back to steiner being very slow but hopefully the bug is fixed :smile:

Wikunia avatar Sep 11 '21 11:09 Wikunia

Run benchmark tests again to be sure and investigate steiner again...

Wikunia avatar Jan 08 '22 20:01 Wikunia