def createZSVariables(self): numVars = 0 # the z variable is for each scenario for scenario in self.scenarios: # create zsp variable v1 = Variable() v1.type = Variable.v_zsp v1.name = "zsp_" + scenario.id v1.col = self.numCols v1.scenario = scenario.id self.variables[v1.name] = v1 self.lp.variables.add(names=[v1.name]) self.numCols += 1 numVars += 1 #create zsn variable v2 = Variable() v2.type = Variable.v_zsn v2.name = "zsn_" + scenario.id v2.col = self.numCols v2.scenario = scenario.id self.variables[v2.name] = v2 self.lp.variables.add(names=[v2.name]) self.numCols += 1 numVars += 1 return numVars
def createStockVariable(self): numVars = 0 # the s variables are for each scenario and for each t of current horizon for scenario in self.scenarios: for t in range(self.currentDay, self.finalDay): # create the variable v = Variable() v.type = Variable.v_stock v.name = "s_" + scenario.id + "_" + str(t) v.col = self.numCols v.instant = t v.scenario = scenario.id self.variables[v.name] = v self.lp.variables.add(names=[v.name]) self.numCols += 1 numVars += 1 return numVars