mirror of
https://github.com/mudler/luet.git
synced 2025-09-10 11:39:35 +00:00
update vendor/
This commit is contained in:
14
vendor/github.com/crillab/gophersat/solver/solver.go
generated
vendored
14
vendor/github.com/crillab/gophersat/solver/solver.go
generated
vendored
@@ -87,10 +87,16 @@ func New(problem *Problem) *Solver {
|
||||
return &Solver{status: Unsat}
|
||||
}
|
||||
nbVars := problem.NbVars
|
||||
|
||||
trailCap := nbVars
|
||||
if len(problem.Units) > trailCap {
|
||||
trailCap = len(problem.Units)
|
||||
}
|
||||
|
||||
s := &Solver{
|
||||
nbVars: nbVars,
|
||||
status: problem.Status,
|
||||
trail: make([]Lit, len(problem.Units), nbVars),
|
||||
trail: make([]Lit, len(problem.Units), trailCap),
|
||||
model: problem.Model,
|
||||
activity: make([]float64, nbVars),
|
||||
polarity: make([]bool, nbVars),
|
||||
@@ -343,7 +349,7 @@ func (s *Solver) propagateAndSearch(lit Lit, lvl decLevel) Status {
|
||||
return Indet
|
||||
}
|
||||
if s.Stats.NbConflicts >= s.wl.idxReduce*s.wl.nbMax {
|
||||
s.wl.idxReduce = (s.Stats.NbConflicts / s.wl.nbMax) + 1
|
||||
s.wl.idxReduce = s.Stats.NbConflicts/s.wl.nbMax + 1
|
||||
s.reduceLearned()
|
||||
s.bumpNbMax()
|
||||
}
|
||||
@@ -738,7 +744,7 @@ func (s *Solver) Optimal(results chan Result, stop chan struct{}) (res Result) {
|
||||
copy(s.lastModel, s.model) // Save this model: it might be the last one
|
||||
cost = 0
|
||||
for i, lit := range s.minLits {
|
||||
if (s.model[lit.Var()] > 0) == lit.IsPositive() {
|
||||
if s.model[lit.Var()] > 0 == lit.IsPositive() {
|
||||
if s.minWeights == nil {
|
||||
cost++
|
||||
} else {
|
||||
@@ -803,7 +809,7 @@ func (s *Solver) Minimize() int {
|
||||
copy(s.lastModel, s.model) // Save this model: it might be the last one
|
||||
cost = 0
|
||||
for i, lit := range s.minLits {
|
||||
if (s.model[lit.Var()] > 0) == lit.IsPositive() {
|
||||
if s.model[lit.Var()] > 0 == lit.IsPositive() {
|
||||
if s.minWeights == nil {
|
||||
cost++
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user