I am trying to solve robust model using Gamma robusteness. However, when I define the constraint that is dependent on the randon variable using 'forall(random_Set) I keep getting syntax error even though in the guide it was used the same way. What am I missing???
I appreciate your help
def robust(r):
"""
The function robust implements the robust optimiztion model,
given the budget of uncertainty r
"""
model = ro.Model('robust')
#decision variables
Pimp = model.dvar()
Pexp = model.dvar()
Bch = model.dvar(n)
Bdis = model.dvar(n)
SoE = model.dvar(n)
b = model.dvar(1, 'B')
c = model.dvar(n, 'B')
#define the uncertain/random variable
Pprod = model.rvar(n)
#Define the uncertainty set
Pprod_set = (abs(Pprod) <= 1, rso.norm(Pprod, 1) <= r)
model.min(PriceImp*Pimp - PriceEx * Pexp)
#Constraints
model.st((sum(Pprod) - sum(Pcons) - sum(Bch) + sum(Bdis) + Pimp - Pexp) == 0).forall(Pprod_set)) # constraint (1)
model.st(Pimp <= (1-b) * UB_x ) #constraint (2) x <= (1-b) * UB_x ,y <= b * UB_y
model.st(Pexp <= b * UB_y )
model.st(Pimp>=0)
model.st(Pexp>=0)
other constraints
model.solve(grb, display=False) # disable solution message
return model.get(), Pimp.get(), Pexp.get() # the optimal objective and solution
I am trying to solve robust model using Gamma robusteness. However, when I define the constraint that is dependent on the randon variable using 'forall(random_Set) I keep getting syntax error even though in the guide it was used the same way. What am I missing??? I appreciate your help
def robust(r): """ The function robust implements the robust optimiztion model, given the budget of uncertainty r """
other constraints