Closed EdwinMeriaux closed 9 months ago
@EdwinMeriaux Random variables are different from decision variables - they do not get a numeric value as a solution When you convert E to a decision variable then your problem is no longer linear nor convex A problem with variables multiplication (E*B) is a bilinear problem as pointed out by the error message
So there is no way to get the value from the Random Variable?
Hi @EdwinMeriaux There is no direct way to retrieve the worst-case values of random variables, but you can solve the robust optimization problem first, then define a new model that 1) the original decision variables are fixed to be their optimal solutions, and 2) the original random variables are defined to be decision variables. By solving the new model, you should be able to find one worst-case value of random variables.
This is the code I am running:
model = ro.Model('LP model') # Create a Model object B = model.dvar() # Define a decision variable x E = model.rvar() # Define a decision variable y
model.maxmin(8BE ,E<=1,E>=0)
model.st(B <= 1) # Specify the 1st constraint model.st(B >= 0) # Specify the 2nd constraint
print("b: ",B.get()) print("e: ",E.get())
It throws an error because E is not a decision variable so I cannot pull the value of E. Is there anyway to do this? I really would like to know how get both the values in the maxmin cases.
If I try to make both B and E dvars then I get the error: TypeError: Bi-linear expressions are not supported.
is there anyway around this?