X-Received: by 10.182.109.231 with SMTP id hv7mr1091827obb.2.1401280883439; Wed, 28 May 2014 05:41:23 -0700 (PDT) X-Received: by 10.140.38.199 with SMTP id t65mr33930qgt.17.1401280883330; Wed, 28 May 2014 05:41:23 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!c1no19081225igq.0!news-out.google.com!gi6ni15574igc.0!nntp.google.com!hl10no6758832igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.python Date: Wed, 28 May 2014 05:41:23 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=134.109.4.107; posting-account=8TkBGgoAAAAujQCaKU4bU2rJUYDVARhu NNTP-Posting-Host: 134.109.4.107 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <103633e5-26be-4b53-a8c4-e2ca8c41b103@googlegroups.com> Subject: Unable to figure out ' invalid matrix input type -- ', u'1' From: varun7rs@gmail.com Injection-Date: Wed, 28 May 2014 12:41:23 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: csiph.com comp.lang.python:72157 Hello Everyone,=20 I am currently working on Cplex using Python API. I have a problem when I r= un the code. I keep getting this error about the invalid matrix input but I= 'm not able to figure out what it is. I would be grateful if any of you cou= ld help. My function is as below def add_constraint(self, variables, coefficients, sense, rhs, name): self.prob.linear_constraints.add( lin_expr =3D [[ variables, coefficients ]], senses =3D [sense], rhs =3D [rhs], names =3D [name] ) Traceback (most recent call last): File "RW10.py", line 569, in main(sys.argv[1:]) File "RW10.py", line 562, in main solveVNEProblem( phy_network, demands, args.output) File "RW10.py", line 116, in solveVNEProblem solver.add_constraint( varNames, varCoeffs, "E", 1.0, "Location_Constra= ints1{}".format( demand.demandID ) ) File "RW10.py", line 26, in add_constraint names =3D [name] ) File "/opt/ibm/ILOG/CPLEX_Studio125/cplex/python/x86-64_sles10_4.1/cplex/= _internal/_subinterfaces.py", line 1187, in add rmat =3D _C_HBMatrix(lin_expr, self._cplex._env_lp_ptr, 0, self._env.pa= rameters.read.apiencoding.get()) File "/opt/ibm/ILOG/CPLEX_Studio125/cplex/python/x86-64_sles10_4.1/cplex/= _internal/_matrices.py", line 74, in __init__ raise TypeError(" invalid matrix input type -- ", self._mat[0]) TypeError: (' invalid matrix input type -- ', u'1') Thank You