# Path: group_testing/simulator.py
# class Simulator(object):
#   def __init__(self,
#                workdir: str = None,
#                wetlab=wet_lab.WetLab(),
#                policy=group_policy.Dorfman(),
#                sampler=smc.SmcSampler(),
#                cheap_sampler=lbp.LbpSampler(),
#                num_simulations: int = 1,
#                num_tests_per_cycle: int = 10,
#                max_test_cycles: int = 5,
#                max_group_size: int = 8,
#                prior_specificity: Union[float, Iterable[float]] = 0.97,
#                prior_sensitivity: Union[float, Iterable[float]] = 0.85,
#                prior_infection_rate: Union[float, Iterable[float]] = 0.05,
#                metrics_cls=metrics.Metrics,
#                export_metrics_every: int = 5):
#   def reset(self, rng: np.ndarray):
#   def sampler(self):
#   def run(self, rngkey=None):
#   def is_over(self) -> bool:
#   def run_simulation(self, rng, sim_idx: int):
#   def run_one_cycle(self, rng, sim_idx: int):
#   def marginal(self):
#   def process_tests_results(self, rng, new_tests):
#   def get_new_groups(self, rng) -> np.ndarray:
#   def _resample(self, rng):
#   def _on_iteration_end(self,
#                         sim_idx: int,
#                         cycle_idx: int,
#                         new_groups=None,
#                         new_tests=None):
#   def interactive_loop(self, rngkey: int = None, show_fn=None):


from absl import app
from absl import flags
from group_testing import simulator
import gin
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Lint as: python3
r"""Launch group testing simulator.

For example: (use verbosity 1 for debug, 0 for info, -1 for warning, etc.)

python3 -m run_experiment --gin_config=configs/toy.gin --verbosity=1
"""



flags.DEFINE_string('base_dir', None, 'Directory to save data to.')
flags.DEFINE_integer('seed', None, 'Random seed to be used in this run.')
flags.DEFINE_multi_string('gin_config', [],
                          'List of paths to the config files.')
flags.DEFINE_multi_string('gin_bindings', [],
                          'Newline separated list of Gin parameter bindings.')
flags.DEFINE_bool('interactive_mode',
                  True,
                  'Run in interactive mode to let the user enters the positive '
                  'groups at each test cycle. Use --nointeractive_mode to '
                  'disable it.')
FLAGS = flags.FLAGS


def main(unused_argv):
  gin.parse_config_files_and_bindings(FLAGS.gin_config, FLAGS.gin_bindings)

# Path: group_testing/simulator.py
# class Simulator(object):
#   def __init__(self,
#                workdir: str = None,
#                wetlab=wet_lab.WetLab(),
#                policy=group_policy.Dorfman(),
#                sampler=smc.SmcSampler(),
#                cheap_sampler=lbp.LbpSampler(),
#                num_simulations: int = 1,
#                num_tests_per_cycle: int = 10,
#                max_test_cycles: int = 5,
#                max_group_size: int = 8,
#                prior_specificity: Union[float, Iterable[float]] = 0.97,
#                prior_sensitivity: Union[float, Iterable[float]] = 0.85,
#                prior_infection_rate: Union[float, Iterable[float]] = 0.05,
#                metrics_cls=metrics.Metrics,
#                export_metrics_every: int = 5):
#   def reset(self, rng: np.ndarray):
#   def sampler(self):
#   def run(self, rngkey=None):
#   def is_over(self) -> bool:
#   def run_simulation(self, rng, sim_idx: int):
#   def run_one_cycle(self, rng, sim_idx: int):
#   def marginal(self):
#   def process_tests_results(self, rng, new_tests):
#   def get_new_groups(self, rng) -> np.ndarray:
#   def _resample(self, rng):
#   def _on_iteration_end(self,
#                         sim_idx: int,
#                         cycle_idx: int,
#                         new_groups=None,
#                         new_tests=None):
#   def interactive_loop(self, rngkey: int = None, show_fn=None):


# Path: run_experiment.py
from absl import app
from absl import flags
from group_testing import simulator
import gin

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Lint as: python3
r"""Launch group testing simulator.

For example: (use verbosity 1 for debug, 0 for info, -1 for warning, etc.)

python3 -m run_experiment --gin_config=configs/toy.gin --verbosity=1
"""



flags.DEFINE_string('base_dir', None, 'Directory to save data to.')
flags.DEFINE_integer('seed', None, 'Random seed to be used in this run.')
flags.DEFINE_multi_string('gin_config', [],
                          'List of paths to the config files.')
flags.DEFINE_multi_string('gin_bindings', [],
                          'Newline separated list of Gin parameter bindings.')
flags.DEFINE_bool('interactive_mode',
                  True,
                  'Run in interactive mode to let the user enters the positive '
                  'groups at each test cycle. Use --nointeractive_mode to '
                  'disable it.')
FLAGS = flags.FLAGS


def main(unused_argv):
  gin.parse_config_files_and_bindings(FLAGS.gin_config, FLAGS.gin_bindings)

  sim = simulator.Simulator(workdir=FLAGS.base_dir)