stage_duration_minutes, repair_fct, lines) cb_data["epath"] = egret_path_to_data cb_data["acstream"] = acstream creator_options = {"cb_data": cb_data} scenario_names=["Scenario_"+str(i)\ for i in range(1,len(cb_data["etree"].rootnode.ScenarioList)+1)] # end options ef = sputils.create_EF(scenario_names, pysp2_callback, creator_options) ###solver.options["BarHomogeneous"] = 1 if "gurobi" in solvername: solver.options["BarHomogeneous"] = 1 results = solver.solve(ef, tee=True) pyo.assert_optimal_termination(results) print('EF objective value:', pyo.value(ef.EF_Obj)) sputils.ef_nonants_csv(ef, "vardump.csv") for (sname, smodel) in sputils.ef_scenarios(ef): print(sname) for stage in smodel.stage_models: print(" Stage {}".format(stage)) for gen in smodel.stage_models[stage].pg: print (" gen={} pg={}, qg={}"\ .format(gen, pyo.value(smodel.stage_models[stage].pg[gen]), pyo.value(smodel.stage_models[stage].qg[gen]))) print(" obj={}".format(pyo.value(smodel.objective))) print("EF objective value for case {}={}".\ format(pyo.value(casename), pyo.value(ef.EF_Obj)))
def nonants_to_csv(self, filename): """ Dump the nonant vars from an ef to a csv file; truly a dump... Args: filename (str): the full name of the csv output file """ sputils.ef_nonants_csv(self.ef, filename)