Forum Discussion
FICO
5 years agoCommunity Manager
Storing python xp.constraint objects in numpy arrays or pandas Series
We would like to store a list of xpress xp.constraint objects in a pandas Series. We have found that the xp.constraint objects cannot be stored in numpy arrays or pandas Series. Here is example cod...
FICO
5 years agoCommunity Manager
I cannot replicate that behavior, the code you submitted runs fine on two platforms: Mac (pandas 1.2.0 and numpy 1.19.5) and Linux (pandas 1.2.2 and numpy 1.20.1) using xpress 8.12. Can you provide more details on the pandas and numpy (and xpress) versions you are using?
Note that as of version 8.9 we introduced a dtype for numpy arrays of constraints, and it's called xpress.npconstraint. So the declaration of the numpy array should be
a = np.array(ctl, dtype=xp.npconstraint)This could then be added as a pandas series, which accepts numpy arrays.
Related Content
Related Content
How to apply termination conditions to each objective function in multi-objective model
Hello everyone, I am implementing a multi-objective model in Python, and I would like to set a time limit for each objective function. It would be best if I could set different time limits for each,...1 year agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum4 unread comments4 unread3Views0likes4CommentsVariable object mapping issue in Python Callbacks with Presolve enabled
Hi, I am implementing a Branch-and-Cut algorithm using the Xpress Python interface. I have structured my code as a class where I create variables (using xp.var) and store them in a dictionary attrib...9 months agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum6 unread comments6 unread6Views0likes6Comments