#  Numenta Platform for Intelligent Computing (NuPIC)
#  Copyright (C) 2020, Numenta, Inc.  Unless you have an agreement
#  with Numenta, Inc., for a separate license for this software code, the
#  following terms and conditions apply:
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU Affero Public License version 3 as
#  published by the Free Software Foundation.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#  See the GNU Affero Public License for more details.
#
#  You should have received a copy of the GNU Affero Public License
#  along with this program.  If not, see http://www.gnu.org/licenses.
#
#  http://numenta.org/licenses/
#
import argparse
import copy

import ray  # noqa: F401

from experiments import CONFIGS
from nupic.research.frameworks.vernon.parser_utils import (
    DEFAULT_PARSERS, process_args,
    insert_experiment_mixin
)
from nupic.research.frameworks.vernon.run_with_raytune import run
from mixins import GSCNoiseTest

if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        parents=DEFAULT_PARSERS,
    )
    parser.add_argument("-e", "--experiment", dest="name", default="default_base",
                        help="Experiment to run", choices=CONFIGS.keys())
    parser.add_argument("--evaluate-noise", action="store_true",
                        help="Whether or not to run noise tests")
    args = parser.parse_args()
    if args.name is None:
        parser.print_help()
        exit(1)

    # Get configuration values
    config = copy.deepcopy(CONFIGS[args.name])

    # Merge configuration with command line arguments
    config.update(vars(args))

    # Process args and modify config appropriately.
    config = process_args(args, config)

    # Add noise tests
    if args.evaluate_noise:
        insert_experiment_mixin(config=config, mixin=GSCNoiseTest)

    if config is None:
        pass
    else:
        run(config)

@@ -892,16 +892,37 @@
 qa: F401
+%0Afrom ray import tune
 %0A%0Afrom e
@@ -1563,16 +1563,135 @@
 tests%22)%0A
+    parser.add_argument(%22--num-samples%22, type=int, default=1,%0A                        help=%22Number of samples to run%22)%0A
     args
@@ -1952,101 +1952,8 @@
 ))%0A%0A
-    # Process args and modify config appropriately.%0A    config = process_args(args, config)%0A%0A
     
@@ -2066,16 +2066,330 @@
 eTest)%0A%0A
+    # Replace static seed if using multiple samples%0A    if args.num_samples %3E 1:%0A        seed = config.get(%22seed%22, 0)%0A        if isinstance(seed, int):%0A            config.update(seed=tune.randint(args.num_samples * 100))%0A%0A    # Process args and modify config appropriately.%0A    config = process_args(args, config)%0A
     if c

Add option to run multiple seeds