Esempio n. 1
0
 def pysp_scenario_tree_model_callback(self):
     """
   scenario tree instance creation callback
   @ In, None
   @ Out, treeModel, Instance, pyomo scenario tree model for two stage stochastic programming,
     extra variables 'y[*,*]' is used to define the priorities of investments,
     'gamma' and 'nu[*]' is used for the distributionally robust optimization counter-part.
 """
     treeModel = MultipleKnapsack.pysp_scenario_tree_model_callback(self)
     # additional variables:
     firstStage = treeModel.Stages.first()
     treeModel.StageVariables[firstStage].add('gamma')
     treeModel.StageVariables[firstStage].add('nu[*]')
     return treeModel
Esempio n. 2
0
 def pysp_scenario_tree_model_callback(self):
     """
   scenario tree instance creation callback
   @ In, None
   @ Out, treeModel, Instance, pyomo scenario tree model for two stage stochastic programming,
     extra variables 'y[*,*]' is used to define the priorities of investments,
     'u' and 'nu' is used for CVaR optimization counter-part.
     'cvar' is used to retrieve the calculated CVaR value
     'expectProfit' is used to retrieve the expect profit under CVaR optimization
 """
     treeModel = MultipleKnapsack.pysp_scenario_tree_model_callback(self)
     # additional variables:
     firstStage = treeModel.Stages.first()
     secondStage = treeModel.Stages.last()
     treeModel.StageVariables[firstStage].add('u')
     treeModel.StageVariables[secondStage].add('nu')
     treeModel.StageVariables[secondStage].add('cvar')
     treeModel.StageVariables[secondStage].add('expectProfit')
     return treeModel