Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73079 > unrolled thread

Is this sort of a constraint implementable in Python?

Started byvarun7rs@gmail.com
First post2014-06-10 02:12 -0700
Last post2014-06-10 13:06 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Is this sort of a constraint implementable in Python? varun7rs@gmail.com - 2014-06-10 02:12 -0700
    Re: Is this sort of a constraint implementable in Python? Gary Herron <gary.herron@islandtraining.com> - 2014-06-10 13:06 -0700

#73079 — Is this sort of a constraint implementable in Python?

Fromvarun7rs@gmail.com
Date2014-06-10 02:12 -0700
SubjectIs this sort of a constraint implementable in Python?
Message-ID<7d4f1623-35c1-42b5-bbbb-a4a045b60b19@googlegroups.com>
Hello Everyone,

I'm working on a python code to input matrices into CPLEX solver. I have most 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 Python because python basically takes matrices and inputs them into cplex. My 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] = 1 ==> x_SGW[dns, w] + x_PGW[dns, w] + x_MME[dns, w] + x_IMS[dns, w] + x_PoP[dns, w] >= 1
else x_SGW[dns, w] + x_PGW[dns, w] + x_MME[dns, w] + x_IMS[dns, w] + x_PoP[dns, w] = 0;
Could you help me fix this problem? 

Thank You

[toc] | [next] | [standalone]


#73121

FromGary Herron <gary.herron@islandtraining.com>
Date2014-06-10 13:06 -0700
Message-ID<mailman.10971.1402431103.18130.python-list@python.org>
In reply to#73079
On 06/10/2014 02:12 AM, varun7rs@gmail.com wrote:
> Hello Everyone,
>
> I'm working on a python code to input matrices into CPLEX solver. I have most 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 Python because python basically takes matrices and inputs them into cplex. My 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] = 1 ==> x_SGW[dns, w] + x_PGW[dns, w] + x_MME[dns, w] + x_IMS[dns, w] + x_PoP[dns, w] >= 1
> else x_SGW[dns, w] + x_PGW[dns, w] + x_MME[dns, w] + x_IMS[dns, w] + x_PoP[dns, w] = 0;
> Could you help me fix this problem?
>
> Thank You

This is more a CPLEX question than a Python question.  (Or rather a 
question about some Python/Cplex interface.) Do you have access to any 
kind of a CPLEX forum or a Cplex-via-Python forum?  I think that's much 
more likely to get you an answer.

Luck,
Gary Herron

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web