@@ -159,6 +159,8 @@ std::optional<ProtoLiteral> ProtoLiteral::EncodeLiteral(
159159 return result;
160160}
161161
162+ ProtoTrail::ProtoTrail () { target_phase_.reserve (kMaxPhaseSize ); }
163+
162164void ProtoTrail::PushLevel (const ProtoLiteral& decision,
163165 IntegerValue objective_lb, int node_id) {
164166 CHECK_GT (node_id, 0 );
@@ -791,8 +793,8 @@ bool SharedTreeWorker::SyncWithSharedTree() {
791793 if (ShouldReplaceSubtree ()) {
792794 ++num_trees_;
793795 VLOG (2 ) << parameters_->name () << " acquiring tree #" << num_trees_
794- << " after " << num_restarts_ - tree_assignment_restart_
795- << " restarts prev depth: " << assigned_tree_.MaxLevel ()
796+ << " after " << restart_policy_-> NumRestarts () << " restarts "
797+ << " prev depth: " << assigned_tree_.MaxLevel ()
796798 << " target: " << assigned_tree_lbds_.WindowAverage ()
797799 << " lbd: " << restart_policy_->LbdAverageSinceReset ();
798800 if (parameters_->shared_tree_worker_enable_phase_sharing () &&
@@ -804,11 +806,10 @@ bool SharedTreeWorker::SyncWithSharedTree() {
804806 // workers.
805807 auto encoded = ProtoLiteral::EncodeLiteral (lit, mapping_);
806808 if (!encoded.has_value ()) continue ;
807- assigned_tree_.SetPhase (*encoded);
809+ if (! assigned_tree_.AddPhase (*encoded)) break ;
808810 }
809811 }
810812 manager_->ReplaceTree (assigned_tree_);
811- tree_assignment_restart_ = num_restarts_;
812813 assigned_tree_lbds_.Add (restart_policy_->LbdAverageSinceReset ());
813814 restart_policy_->Reset ();
814815 if (parameters_->shared_tree_worker_enable_phase_sharing ()) {
@@ -854,9 +855,8 @@ SatSolver::Status SharedTreeWorker::Search(
854855 return sat_solver_->UnsatStatus ();
855856 }
856857 if (heuristics_->restart_policies [heuristics_->policy_index ]()) {
857- ++num_restarts_;
858- heuristics_->policy_index =
859- num_restarts_ % heuristics_->decision_policies .size ();
858+ heuristics_->policy_index = restart_policy_->NumRestarts () %
859+ heuristics_->decision_policies .size ();
860860 sat_solver_->Backtrack (0 );
861861 }
862862 if (!SyncWithLocalTrail ()) return sat_solver_->UnsatStatus ();
0 commit comments