Exemplo n.º 1
0
 def setScenarioData(self):
   """
     Method to setup the scenario data for scenario tree construction
     @ In, None
     @ Out, None
   """
   ModelBase.setScenarioData(self)
Exemplo n.º 2
0
 def __init__(self):
   """
     Constructor
     @ In, None
     @ Out, None
   """
   ModelBase.__init__(self)
Exemplo n.º 3
0
 def writeOutput(self, filename):
   """
     Method used to output the optimization results
     @ In, filename, string, filename of output file
     @ Out, None
   """
   ModelBase.writeOutput(self,filename)
Exemplo n.º 4
0
 def printScenarioSolution(self, stsolver):
   """
     Output optimization solution to screen
     @ In, stsolver, instance, pyomo stochastic programming solver instance
     @ Out, None
   """
   ModelBase.printScenarioSolution(self, stsolver)
   self.collectPriorityOutputs(stsolver.root_Var_solution())
   obj = stsolver.root_E_obj()
   logger.info("Expecatation of NPV take over scenarios = %16.4f" %(obj))
Exemplo n.º 5
0
 def printSolution(self, model):
   """
     Output optimization solution to screen
     @ In, model, instance, pyomo optimization model
     @ Out, outputDict, dict, dictionary stores the outputs
   """
   outputDict = ModelBase.printSolution(self, model)
   return outputDict
Exemplo n.º 6
0
 def createModel(self):
   """
     This method is used to create pyomo model.
     @ In, None
     @ Out, model, pyomo.AbstractModel, abstract pyomo model
   """
   model = ModelBase.createModel(self)
   return model
Exemplo n.º 7
0
 def addAdditionalConstraints(self, model):
   """
     Add specific constraints for DROMCKP problems
     @ In, model, pyomo model instance, pyomo abstract model
     @ Out, model, pyomo model instance, pyomo abstract model
   """
   model = ModelBase.addAdditionalConstraints(self, model)
   return model
Exemplo n.º 8
0
 def addAdditionalParams(self, model):
   """
     Add specific Params for MCKP problems
     @ In, model, pyomo model instance, pyomo abstract model
     @ Out, model, pyomo model instance, pyomo abstract model
   """
   model = ModelBase.addAdditionalParams(self, model)
   return model
Exemplo n.º 9
0
 def initialize(self, initDict):
   """
     Mehod to initialize
     @ In, initDict, dict, dictionary of preprocessed input data
       {
         'Sets':{setName: list of setValues},
         'Parameters':{paramName:{setsIndex:paramValue}} or {paramName:{'None':paramValue}},
         'Settings':{xmlTag:xmlVal},
         'Meta':{paramName:{setIndexName:indexDim}} or {paramName:None},
         'Uncertainties':{paramName:{'scenarios':{scenarioName:{setIndex:uncertaintyVal}}, 'probabilities': [ProbVals]}}
       }
     @ Out, None
   """
   ModelBase.initialize(self, initDict)
   ## update lower and upper bounds for variables
   indices = list(self.sets['investments'])
   self.lowerBounds = self.setBounds(self.lowerBounds, indices, 'lowerBounds')
   self.upperBounds = self.setBounds(self.upperBounds, indices, 'upperBounds')
Exemplo n.º 10
0
 def addExpressions(self, model):
   """
     Add specific expressions for MCKP problems
     @ In, model, pyomo model instance, pyomo abstract model
     @ Out, model, pyomo model instance, pyomo abstract model
   """
   model = ModelBase.addExpressions(self, model)
   model.firstStageCost = pyomo.Expression(rule=self.computeFirstStageCost)
   model.secondStageCost = pyomo.Expression(rule=self.computeSecondStageCost)
   return model