@@ -18,6 +18,10 @@ bool Optimizer::dispatch(Message const &message, unsigned int id) {
18
18
19
19
vertex_accessor vertex;
20
20
bool inserted = store_self (task.capture_set (), task, vertex);
21
+ // if this subproblem already existed, we still have to update the scope
22
+ if (!inserted) {
23
+ vertex -> second.scope (message.scope );
24
+ }
21
25
22
26
store_children (vertex->second , id);
23
27
@@ -166,10 +170,11 @@ bool Optimizer::load_children(Task &task, Bitmask const &signals, unsigned int i
166
170
lower = std::min (lower, std::get<1 >(*iterator));
167
171
upper = std::min (upper, std::get<2 >(*iterator));
168
172
}
169
- if (lower > task.upperscope ()) { return false ; } // if lower is > upperscope, then lower may not be a true lower bound b/c of line 160.
170
- // (In this case, base objective and all splits are all above upper scope, and
171
- // no splits were used to update the bounds, though the splits may still have been
172
- // better than the base risk).
173
+ if (lower > task.upperscope ()) {
174
+ return task.update (m_config, task.upperscope (), upper, optimal_feature);
175
+ } // ^ if lower is > upperscope, then lower may not be a true lower bound b/c of line 160.
176
+ // (In this case, base objective and all splits are all above upper scope,
177
+ // but we do not know the exact lower bound)
173
178
return task.update (m_config, lower, upper, optimal_feature);
174
179
}
175
180
@@ -188,9 +193,6 @@ bool Optimizer::store_self(Bitmask const &identifier, Task const &value, vertex_
188
193
void Optimizer::store_children (Task &task, unsigned int id) {
189
194
bound_accessor bounds;
190
195
bool inserted = m_graph.bounds .insert (bounds, task.capture_set ());
191
- if (!inserted) {
192
- return ;
193
- }
194
196
int optimal_feature = -1 ;
195
197
float lower = task.base_objective (), upper = task.base_objective ();
196
198
Bitmask const &features = task.feature_set ();
@@ -221,7 +223,10 @@ void Optimizer::store_children(Task &task, unsigned int id) {
221
223
split_lower = left.lowerbound () + right.lowerbound ();
222
224
split_upper = left.upperbound () + right.upperbound ();
223
225
}
224
- bounds->second .push_back (std::tuple<int , float , float >(j, split_lower, split_upper));
226
+ if (inserted) {
227
+ // If we're visiting children for the first time in our graph, store bounds
228
+ bounds->second .push_back (std::tuple<int , float , float >(j, split_lower, split_upper));
229
+ }
225
230
if (split_lower > task.upperscope ()) {
226
231
continue ;
227
232
}
@@ -232,8 +237,11 @@ void Optimizer::store_children(Task &task, unsigned int id) {
232
237
upper = std::min (upper, split_upper);
233
238
}
234
239
}
235
- if (lower > task.upperscope ()) { return ; } // similar reason to check on line 169. If all children out of scope,
236
- // and base risk out of scope, don't update bound.
240
+ if (lower > task.upperscope ()) {
241
+ task.update (m_config, task.upperscope (), upper, optimal_feature);
242
+ return ;
243
+ } // ^ similar reason to check in load_children. Don't know exact lb,
244
+ // just that it exceeds the upperscope()
237
245
task.update (m_config, lower, upper, optimal_feature);
238
246
}
239
247
@@ -267,7 +275,7 @@ void Optimizer::signal_exploiters(adjacency_accessor &parents, Task &self, unsig
267
275
self.uncertainty () > 0 ) {
268
276
continue ;
269
277
}
270
- m_local_states[id].outbound_message .exploitation (self.capture_set (), // sender tile
278
+ m_local_states[id].outbound_message .exploitation (self.capture_set (), // sender tile
271
279
iterator->first , // recipient tile
272
280
iterator->second .first , // recipient features
273
281
self.support () - self.lowerbound ()); // priority
0 commit comments