@Test(groups = "1s") public void testCopyFrom() throws Exception { }
public void copyFrom(SatSolver o) { this.ok_ = o.ok_; this.qhead_ = o.qhead_; this.num_vars_ = o.num_vars_; this.trail_.resetQuick(); this.trail_.addAll(o.trail_); this.trail_markers_.resetQuick(); this.trail_markers_.addAll(o.trail_markers_); this.touched_variables_.resetQuick(); this.touched_variables_.addAll(o.touched_variables_); this.temporary_add_vector_.resetQuick(); this.temporary_add_vector_.addAll(o.temporary_add_vector_); for (int k : o.assignment_.keys()) { this.assignment_.putIfAbsent(k, o.assignment_.get(k)); } for (int k : o.implies_.keys()) { TIntArrayList tl = this.implies_.get(k); if(tl == null){ tl = new TIntArrayList(); this.implies_.put(k, tl); }else{ tl.resetQuick(); } tl.addAll(o.implies_.get(k)); } final HashMap<Clause, Clause> map = new HashMap<>(); this.clauses.clear(); for (Clause cl : o.clauses) { Clause _cl = new Clause(cl.literals_); map.put(cl, _cl); this.clauses.add(_cl); } this.learnts.clear(); for (Clause cl : o.learnts) { Clause _cl = new Clause(cl.literals_); map.put(cl, _cl); this.learnts.add(_cl); } this.watches_.clear(); for (int k : o.watches_.keys()) { ArrayList<Watcher> ws = o.watches_.get(k); ArrayList<Watcher> _ws = new ArrayList<>(ws.size()); for (Watcher w : ws) { _ws.add(new Watcher(map.get(w.clause), w.blocker)); } this.watches_.put(k, _ws); } }
SatSolver implements SatFactory { public void copyFrom(SatSolver o) { this.ok_ = o.ok_; this.qhead_ = o.qhead_; this.num_vars_ = o.num_vars_; this.trail_.resetQuick(); this.trail_.addAll(o.trail_); this.trail_markers_.resetQuick(); this.trail_markers_.addAll(o.trail_markers_); this.touched_variables_.resetQuick(); this.touched_variables_.addAll(o.touched_variables_); this.temporary_add_vector_.resetQuick(); this.temporary_add_vector_.addAll(o.temporary_add_vector_); for (int k : o.assignment_.keys()) { this.assignment_.putIfAbsent(k, o.assignment_.get(k)); } for (int k : o.implies_.keys()) { TIntArrayList tl = this.implies_.get(k); if(tl == null){ tl = new TIntArrayList(); this.implies_.put(k, tl); }else{ tl.resetQuick(); } tl.addAll(o.implies_.get(k)); } final HashMap<Clause, Clause> map = new HashMap<>(); this.clauses.clear(); for (Clause cl : o.clauses) { Clause _cl = new Clause(cl.literals_); map.put(cl, _cl); this.clauses.add(_cl); } this.learnts.clear(); for (Clause cl : o.learnts) { Clause _cl = new Clause(cl.literals_); map.put(cl, _cl); this.learnts.add(_cl); } this.watches_.clear(); for (int k : o.watches_.keys()) { ArrayList<Watcher> ws = o.watches_.get(k); ArrayList<Watcher> _ws = new ArrayList<>(ws.size()); for (Watcher w : ws) { _ws.add(new Watcher(map.get(w.clause), w.blocker)); } this.watches_.put(k, _ws); } } }
SatSolver implements SatFactory { public void copyFrom(SatSolver o) { this.ok_ = o.ok_; this.qhead_ = o.qhead_; this.num_vars_ = o.num_vars_; this.trail_.resetQuick(); this.trail_.addAll(o.trail_); this.trail_markers_.resetQuick(); this.trail_markers_.addAll(o.trail_markers_); this.touched_variables_.resetQuick(); this.touched_variables_.addAll(o.touched_variables_); this.temporary_add_vector_.resetQuick(); this.temporary_add_vector_.addAll(o.temporary_add_vector_); for (int k : o.assignment_.keys()) { this.assignment_.putIfAbsent(k, o.assignment_.get(k)); } for (int k : o.implies_.keys()) { TIntArrayList tl = this.implies_.get(k); if(tl == null){ tl = new TIntArrayList(); this.implies_.put(k, tl); }else{ tl.resetQuick(); } tl.addAll(o.implies_.get(k)); } final HashMap<Clause, Clause> map = new HashMap<>(); this.clauses.clear(); for (Clause cl : o.clauses) { Clause _cl = new Clause(cl.literals_); map.put(cl, _cl); this.clauses.add(_cl); } this.learnts.clear(); for (Clause cl : o.learnts) { Clause _cl = new Clause(cl.literals_); map.put(cl, _cl); this.learnts.add(_cl); } this.watches_.clear(); for (int k : o.watches_.keys()) { ArrayList<Watcher> ws = o.watches_.get(k); ArrayList<Watcher> _ws = new ArrayList<>(ws.size()); for (Watcher w : ws) { _ws.add(new Watcher(map.get(w.clause), w.blocker)); } this.watches_.put(k, _ws); } } SatSolver(); }
SatSolver implements SatFactory { public void copyFrom(SatSolver o) { this.ok_ = o.ok_; this.qhead_ = o.qhead_; this.num_vars_ = o.num_vars_; this.trail_.resetQuick(); this.trail_.addAll(o.trail_); this.trail_markers_.resetQuick(); this.trail_markers_.addAll(o.trail_markers_); this.touched_variables_.resetQuick(); this.touched_variables_.addAll(o.touched_variables_); this.temporary_add_vector_.resetQuick(); this.temporary_add_vector_.addAll(o.temporary_add_vector_); for (int k : o.assignment_.keys()) { this.assignment_.putIfAbsent(k, o.assignment_.get(k)); } for (int k : o.implies_.keys()) { TIntArrayList tl = this.implies_.get(k); if(tl == null){ tl = new TIntArrayList(); this.implies_.put(k, tl); }else{ tl.resetQuick(); } tl.addAll(o.implies_.get(k)); } final HashMap<Clause, Clause> map = new HashMap<>(); this.clauses.clear(); for (Clause cl : o.clauses) { Clause _cl = new Clause(cl.literals_); map.put(cl, _cl); this.clauses.add(_cl); } this.learnts.clear(); for (Clause cl : o.learnts) { Clause _cl = new Clause(cl.literals_); map.put(cl, _cl); this.learnts.add(_cl); } this.watches_.clear(); for (int k : o.watches_.keys()) { ArrayList<Watcher> ws = o.watches_.get(k); ArrayList<Watcher> _ws = new ArrayList<>(ws.size()); for (Watcher w : ws) { _ws.add(new Watcher(map.get(w.clause), w.blocker)); } this.watches_.put(k, _ws); } } SatSolver(); @Override SatSolver _me(); int newVariable(); boolean addClause(TIntList ps); boolean learnClause(int... ps); boolean addClause(int l); void cancelUntil(int level); int trailMarker(); int nLearnt(); boolean propagateOneLiteral(int lit); void detachLearnt(int ci); static int makeLiteral(int var, boolean sign); static int negated(int l); static boolean sign(int l); static int var(int l); void copyFrom(SatSolver o); long nbclauses(); long numvars(); }
SatSolver implements SatFactory { public void copyFrom(SatSolver o) { this.ok_ = o.ok_; this.qhead_ = o.qhead_; this.num_vars_ = o.num_vars_; this.trail_.resetQuick(); this.trail_.addAll(o.trail_); this.trail_markers_.resetQuick(); this.trail_markers_.addAll(o.trail_markers_); this.touched_variables_.resetQuick(); this.touched_variables_.addAll(o.touched_variables_); this.temporary_add_vector_.resetQuick(); this.temporary_add_vector_.addAll(o.temporary_add_vector_); for (int k : o.assignment_.keys()) { this.assignment_.putIfAbsent(k, o.assignment_.get(k)); } for (int k : o.implies_.keys()) { TIntArrayList tl = this.implies_.get(k); if(tl == null){ tl = new TIntArrayList(); this.implies_.put(k, tl); }else{ tl.resetQuick(); } tl.addAll(o.implies_.get(k)); } final HashMap<Clause, Clause> map = new HashMap<>(); this.clauses.clear(); for (Clause cl : o.clauses) { Clause _cl = new Clause(cl.literals_); map.put(cl, _cl); this.clauses.add(_cl); } this.learnts.clear(); for (Clause cl : o.learnts) { Clause _cl = new Clause(cl.literals_); map.put(cl, _cl); this.learnts.add(_cl); } this.watches_.clear(); for (int k : o.watches_.keys()) { ArrayList<Watcher> ws = o.watches_.get(k); ArrayList<Watcher> _ws = new ArrayList<>(ws.size()); for (Watcher w : ws) { _ws.add(new Watcher(map.get(w.clause), w.blocker)); } this.watches_.put(k, _ws); } } SatSolver(); @Override SatSolver _me(); int newVariable(); boolean addClause(TIntList ps); boolean learnClause(int... ps); boolean addClause(int l); void cancelUntil(int level); int trailMarker(); int nLearnt(); boolean propagateOneLiteral(int lit); void detachLearnt(int ci); static int makeLiteral(int var, boolean sign); static int negated(int l); static boolean sign(int l); static int var(int l); void copyFrom(SatSolver o); long nbclauses(); long numvars(); public boolean ok_; public ArrayList<Clause> clauses; public ArrayList<Clause> learnts; public TIntObjectHashMap<TIntArrayList> implies_; public TIntArrayList touched_variables_; }