Is this sort of a constraint implementable in Python?

varun7rs at gmail.com varun7rs at gmail.com
Tue Jun 10 05:12:38 EDT 2014


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



More information about the Python-list mailing list