X-Received: by 10.43.103.136 with SMTP id di8mr3169980icc.14.1402391559098; Tue, 10 Jun 2014 02:12:39 -0700 (PDT) X-Received: by 10.140.100.204 with SMTP id s70mr38299qge.9.1402391559038; Tue, 10 Jun 2014 02:12:39 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!h3no617272igd.0!news-out.google.com!a8ni930qaq.1!nntp.google.com!s7no152046qap.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.python Date: Tue, 10 Jun 2014 02:12:38 -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: <7d4f1623-35c1-42b5-bbbb-a4a045b60b19@googlegroups.com> Subject: Is this sort of a constraint implementable in Python? From: varun7rs@gmail.com Injection-Date: Tue, 10 Jun 2014 09:12:39 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: csiph.com comp.lang.python:73079 Hello Everyone, I'm working on a python code to input matrices into CPLEX solver. I have mo= st of my code running fine but as of now, I don't know how to express this = constraint. My objective is to minimize the number of nodes. I have got one= of the weirdest looking constraints which I don't know how to express in P= ython because python basically takes matrices and inputs them into cplex. M= y constraint is as below. This was what I wrote in AMPL minimize phy_nodes: sum {w in PHY_NODES} x_ns[w] ; s.t. Phy_nodes_Eq{w in PHY_NODES, dns in DEMAND}: x_ns[w] =3D 1 =3D=3D> x_SGW[dns, w] + x_PGW[dns, w] + x_MME[dns, w] + x_IMS= [dns, w] + x_PoP[dns, w] >=3D 1 else x_SGW[dns, w] + x_PGW[dns, w] + x_MME[dns, w] + x_IMS[dns, w] + x_PoP[= dns, w] =3D 0; Could you help me fix this problem?=20 Thank You