main
Matthew Butterick 6 years ago
parent 9629c000eb
commit 7ddc5810db

@ -220,9 +220,9 @@
(define uvars-by-rv (sort uvars < #:key remaining-values))
(define minimum-remaining-values (remaining-values (first uvars-by-rv)))
(match (takef uvars-by-rv (λ (var) (= minimum-remaining-values (remaining-values var))))
[(list sole-winner) sole-winner]
[(list mrv-vars ...) ;; use degree as tiebreaker
(first (sort mrv-vars > #:key (λ (var) (var-degree csp var))))]))
[(list winning-uvar) winning-uvar]
[(list mrv-uvars ...) ;; use degree as tiebreaker
(argmax (λ (var) (var-degree csp var)) mrv-uvars)]))
(define/contract (order-domain-values vals)
((listof any/c) . -> . (listof any/c))

Loading…
Cancel
Save