LuisFerrolho
LuisFerrolho

Reputation: 417

GLPK - Minimize a variable value

I'm working in virtual network embedding, and I'm creating a model with glpk to embed the networks. I have this following objective function:

minimize cost: sum{(i,j) in VEdges} sum{u in SNodes, v in SNodes} weight[u,v] * fw[i,j,u,v] * secSupEdge[u,v] + sum{u in SNodes, v in SNodes} r[u,v] * secSupEdge[u,v];

Then I have the following two restrictions (among others)

s.t. relConst2{(i,j) in VEdges, u in AllNodes, v in AllNodes}: bwDem[i,j] * phiw[i,j,u,v] >= fw[i,j,u,v];

s.t. linkSecConst0{(i,j) in VEdges, u in SNodes, v in SNodes}: phiw[i,j,u,v] * secDemEdge[i,j] <= secSupEdge[u,v];

"phiw" is a binary variable

"fw" and "r" are variables that take any value >= 0

all the others ("weight", "bwDem", "secDemEdges", "secSupEdge") are just params

I want to relate phiw with fw. When fw > 0, phiw should take the value 1. When fw == 0, phiw should take the value 0.

Normally it does what I want, but sometimes phiw takes the value 1 when fw has the value 0, which is not what I want. This happens because the restrictions are met:

Example 1:

s.t. relConst2: 4 * 1 >= 0

s.t. linkSecConst0: 1 * 2 <= 2

Is there a way to minimize the value of phiw variable but not putting it in the objective function? Or putting it in the objective function but not changing the value of the result neither the value of all other variables?

Upvotes: 1

Views: 470

Answers (1)

amsiix
amsiix

Reputation: 1

The question is about minimizing phiw, however, the description of the problem suggests that what you want to do is link the values of phiw and fw, and specifically to have phiw = 1 when fw > 0, and phiw = 0 otherwise (i.e., fw = 0).

I would suggest that you add constraint that directly maps the conditional on fw to the value of phiw, such as:

s.t. LinkConstraint { (i,j) in VEdges, u in AllNodes, v in AllNodes }: if fw[i,j,u,v] > 0 then 1 else 0 = phiw[i,j,u,v] ;

Upvotes: 0

Related Questions