Skip to content

Commit

Permalink
[DO NOT MERGED] try a different weight computation
Browse files Browse the repository at this point in the history
  • Loading branch information
sorawee committed Aug 30, 2023
1 parent 37605c0 commit 7ed60a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions picus/algorithms/dpvl.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
(define :range-vec null)

(define :linear-clauses #f)
(define :weight-map #f)

; main solving procedure
; returns:
Expand Down Expand Up @@ -164,7 +163,7 @@
(values 'normal ks us null)]
; else, set not empty, move forward
[else
(define sid (apply-selector uspool :weight-map))
(define sid (apply-selector uspool (l0:compute-weight-map :linear-clauses)))
(define-values (solved? info) (dpvl-solve ks us sid))
; send feedback to selector
(selector-feedback sid solved?)
Expand Down Expand Up @@ -418,7 +417,6 @@
; generate linear-clauses requires no optimization to exclude ror and rand
; linear-clauses requires normalized constraints to get best results
(set! :linear-clauses (l0:compute-linear-clauses :sdmcnsts #t))
(set! :weight-map (l0:compute-weight-map :linear-clauses))

; ==== first apply optimization phase 0 ====
(set! :p0cnsts (:optimize-r1cs-p0 :cnsts))
Expand Down
6 changes: 3 additions & 3 deletions picus/algorithms/lemmas/linear-lemma.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
(define res (make-hash))
(for ([clause (in-list linear-clauses)])
(match-define (cons deducible-vars nonlinear-vars) clause)
;; NOTE(sorawee): I think this is not optimal. We should revisit this.
(define len-deducible (set-count deducible-vars))
(define len-nonlinear (set-count nonlinear-vars))
(for ([var (in-set deducible-vars)])
(hash-update! res var (λ (old) (+ old len-deducible -1)) 0))
(hash-update! res var (λ (old) (max old (exact->inexact (/ 1 (+ len-deducible len-nonlinear))))) 0))
(for ([var (in-set nonlinear-vars)])
(hash-update! res var (λ (old) (+ old len-deducible)) 0)))
(hash-update! res var (λ (old) (max old (exact->inexact (/ 1 (+ len-deducible len-nonlinear))))) 0)))
res)

; recursively apply linear lemma
Expand Down

0 comments on commit 7ed60a5

Please sign in to comment.