def test_MMW_constructor(self):
        options = self._get_base_options()
        xhat = ciutils.read_xhat(self.xhat_path)

        MMW = MMWci.MMWConfidenceIntervals(self.refmodelname,
                          options['kwoptions'],
                          xhat,
                          options['num_batches'], batch_size = options["batch_size"], start = options['kwoptions']['num_scens'])
Exemple #2
0
 def test_MMW_running(self):
     options = _get_base_options()
     xhat = ciutils.read_xhat(self.xhat_path)
     MMW = MMWci.MMWConfidenceIntervals(refmodelname, options['opt'], xhat,
                                        options['num_batches'])
     r = MMW.run()
     s = round_pos_sig(r['std'], 2)
     bound = round_pos_sig(r['gap_inner_bound'], 2)
     self.assertEqual((s, bound), (43.0, 280.0))
 def test_MMW_running(self):
     options = self._get_base_options()
     xhat = ciutils.read_xhat(self.xhat_path)
     MMW = MMWci.MMWConfidenceIntervals(self.refmodelname,
                                        options['opt'],
                                        xhat,
                                        options['num_batches'],
                                        batch_size=options["batch_size"],
                                        start=options['opt']['num_scens'])
     r = MMW.run()
     s = round_pos_sig(r['std'], 2)
     bound = round_pos_sig(r['gap_inner_bound'], 2)
     self.assertEqual((s, bound), (1.5, 96.0))
Exemple #4
0
    if args.batch_size == None:
        args.batch_size = args.num_scens

    refmodel = modelpath #Change this path to use a different model
    
    options = {"EF-2stage": True,# 2stage vs. mstage
               "start": False,
               "EF_solver_name": args.solver_name,
               "EF_solver_options": solver_options,
               "num_scens": args.num_scens}   #Are the scenario shifted by a start arg ?

    #should we accept these as arguments?
    num_batches = args.num_batches
    batch_size = args.batch_size

    mmw = mmw_ci.MMWConfidenceIntervals(refmodel, options, xhat, num_batches, batch_size=batch_size,
                       verbose=True)

    if args.alpha == None:
        print('\nNo alpha given, defaulting to alpha = 0.95. To provide an alpha try:\n')
        print('python -m mpisppy.confidence_intervals.mmw_conf {} {} {} {} --alpha 0.97 --MMW-num-batches {} --MMW-batch-size {} --num-scens {}\
            \n'.format(sys.argv[0], args.instance, args.xhatpath, args.solver_name, 
                args.num_batches, args.batch_size, args.num_scens))
        alpha = 0.95
    else: 
        alpha = float(args.alpha)

    r = mmw.run(confidence_level=alpha, objective_gap = args.objective_gap)

    global_toc(r)
    
Exemple #5
0
    def test_MMW_constructor(self):
        options = _get_base_options()
        xhat = ciutils.read_xhat(self.xhat_path)

        MMW = MMWci.MMWConfidenceIntervals(refmodelname, options['opt'], xhat,
                                           options['num_batches'])