Forum Discussion
FICO
8 years agoCommunity Manager
Is it possible that the XPRESS c-libraries can be called directly from Python using ctypes?
I have successfully called a C dll from Python (using ctypes) that calls XPRMInit, XPRMloadmod etc but it would be nice to avoid the need to create the DLL altogether and call these functions direc...
FICO
8 years agoCommunity Manager
In xprm_rt.h, the XPRMmodel type is defined as follows:
typedef struct Model* XPRMmodel;
This means, that it is a pointer to a struct. In ctypes, use the void pointer c_void_p to represent that pointer. By default, ctypes assumes that the result type of a function is a c_int. You have to change it to c_void_p. Moreover, you have to set the function argument types to the c type that represents "char *": c_char_p.
lib.XPRMloadmod.restype = c_void_p
lib.XPRMloadmod.argtypes = [c_char_p, c_char_p]
Now you can call the function as follows, assuming that bname and intname are normal Python strings:
mod = lib.XPRMloadmod(bname.encode(), intname.encode())
I am preparing an example and will attach it to this thread, when it is finished.
Related Content
Related Content
Hi, Currently we are working with Blaze v7.6, if we want to move to DM, Do we need to migrate to latest blaze(v7.10.) first and then to DM? or directly to DM? If to DM directly, existing DTs, Other templates can we reuse? OR need to create from scratch?
If we can move to DM directly, existing DTs, Other templates in the project can we reuse? OR need to create everything from scratch as per the DM standards?6Views0likes1CommentIs it possible to count all possible Solutions of a Problem?
I wondered wether its possible to either get the number of all possible solutions of a problem or to actually block a solution after an optimization (in my case its minimize an IP) is done to search ...1 year agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum3 unread comments3 unread1View0likes3CommentsIs it possible to output the used solving algorithm?
I'm usually working with Xpress Workbench or the optimizer via bash on Linux. Out of curiosity I compared its performances with the Xpress IVE 64bit and there I noticed the statistics tab with detail...1 year agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum6 unread comments6 unread0Views0likes6Comments