def addVariables(self, model): """ Add variables for DROMCKP problems @ In, model, pyomo model instance, pyomo abstract model @ Out, model, pyomo model instance, pyomo abstract model """ model = MCKP.addVariables(self, model) # variables for robust optimization model.gamma = pyomo.Var(within=pyomo.NonNegativeReals) ## the following two definitions are not equivalent for mckp, not sure why? ## From the definition of dual problem, nu should be non-negative model.nu = pyomo.Var(model.sigma, within=pyomo.NonNegativeReals) # model.nu = pyomo.Var(model.sigma) return model
def addVariables(self, model): """ Add variables for CVaRMCKP problems @ In, model, pyomo model instance, pyomo abstract model @ Out, model, pyomo model instance, pyomo abstract model """ model = MCKP.addVariables(self, model) # variables for CVaR optimization model.nu = pyomo.Var(domain=pyomo.NonNegativeReals) model.u = pyomo.Var(domain=pyomo.Reals) # variables to retrieve additional information model.cvar = pyomo.Var(domain=pyomo.Reals) model.expectProfit = pyomo.Var(domain=pyomo.Reals) return model