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


Groups > comp.lang.python > #72830

Re: Having trouble in expressing constraints in Python

Newsgroups comp.lang.python
Date 2014-06-06 03:38 -0700
References <1919ef6f-6aed-4b03-a9b1-ac9e2a2b31a7@googlegroups.com>
Message-ID <71ca41c5-65be-4523-9d59-02c2ddce7fb0@googlegroups.com> (permalink)
Subject Re: Having trouble in expressing constraints in Python
From varun7rs@gmail.com

Show all headers | View raw


Thanks a lot Ian. Your post helped me understand the problem in a much better way and I've solved the first objective thanks to you but incase of my second objective which is 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. Thsi 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?

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Having trouble in expressing constraints in Python varun7rs@gmail.com - 2014-06-03 06:44 -0700
  Re: Having trouble in expressing constraints in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-06-03 16:15 +0100
    Re: Having trouble in expressing constraints in Python varun7rs@gmail.com - 2014-06-03 14:31 -0700
  Re: Having trouble in expressing constraints in Python Chris Angelico <rosuav@gmail.com> - 2014-06-04 01:19 +1000
  Re: Having trouble in expressing constraints in Python Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-04 01:18 -0600
  Re: Having trouble in expressing constraints in Python varun7rs@gmail.com - 2014-06-06 03:38 -0700

csiph-web