update vendor/

This commit is contained in:
Ettore Di Giacinto
2020-02-11 15:00:14 +01:00
parent c9090ef1fd
commit 33da68c2ff
11 changed files with 327 additions and 21 deletions

View File

@@ -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 {