class_docstr: Class for converting a gym environment, a controller style, and others into a black-box optimization benchmark.
class_docstr_tok: ["Class","for","converting","a","gym","environment",",","a","controller","style",",","and","others","into","a","black-box","optimization","benchmark","."]
code: def archive_observations(
      self, current_actions, current_observations, current_reward
  ):
      self.num_losses += 1
      tau = 1.0 / self.num_losses
      self.mean_loss = (
          ((1.0 - tau) * self.mean_loss + tau * current_reward)
          if self.mean_loss is not None
          else current_reward
      )
      found = False
      for trace in self.archive:
          to, _, _ = trace
          if np.array_equal(
              np.asarray(current_observations, dtype=np.float32),
              np.asarray(to, dtype=np.float32),
          ):
              found = True
              break
      if not found:
          # Risky: this code assumes that the object is used only in a single run.
          self.archive += [
              (current_observations, current_actions, current_reward)
          ]
  
imports: import os
  import copy
  import scipy.stats
  import typing
  import numpy
  import gym
  import nevergrad
  from nevergrad.parametrization import parameter
  from ..base import ExperimentFunction
label_desc: Use image node_id 16 for calling the GymMulti obj's underlying member method code with example usage: obj.archive_observations(current_actions, current_observations, current_reward) without return types