public void Build(SAT sat) { var n = sat.DB.Count; this.DB = sat.DB; var cov = new double[n]; var seq = new int[n]; this.root = sat.root.objID; int nonzeros = 0; var visit = new Action<SAT.Node,SAT.Node>((parent, child) => { seq[child.objID] = (parent == null) ? n : parent.objID; cov[child.objID] = child.cov; if (child.cov > 0) ++nonzeros; }); visit (null, sat.root); this.Build_IterateSAT (sat.root, visit); var listibuilder = ListIBuilders.GetArray (); var permbuilder = PermutationBuilders.GetCyclicPerms (1, listibuilder, listibuilder); var seqbuilder = SequenceBuilders.GetSeqSinglePerm (permbuilder); this.SEQ = seqbuilder (seq, n + 1); this.COV = new List<double> (nonzeros); var cov_zero = new BitStream32 (); cov_zero.Write (true, n); for (int objID = 0; objID < n; ++objID) { if (cov[objID] > 0) { this.COV.Add(cov[objID]); cov_zero[objID] = false; } } this.COV_ZERO = new GGMN (); this.COV_ZERO.Build (cov_zero, 8); }
public static string ExecuteSATApprox(IndexArgumentSetup setup, string nick) { var idxname = String.Format ("{0}/Index.SATApprox", nick); return Execute (setup, nick, idxname, (db) => { var sat = new SAT(); sat.Build(db, new Random()); var satapprox = new SAT_ApproxSearch(); satapprox.Build(sat); return satapprox; }); }
public void Build(SAT sat) { this.root = sat.root; this.DB = sat.DB; }
void Build_IterateSAT(SAT.Node node, Action<SAT.Node, SAT.Node> visit) { foreach (var child in node.Children) { visit(node, child); this.Build_IterateSAT(child, visit); } }
public static string ExecuteSAT(IndexArgumentSetup setup, string nick) { var idxname = String.Format ("{0}/Index.SAT-Legacy", nick); return Execute (setup, nick, idxname, (db) => { var sat = new SAT (); sat.Build (db, RandomSets.GetRandom()); return sat; }); }