From: Leo L. <le...@si...> - 2009-04-11 21:31:01
|
Hi Folks, After a long absence, I tried to add another class to my swig-based interface to Coin-OR, and am stumped by why passing vectors works in one example and not on the other. I get an error regarding the number of arguments, which is correct. Google has been some help, but not enough to crack the problem. The function that works is: --- class OsiCbcSolverInterface { public: virtual void loadProblem(const int numcols, const int numrows, const CoinBigIndex * start, const int* index, const double* value, const double* collb, const double* colub, const double* obj, const double* rowlb, const double* rowub) ; }; --- The function that doesn't is: --- class CoinPackedVector{ public: virtual void setFull(int size, const double * elems, bool testForDuplicateIndex = false); }; --- The text below is the use case. Following it is the output: --- import osi cbc = osi.OsiCbcSolverInterface() inf = 1000 m,n = 3,2 c, lb, ub = [3,2], [0,0], [inf,inf] start, index, val= [0,3,5], [0,1,2,0,1], [2,1,1,1,1] lhs, rhs= [-inf,-inf,-inf],[100,80,40] cbc.loadProblem(n,m,start,index,val,lb,ub,c,lhs,rhs) cpv = osi.CoinPackedVector() cpv.setFull(3,[1,2,3]) --- [user@host swimpy]$ python swigBugUseCase Traceback (most recent call last): File "swigBugUseCase", line 10, in <module> cpv.setFull(3,[1,2,3]) File "/home/leolopes/research/poams/code/swimpy/osi.py", line 257, in setFull def setFull(*args): return _osi.CoinPackedVector_setFull(*args) NotImplementedError: Wrong number of arguments for overloaded function 'CoinPackedVector_setFull'. Possible C/C++ prototypes are: setFull(CoinPackedVector *,int,double const *,bool) setFull(CoinPackedVector *,int,double const *) --- The libraries I am trying to wrap are part of Coin-OR. Here is a link to the doxygen corresponding to the classes: http://www.coin-or.org/Doxygen/Osi/class_osi_solver_interface.html http://www.coin-or.org/Doxygen/Osi/class_coin_packed_vector.html I have also attached three files: a paired down version of the .i that contains only the two offending functions; the Makefile I use; and the use case above. Please let me know if anyone can help or if there is any other piece of information I can provide. Thanks in advance! Leo. -- ======================================================================== Leonardo B. Lopes Assistant Professor SIE - University of Arizona (520)621-2342 le...@si... http://www.sie.arizona.edu/faculty/leolopes |