I am trying some performance experimentation using the CPLEX Python API and found that most of the CPLEX row or column updates are via sparse pair or sparse triplets. On large matrices ( millions of columns), it just gets too slow.
I am looking for more efficient ways (equivalent of int CPXaddcols(CPXENVptr env,CPXLPptr lp,int ccnt,int nzcnt,double *obj,int *cmatbeg,int *cmatind,double *cmatval, double *lb, double *ub,char **colname)
from Callable Library)
I found the methods to be in the cplex._internal._procedural
, but could not really call it successfully.
Anyone used CPLEX Python for large scale LP? Any one used the addcols(env, lp, ccnt, nzcnt, obj, cmat, lb, ub, colname, enc=default_encoding)
method in python cplex?
Any help is highly appreciated.
Thanks
Code
import cplex
import os
WORKDIR = "data1"
filename = "matrix1.prefix.LP"
os.chdir(WORKDIR)
problem = cplex.Cplex(filename)
theEnv = problem._env
theLP = problem._lp
returnCols = cplex._proc.getcols(theEnv, theLP, 0,10)
print( returnCols)
Output
File "C:/TSWork/Misc/Calendar_Year_2018/Experiments/MtrxDnst/CPX_Proc_V1.py", line 15, in returnCols = cplex._proc.getcols(theEnv, theLP, 0,10)
File "C:\Software\Anaconda3\envs\cplex\lib\site-packages\cplex_internal_procedural.py", line 861, in getcols status = CR.CPXXgetcols(env, lp, inout_list)
TypeError: in method 'CPXXgetcols', argument 1 of type 'CPXCENVptr'