AnsweredAssumed Answered

Python API - creating or updating variable bounds without a loop

Question asked by nicolas.winc on Feb 2, 2018
Latest reply on Feb 2, 2018 by nicolas.winc

Hi,

 

When I create a vector of variables in the Python API, is there a way to use numpy and hence avoid the for loop? Please see an example below: I could totally have ub and lb in vectors.

 

x = np.array ([xp.var(lb=-xp.infinity,ub=xp.infinity, vartype=xp.continuous) for i in range(A_ub.shape[1])])

 

Also if I want to update the bounds in an existing problem, is there a way without looping through the variable vector? smtg like replace ub by a new ub vector.

 

Many Thanks,

Nicolas

Outcomes