You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
typesetting/csp/csp/aima.rkt

571 lines
23 KiB
Racket

6 years ago
#lang debug racket
6 years ago
(require racket/generator sugar graph)
6 years ago
(provide (all-defined-out))
6 years ago
6 years ago
(struct $csp (variables domains neighbors constraints initial curr_domains nassigns nchecks current graph) #:transparent #:mutable)
6 years ago
;; `current` = current assignment
6 years ago
(define assignment? hash?)
(define variable? symbol?)
(define removal? (cons/c variable? any/c))
6 years ago
6 years ago
(define (update-assignment assignment var val)
(define h (hash-copy assignment))
(hash-set! h var val)
h)
6 years ago
(struct $constraint (names proc) #:transparent)
6 years ago
(struct $vd (name vals) #:transparent)
6 years ago
6 years ago
(define (constraint-graph variables constraints)
(for*/fold ([g (unweighted-graph/undirected variables)])
([constraint (in-list constraints)]
[edge (in-combinations ($constraint-names constraint) 2)])
(apply add-edge! g edge)
g))
6 years ago
(define/contract (make-csp vds [constraints null])
(((listof $vd?)) ((listof $constraint?)) . ->* . $csp?)
6 years ago
(define variables (map $vd-name vds))
6 years ago
(define domains (for/hasheq ([vd (in-list vds)])
(match vd
[($vd name vals) (values name vals)])))
6 years ago
(define g (constraint-graph variables constraints))
(define neighbors (for/hasheq ([v (in-list variables)])
(values v (get-neighbors g v))))
($csp variables domains neighbors constraints null #f 0 0 #f g))
6 years ago
6 years ago
(define/contract (domain csp var)
($csp? variable? . -> . (listof any/c))
(hash-ref ($csp-domains csp) var))
6 years ago
(define/contract (curr_domain csp var)
($csp? variable? . -> . (listof any/c))
(hash-ref ($csp-curr_domains csp) var))
(define/contract (neighbors csp var)
($csp? variable? . -> . (listof variable?))
(hash-ref ($csp-neighbors csp) var))
(define/contract (assigns? assignment var)
(assignment? variable? . -> . boolean?)
(hash-has-key? assignment var))
6 years ago
(define/contract (assignment-ref assignment name-or-names)
(assignment? (or/c (listof variable?) variable?) . -> . (or/c any/c (listof any/c)))
(let loop ([name-or-names name-or-names])
6 years ago
(match name-or-names
[(? variable? name) (hash-ref assignment name)]
[(list names ...) (map loop names)])))
6 years ago
6 years ago
(define nassigns $csp-nassigns)
(define nchecks $csp-nchecks)
6 years ago
(define/contract (reset! csp)
($csp? . -> . void?)
(set-$csp-curr_domains! csp #f)
(reset-counters! csp))
(define/contract (check-constraints csp varval-hash [limits null] #:conflicts [count-conflicts? #f])
(($csp? hash?) ((listof variable?) #:conflicts boolean?) . ->* . any/c)
6 years ago
(define relevant-constraints
(for/list ([constraint (in-list ($csp-constraints csp))]
6 years ago
#:when (let ([cnames ($constraint-names constraint)])
(and
6 years ago
(for/and ([limit (in-list limits)])
(memq limit cnames))
6 years ago
(for/and ([cname (in-list cnames)])
(memq cname (hash-keys varval-hash))))))
6 years ago
constraint))
6 years ago
(begin
;; ordinary: behave like for/and, stop if #false result.
;; count-conflicts mode: behave like for/sum, don't stop till end.
(define-values (result check-count)
(for/fold ([result (if count-conflicts? 0 #true)]
[check-count 0])
([constraint (in-list relevant-constraints)]
#:break (false? result)) ; only breaks early in ordinary mode, when #f is result value
(define vals (assignment-ref varval-hash ($constraint-names constraint)))
(define res (apply ($constraint-proc constraint) vals))
(values (if count-conflicts? (+ (if res 0 1) result) res) (add1 check-count))))
(set-$csp-nchecks! csp (+ check-count ($csp-nchecks csp)))
result))
6 years ago
(define/contract (reset-counters! csp)
6 years ago
($csp? . -> . void?)
6 years ago
(set-$csp-nassigns! csp 0)
(set-$csp-nchecks! csp 0))
6 years ago
6 years ago
(define/contract (assign csp var val assignment)
6 years ago
($csp? variable? any/c assignment? . -> . void?)
6 years ago
;; Add {var: val} to assignment; Discard the old value if any.
(hash-set! assignment var val)
(set-$csp-nassigns! csp (add1 ($csp-nassigns csp))))
(define/contract (unassign csp var assignment)
6 years ago
($csp? variable? assignment? . -> . void?)
6 years ago
;; Remove {var: val} from assignment.
;; DO NOT call this if you are changing a variable to a new value;
;; just call assign for that.
(hash-remove! assignment var))
6 years ago
(define/contract (all-variables-assigned? csp assignment)
($csp? assignment? . -> . boolean?)
(= (length (hash-keys assignment)) (length ($csp-variables csp))))
6 years ago
(define asses (make-parameter #f))
6 years ago
(define ncon (make-parameter #f))
6 years ago
(define/contract (nconflicts csp var val assignment)
6 years ago
($csp? variable? any/c assignment? . -> . number?)
6 years ago
;; Return the number of conflicts var=val has with other variables."""
;; Subclasses may implement this more efficiently
6 years ago
(define ass (update-assignment assignment var val))
6 years ago
(check-constraints csp ass (list var) #:conflicts #t))
6 years ago
6 years ago
6 years ago
(define (display csp assignment)
6 years ago
(displayln csp))
6 years ago
;; These methods are for the tree and graph-search interface:
(struct $action (var val) #:transparent #:mutable)
(define/contract (state->assignment state)
((listof $action?) . -> . assignment?)
(for/hasheq ([action (in-list state)])
(match action
[($action var val) (values var val)])))
;; todo: test that this works
(define/contract (actions csp state)
($csp? (listof $action?) . -> . any/c)
;; Return a list of applicable actions: nonconflicting
;; assignments to an unassigned variable.
(cond
[(all-variables-assigned? csp state) empty]
[else
(define assignment (state->assignment state))
6 years ago
(define var (for/first ([var (in-list ($csp-variables csp))]
#:unless (assignment . assigns? . var))
var))
(for/list ([val (in-list (domain csp var))]
6 years ago
#:when (zero? (nconflicts csp var val assignment)))
($action var val))]))
;; todo: test that this works
(define/contract (result csp state action)
($csp? (listof $action?) $action? . -> . assignment?)
;; Perform an action and return the new state.
(match-define ($action var val) action)
(append state (list action)))
;; todo: test that this works
6 years ago
(define/contract (goal_test csp state)
6 years ago
($csp? (or/c assignment? (listof $action?)) . -> . boolean?)
6 years ago
;; The goal is to assign all variables, with all constraints satisfied.
6 years ago
(define assignment (if (assignment? state) state (state->assignment state)))
6 years ago
(and (all-variables-assigned? csp assignment)
(for/and ([variable ($csp-variables csp)])
(zero? (nconflicts csp variable (hash-ref assignment variable) assignment)))))
;; These are for constraint propagation
6 years ago
(define/contract (support_pruning csp)
($csp? . -> . void?)
;; Make sure we can prune values from domains. (We want to pay
;; for this only if we use it.)
6 years ago
(unless ($csp-curr_domains csp)
(define h (make-hasheq))
(for ([v ($csp-variables csp)])
(hash-set! h v (hash-ref ($csp-domains csp) v)))
(set-$csp-curr_domains! csp h)))
6 years ago
(define/contract (suppose csp var value)
6 years ago
($csp? variable? any/c . -> . (box/c (listof removal?)))
6 years ago
;; Start accumulating inferences from assuming var=value
(support_pruning csp)
6 years ago
(begin0
6 years ago
(box (for/list ([val (in-list (curr_domain csp var))]
#:when (not (equal? val value)))
(cons var val)))
6 years ago
(hash-set! ($csp-curr_domains csp) var (list value))))
6 years ago
(define/contract (prune csp var value removals)
6 years ago
($csp? variable? any/c (or/c #f (box/c (listof removal?))) . -> . (box/c (listof removal?)))
6 years ago
;; Rule out var=value
6 years ago
(hash-update! ($csp-curr_domains csp) var (λ (vals) (remove value vals)))
6 years ago
(when removals
(set-box! removals (append (unbox removals) (list (cons var value)))))
removals)
6 years ago
(define/contract (choices csp var)
6 years ago
($csp? variable? . -> . (listof any/c))
6 years ago
;; Return all values for var that aren't currently ruled out.
(hash-ref (or ($csp-curr_domains csp) ($csp-domains csp)) var))
(define/contract (infer_assignment csp)
6 years ago
($csp? . -> . assignment?)
6 years ago
;; Return the partial assignment implied by the current inferences.
(support_pruning csp)
6 years ago
(define assignment (make-hasheq))
(for ([v (in-list ($csp-variables csp))])
6 years ago
(match (curr_domain csp v)
6 years ago
[(list one-value) (hash-set! assignment v one-value)]
[else #f]))
assignment)
6 years ago
(define/contract (restore csp removals)
6 years ago
($csp? (box/c (listof removal?)) . -> . void?)
6 years ago
;; Undo a supposition and all inferences from it.
6 years ago
(for ([removal (in-list (unbox removals))])
6 years ago
(match removal
[(cons B b) (hash-update! ($csp-curr_domains csp) B
(λ (vals) (append vals (list b))))])))
6 years ago
6 years ago
;; This is for min_conflicts search
(define/contract (conflicted_vars csp current)
($csp? hash? . -> . (listof variable?))
;; Return a list of variables in current assignment that are in conflict
(for/list ([var (in-list ($csp-variables csp))]
#:when (positive? (nconflicts csp var (hash-ref current var) current)))
var))
6 years ago
;; ______________________________________________________________________________
;; Constraint Propagation with AC-3
6 years ago
6 years ago
(struct $arc (start end) #:transparent)
(define/contract (AC3 csp [queue #f][removals #f])
(($csp?) ((or/c #f (listof any/c)) (box/c (listof removal?))) . ->* . boolean?)
(support_pruning csp)
(with-handlers ([boolean? values])
(for/fold ([queue (or queue
(for*/list ([Xi (in-list ($csp-variables csp))]
[Xk (in-list (neighbors csp Xi))])
($arc Xi Xk)))]
#:result #true)
([i (in-naturals)]
#:break (empty? queue))
(match-define (cons ($arc Xi Xj) other-arcs) queue)
(cond
[(revise csp Xi Xj removals)
(when (empty? (curr_domain csp Xi))
(raise #false))
(append other-arcs
(for/list ([Xk (in-list (neighbors csp Xi))]
#:unless (eq? Xk Xj))
($arc Xk Xi)))]
[else other-arcs]))))
(define/contract (revise csp Xi Xj removals)
($csp? variable? variable? (box/c (listof removal?)) . -> . boolean?)
;; Return true if we remove a value.
(for/fold ([revised #false])
([x (in-list (curr_domain csp Xi))])
6 years ago
;; If Xi=x is consistent with Xj=y for any y, keep Xi=x, otherwise prune
6 years ago
(cond
6 years ago
[(not
(for/or ([y (in-list (curr_domain csp Xj))])
6 years ago
(check-constraints csp (hasheq Xi x Xj y) (list Xi))))
6 years ago
(prune csp Xi x removals)
#true]
[else revised])))
6 years ago
;; ______________________________________________________________________________
;; CSP Backtracking Search
;; Variable ordering
(define/contract (first_unassigned_variable assignment csp)
6 years ago
(assignment? $csp? . -> . (or/c #false variable?))
6 years ago
;; The default variable order.
6 years ago
(for/first ([var (in-list ($csp-variables csp))]
6 years ago
#:unless (assignment . assigns? . var))
6 years ago
var))
6 years ago
(define current-shuffle (make-parameter #t))
6 years ago
(define/contract (argmin_random_tie proc xs)
(procedure? (listof any/c) . -> . any/c)
(define ordered-xs (sort xs < #:key proc))
(first ((if (current-shuffle) shuffle values)
(takef ordered-xs (λ (x) (= (proc (car ordered-xs)) (proc x)))))))
6 years ago
(define/contract (mrv assignment csp)
(assignment? $csp? . -> . any/c)
;; Minimum-remaining-values heuristic.
;; with random tiebreaker.
(define (num_legal_values var)
(if ($csp-curr_domains csp)
6 years ago
(length (curr_domain csp var))
6 years ago
(for/sum ([val (in-list (domain csp var))]
6 years ago
#:when (zero? (nconflicts csp var val assignment)))
1)))
(struct $mrv-rec (var num) #:transparent)
6 years ago
(argmin_random_tie
(λ (var) (num_legal_values var))
(for/list ([var (in-list ($csp-variables csp))]
#:unless (assignment . assigns? . var))
var)))
6 years ago
6 years ago
;; Value ordering
(define/contract (unordered_domain_values var assignment csp)
6 years ago
(variable? assignment? $csp? . -> . (listof any/c))
6 years ago
;; The default value order.
(choices csp var))
6 years ago
(define/contract (lcv var assignment csp)
(variable? assignment? $csp? . -> . (listof any/c))
;; Least-constraining-values heuristic.
(sort (choices csp var) < #:key (λ (val) (nconflicts csp var val assignment))))
6 years ago
;; Inference
(define/contract (no_inference csp var value assignment removals)
6 years ago
($csp? variable? any/c assignment? (box/c (listof removal?)) . -> . boolean?)
6 years ago
#true)
(define/contract (forward_checking csp var value assignment removals)
6 years ago
($csp? variable? any/c assignment? (box/c (listof removal?)) . -> . boolean?)
6 years ago
;; Prune neighbor values inconsistent with var=value.
(support_pruning csp) ;; necessary to set up curr_domains
6 years ago
(define ass (update-assignment assignment var value))
6 years ago
(for/and ([B (in-list (neighbors csp var))]
#:unless (assignment . assigns? . B))
(for ([b (in-list (curr_domain csp B))]
6 years ago
#:unless (check-constraints csp (update-assignment ass B b) (list var B)))
(prune csp B b removals))
6 years ago
(not (empty? (curr_domain csp B)))))
6 years ago
6 years ago
(define/contract (mac csp var value assignment removals)
($csp? variable? any/c assignment? (box/c (listof removal?)) . -> . boolean?)
;; Maintain arc consistency.
6 years ago
(AC3 csp (for/list ([neighbor (in-list (neighbors csp var))])
($arc neighbor var)) removals))
6 years ago
(define current-select-variable (make-parameter #f))
(define current-order-values (make-parameter #f))
(define current-inference (make-parameter #f))
6 years ago
6 years ago
(define/contract (backtracking_search
csp
[select_unassigned_variable (or (current-select-variable) first_unassigned_variable)]
[order_domain_values (or (current-order-values) unordered_domain_values)]
[inference (or (current-inference) no_inference)])
6 years ago
(($csp?) (procedure? procedure? procedure?) . ->* . generator?)
(generator ()
(let backtrack ([assignment (make-hasheq)])
(cond
[(all-variables-assigned? csp assignment)
(unless (goal_test csp assignment) (error 'whut))
(yield (hash-copy assignment))]
[else
(define var (select_unassigned_variable assignment csp))
(for ([val (in-list (order_domain_values var assignment csp))]
#:when (zero? (nconflicts csp var val assignment)))
(assign csp var val assignment)
(define removals (suppose csp var val))
(when (inference csp var val assignment removals)
(backtrack assignment))
(restore csp removals))
6 years ago
(unassign csp var assignment)]))))
6 years ago
;; ______________________________________________________________________________
;; Min-conflicts hillclimbing search for CSPs
6 years ago
(require sugar/debug)
(define (min-conflicts csp [max_steps (expt 10 5)])
6 years ago
(($csp?) (integer?) . ->* . generator?)
6 years ago
;; Solve a CSP by stochastic hillclimbing on the number of conflicts.
;; Generate a complete assignment for all variables (probably with conflicts)
6 years ago
(generator ()
(define current (make-hasheq))
(set-$csp-current! csp current)
(for ([var (in-list ($csp-variables csp))])
(define val (min_conflicts_value csp var current))
(assign csp var val current))
;; Now repeatedly choose a random conflicted variable and change it
(for ([i (in-range max_steps)])
(define conflicted (conflicted_vars csp current))
(when (empty? conflicted)
6 years ago
(report i)
6 years ago
(yield current))
(define var (first ((if (current-shuffle) shuffle values) conflicted)))
(define val (min_conflicts_value csp var current))
(assign csp var val current))))
6 years ago
(define/contract (min_conflicts_value csp var current)
($csp? variable? hash? . -> . any/c)
;; Return the value that will give var the least number of conflicts.
;; If there is a tie, choose at random.
6 years ago
(argmin_random_tie (λ (val) (nconflicts csp var val current)) (domain csp var)))
6 years ago
6 years ago
(define current-reset (make-parameter #t))
6 years ago
(define current-solver (make-parameter #f))
6 years ago
6 years ago
(define/contract (solve* csp [solution-limit +inf.0])
(($csp?) (integer?) . ->* . (or/c #f (non-empty-listof any/c)))
6 years ago
(define solver (or (current-solver) backtracking_search))
6 years ago
(begin0
6 years ago
(match (for/list ([solution (in-producer (solver csp) (void))]
6 years ago
[idx (in-range solution-limit)])
6 years ago
solution)
6 years ago
[(list solutions ...) solutions]
6 years ago
[else #false])
6 years ago
(when (current-reset)
6 years ago
(set-$csp-curr_domains! csp #f))))
6 years ago
6 years ago
(define/contract (solve csp)
($csp? . -> . any/c)
(match (solve* csp 1)
6 years ago
[(list solution) solution]
6 years ago
[else #false]))
6 years ago
(require rackunit)
6 years ago
(define vs '(wa nsw t q nt v sa))
(define vds (for/list ([k vs])
($vd k '(red green blue))))
(define (neq? a b) (not (eq? a b)))
(define cs (list
($constraint '(wa nt) neq?)
($constraint '(wa sa) neq?)
($constraint '(nt sa) neq?)
($constraint '(nt q) neq?)
($constraint '(q sa) neq?)
($constraint '(q nsw) neq?)
($constraint '(nsw sa) neq?)
($constraint '(nsw v) neq?)
($constraint '(v sa) neq?)))
(define csp (make-csp vds cs))
6 years ago
(define (tests)
6 years ago
(set-$csp-curr_domains! csp #f)
6 years ago
(check-true ($csp? csp))
(define a (make-hasheq))
(assign csp 'key 42 a)
(check-equal? (hash-ref a 'key) 42)
(unassign csp 'key a)
(check-exn exn:fail? (λ () (hash-ref a 'key)))
(check-equal? 0 (nconflicts csp 'wa 'red (hasheq 'wa 42)))
(support_pruning csp)
(check-true (hash? ($csp-curr_domains csp)))
(check-equal? (suppose csp 'wa 'red) '#&((wa . green) (wa . blue)))
(check-equal? (curr_domain csp 'wa) '(red))
(check-equal? (prune csp 'v 'red (box empty)) '#&((v . red)))
(check-equal? (choices csp 'v) '(green blue))
(check-equal? (choices csp 'wa) '(red))
(check-equal? (infer_assignment csp)
(make-hasheq '((wa . red))))
(check-equal? (suppose csp 'v 'blue) '#&((v . green)))
(check-equal? (infer_assignment csp)
(make-hasheq '((v . blue) (wa . red))))
(restore csp '#&((wa . green)))
(check-equal? (infer_assignment csp)
(make-hasheq '((v . blue))))
(restore csp '#&((v . blue)))
(check-equal? (infer_assignment csp) (make-hasheq))
(check-equal? (first_unassigned_variable (hash) csp) 'wa)
(check-equal? (unordered_domain_values 'wa (hash) csp) '(red green))
(set-$csp-curr_domains! csp #f) ; reset current domains
(check-equal? (solve csp)
(make-hasheq '((nsw . green) (nt . green) (q . red) (sa . blue) (t . blue) (v . red) (wa . red))))
(check-equal? (begin0 (list ($csp-nassigns csp) ($csp-nchecks csp)) (reset-counters! csp)) '(40 321))
(check-equal? (length (solve* csp)) 18)
(check-equal? (suppose csp 'nsw 'red) '#&((nsw . green) (nsw . blue)))
(check-equal? (solve csp)
(make-hasheq '((nsw . red) (nt . red) (q . green) (sa . blue) (t . blue) (v . green) (wa . green))))
(check-equal? ($csp-nassigns csp) 368)
(reset-counters! csp)
(check-equal? (suppose csp 'nsw 'red) '#&((nsw . green) (nsw . blue)))
(check-equal? (length (solve* csp)) 6)
(check-equal? (begin0 (list ($csp-nassigns csp) ($csp-nchecks csp)) (reset-counters! csp)) '(111 1035))
(parameterize ([current-select-variable mrv]
[current-shuffle #f])
6 years ago
(check-equal?
(solve csp)
6 years ago
(make-hasheq '((nsw . green) (nt . green) (q . red) (sa . blue) (t . blue) (v . red) (wa . red))))
(check-equal? (begin0 (list ($csp-nassigns csp) ($csp-nchecks csp)) (reset-counters! csp)) '(39 321)))
(parameterize ([current-order-values lcv])
(check-equal?
(solve csp)
(make-hasheq '((nsw . green) (nt . green) (q . red) (sa . blue) (t . blue) (v . red) (wa . red))))
(check-equal? (begin0 (list ($csp-nassigns csp) ($csp-nchecks csp)) (reset-counters! csp)) '(39 1040)))
6 years ago
6 years ago
(parameterize ([current-inference forward_checking])
(forward_checking csp 'sa 'blue (make-hasheq) (box null))
(check-equal? ($csp-curr_domains csp)
(make-hasheq '((nsw . (red green)) (nt . (red green)) (q . (red green)) (sa . (red green blue)) (t . (red green blue)) (v . (red green)) (wa . (red green))))))
6 years ago
6 years ago
(reset-counters! csp)
(set-$csp-curr_domains! csp #f)
(parameterize ([current-inference forward_checking])
(check-equal?
(solve csp)
(make-hasheq '((nsw . green) (nt . green) (q . red) (sa . blue) (t . blue) (v . red) (wa . red))))
(check-equal? (begin0 (list ($csp-nassigns csp) ($csp-nchecks csp)) (reset-counters! csp)) '(25 106)))
(set-$csp-curr_domains! csp #f)
(parameterize ([current-inference mac]
[current-reset #f])
6 years ago
(check-equal? (solve csp)
(make-hasheq '((nsw . green) (nt . green) (q . red) (sa . blue) (t . blue) (v . red) (wa . red))))
6 years ago
(check-equal? (begin0 (list ($csp-nassigns csp) ($csp-nchecks csp)) (reset-counters! csp)) '(17 175)))
6 years ago
6 years ago
(parameterize ([current-select-variable mrv]
[current-order-values lcv]
[current-inference mac]
[current-reset #f])
6 years ago
(check-equal? (solve csp)
6 years ago
(make-hasheq '((nsw . green) (nt . green) (q . red) (sa . blue) (t . blue) (v . red) (wa . red))))
(check-equal? (begin0 (list ($csp-nassigns csp) ($csp-nchecks csp)) (reset-counters! csp)) '(7 45)))
(set-$csp-curr_domains! csp #f)
(parameterize ([current-shuffle #f]
6 years ago
[current-solver min-conflicts])
6 years ago
(check-equal?
(solve csp)
(make-hasheq '((nsw . red) (nt . red) (q . green) (sa . blue) (t . red) (v . green) (wa . green))))
(check-equal? (begin0 (list ($csp-nassigns csp) ($csp-nchecks csp)) (reset-counters! csp)) '(9 220)))
(define tri (make-csp (list ($vd 'a '(1 2 3))
($vd 'b '(4 5 6))
($vd 'c '(7 8 9)))
(list ($constraint '(a b c) (λ (a b c) (= (+ a b c) 18))))))
(parameterize ([current-select-variable mrv]
[current-order-values lcv]
[current-inference mac]
[current-reset #f]
[current-shuffle #f])
(check-equal? (solve tri) (make-hasheq '((a . 3) (b . 6) (c . 9)))))
(check-equal? (begin0 (list ($csp-nassigns tri) ($csp-nchecks tri)) (reset-counters! tri)) '(13 68))
)
(module+ test
(tests))
#|
(define (abc-test a b c) (/ (+ (* 100 a) (* 10 b) c) (+ a b c)))
(define abc (make-csp (list ($vd 'a (shuffle (range 1 10)))
($vd 'b (range 1 10))
($vd 'c (range 1 10)))))
(argmin (λ (h)
(abc-test (hash-ref h 'a) (hash-ref h 'b) (hash-ref h 'c)))
(parameterize ([current-select-variable mrv]
[current-order-values lcv]
[current-inference mac]
[current-reset #f]
[current-shuffle #f])
(solve* abc)))
|#