Having trouble in expressing constraints in Python

varun7rs at gmail.com varun7rs at gmail.com
Fri Jun 6 06:38:57 EDT 2014


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?



More information about the Python-list mailing list