本文整理汇总了Golang中dpll/assignment.Assignment.Get方法的典型用法代码示例。如果您正苦于以下问题:Golang Assignment.Get方法的具体用法?Golang Assignment.Get怎么用?Golang Assignment.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dpll/assignment.Assignment
的用法示例。
在下文中一共展示了Assignment.Get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ordered
func ordered(db *db.DB, a *assignment.Assignment) (l *cnf.Lit) {
// find the first in-order unassigned literal
for i := uint(1); i <= a.Len(); i++ {
if p, _ := a.Get(i); p == guess.Unassigned {
return &cnf.Lit{i, cnf.Pos}
}
}
return &cnf.Lit{0, 0}
}
示例2: random
func random(db *db.DB, a *assignment.Assignment) (l *cnf.Lit) {
sign := byte((rand.Int() % 2) + 1)
val := uint((rand.Int() % int(a.Len())) + 1)
for i := val; i <= a.Len(); i++ {
if v, _ := a.Get(i); v == guess.Unassigned {
return &cnf.Lit{i, sign}
}
}
for i := uint(1); i < val; i++ {
if v, _ := a.Get(i); v == guess.Unassigned {
return &cnf.Lit{i, sign}
}
}
return &cnf.Lit{0, 0}
}
示例3: GetNextVmtf
func (lc *LitCounts) GetNextVmtf(a *assignment.Assignment) (l *cnf.Lit) {
var lit uint
for i := range lc.vmtf {
if lc.vmtf[i].lit < 0 {
lit = uint(-1 * lc.vmtf[i].lit)
} else {
lit = uint(lc.vmtf[i].lit)
}
if val, err := a.Get(lit); val == guess.Unassigned && err == nil {
if lc.vmtf[i].lit < 0 {
return &cnf.Lit{uint(lc.vmtf[i].lit * -1), cnf.Pos}
} else {
return &cnf.Lit{uint(lc.vmtf[i].lit), cnf.Pos}
}
}
}
panic("getNextVmtf is broken")
}