MCPcopy
hub / github.com/facebookresearch/nevergrad / ask

Method ask

nevergrad/optimization/utils.py:328–339  ·  view source on GitHub ↗

Takes a uid from the told queue if not empty, else from the older asked, then adds it to the asked queue.

(self)

Source from the content-addressed store, hash-verified

326 self.asked.clear()
327
328 def ask(self) -> str:
329 """Takes a uid from the told queue if not empty, else from the older asked,
330 then adds it to the asked queue.
331 """
332 if self.told:
333 uid = self.told.popleft()
334 elif self.asked:
335 uid = next(iter(self.asked))
336 else:
337 raise RuntimeError("Both asked and told queues are empty.")
338 self.asked.add(uid)
339 return uid
340
341 def tell(self, uid: str) -> None:
342 """Removes the uid from the asked queue and adds to the told queue"""

Callers 15

test_uid_queueFunction · 0.95
test_optimizers_suggestFunction · 0.45
test_ngoptFunction · 0.45
test_tell_not_askedFunction · 0.45
test_chainingFunction · 0.45
test_parallel_esFunction · 0.45
test_optimizer_sequenceFunction · 0.45
test_bo_orderingFunction · 0.45
test_mo_with_nanFunction · 0.45
test_uniform_samplingFunction · 0.45

Calls 1

addMethod · 0.45

Tested by 15

test_uid_queueFunction · 0.76
test_optimizers_suggestFunction · 0.36
test_ngoptFunction · 0.36
test_tell_not_askedFunction · 0.36
test_chainingFunction · 0.36
test_parallel_esFunction · 0.36
test_optimizer_sequenceFunction · 0.36
test_bo_orderingFunction · 0.36
test_mo_with_nanFunction · 0.36
test_uniform_samplingFunction · 0.36
test_paraportfolio_deFunction · 0.36