Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'api.': 0.05; '__init__': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'senses': 0.09; 'python': 0.11; 'def': 0.12; 'language.': 0.14; 'demands,': 0.16; 'name):': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'rhs': 0.16; 'sense,': 0.16; 'subject:type': 0.16; 'typeerror:': 0.16; 'variables,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'everyone,': 0.19; 'help.': 0.21; 'input': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; '---': 0.24; 'skip:" 30': 0.26; 'skip:_ 20': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'raise': 0.29; "i'm": 0.30; 'getting': 0.31; 'file': 0.32; 'figure': 0.32; 'run': 0.32; '(most': 0.33; 'guess': 0.33; 'could': 0.34; 'problem': 0.35; 'skip:s 30': 0.35; 'but': 0.35; 'add': 0.35; 'grateful': 0.36; "i'll": 0.36; 'should': 0.36; 'thank': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'is.': 0.60; 'free': 0.61; 'viruses': 0.61; 'email addr:gmail.com': 0.63; 'protection': 0.63; 'our': 0.64; '26,': 0.68; 'antivirus': 0.68; 'invalid': 0.68; '74,': 0.84; '[name]': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Unable to figure out ' invalid matrix input type -- ', u'1' Date: Wed, 28 May 2014 15:30:40 +0100 References: <103633e5-26be-4b53-a8c4-e2ca8c41b103@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-78-147-30-130.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: <103633e5-26be-4b53-a8c4-e2ca8c41b103@googlegroups.com> X-Antivirus: avast! (VPS 140528-0, 28/05/2014), Outbound message X-Antivirus-Status: Clean X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 46 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1401287427 news.xs4all.nl 2970 [2001:888:2000:d::a6]:60360 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72166 On 28/05/2014 13:41, varun7rs@gmail.com wrote: > Hello Everyone, > > I am currently working on Cplex using Python API. I have a problem when I run 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 could help. My function is as below > > def add_constraint(self, variables, coefficients, sense, rhs, name): > self.prob.linear_constraints.add( > lin_expr = [[ variables, coefficients ]], > senses = [sense], > rhs = [rhs], > names = [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_Constraints1{}".format( demand.demandID ) ) > File "RW10.py", line 26, in add_constraint > names = [name] ) > File "/opt/ibm/ILOG/CPLEX_Studio125/cplex/python/x86-64_sles10_4.1/cplex/_internal/_subinterfaces.py", line 1187, in add > rmat = _C_HBMatrix(lin_expr, self._cplex._env_lp_ptr, 0, self._env.parameters.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 > I don't know but I'll guess that should be a letter l and not the number 1. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com