Ejemplo n.º 1
0
    def test_ph_solve(self):
        PHoptions = self._copy_of_base_options()

        ph = mpisppy.opt.ph.PH(PHoptions,
                               self.all_scenario_names,
                               hydro.scenario_creator,
                               hydro.scenario_denouement,
                               all_nodenames=self.all_nodenames,
                               cb_data=self.BFs)
        conv, obj, tbound = ph.ph_main()

        sig2tbnd = round_pos_sig(tbound, 2)
        self.assertEqual(180, sig2tbnd)

        ph._disable_W_and_prox()
        sig2eobj = round_pos_sig(ph.Eobjective(), 2)
        self.assertEqual(190, sig2eobj)
Ejemplo n.º 2
0
    def test_ph_solve(self):
        options = self._copy_of_base_options()

        ph = mpisppy.opt.ph.PH(
            options,
            self.all_scenario_names,
            hydro.scenario_creator,
            hydro.scenario_denouement,
            all_nodenames=self.all_nodenames,
            scenario_creator_kwargs={
                "branching_factors": self.branching_factors
            },
        )
        conv, obj, tbound = ph.ph_main()

        sig2tbnd = round_pos_sig(tbound, 2)
        self.assertEqual(180, sig2tbnd)

        ph.disable_W_and_prox()
        sig2eobj = round_pos_sig(ph.Eobjective(), 2)
        self.assertEqual(190, sig2eobj)
Ejemplo n.º 3
0
    # as of april 2020, we are not supporting xhat as an extension
    ph = mpisppy.opt.ph.PH(
        options,
        all_scenario_names,
        scenario_creator,
        scenario_denouement,
        scenario_creator_kwargs={"branching_factors": BFs},
        all_nodenames=all_nodenames,
    )

    conv, obj, tbound = ph.ph_main()
    if ph.cylinder_rank == 0:
        print("Trival bound =", tbound)

    ph._disable_W_and_prox()
    e_obj = ph.Eobjective()
    if ph.cylinder_rank == 0:
        print("unweighted e_obj={}".format(e_obj))
    """
    #******* APH ******
    print ("APH")
    options["async_frac_needed"] = 1
    options["async_sleep_secs"] = 1
    aph = mpisppy.opt.aph.APH(options, all_scenario_names,
                        scenario_creator,
                              scenario_denouement,
                              all_nodenames = all_nodenames)

    conv, obj, bnd = aph.APH_main(extensions = XhatSpecific,
        scenario_creator_kwargs={"branching_factors": BFs},
    )