Working on an optimization problem formulated using the well known assignment problem. My decision variable is defined as follows :
$$\alpha _{x}^{r,u} = 1\begin{cases} & \text{ 1 if } \mathbf{VM}\: \mathbf{u}\; of\; request \: \boldsymbol{r}\; is\; assigned\; to\; server\; \mathbf{x}\\ & \text{ 0 } otherwise \end{cases} \\\\ $$ $$V_{r}\; is\; the\; of\; VMs,\; V_{p}\; is\; the\; of\; servers, R\;is\;the\;set\;of\;requests$$
The complete model is defined as wit the relevant constraints : $$Min \sum_{r}\sum_{x}\sum_{u} Cost(u,x)\ast \alpha _{x}^{r,u}$$ $Subjet\;to$ $$\sum_{x}\alpha _{x}^{r,u} = 1\; \; \; \; \; \; \; \; \; \; \; \; \; \forall u\in V_{r},\forall r\in R \;\;\;\;\;\;\;\;\;\;(1)$$ $$\alpha _{x}^{r,u} \in [0,1]\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;(2)$$
A request r is composed of a set of VMs and for some reasons (security, performance, reliability) some VMs of a request r has to be put together within the same server if the resources are available, I define this as affinity constraint. Mathematically, I defined it as : $$ \sum_{u}\alpha _{x}^{r,u} = Cardinality(\varphi^{r})\; \; \; \; \; \; \; \; \; \; \; \; \; \forall x\in V_{p},\forall r\in V_{r},\forall u\in \varphi^{r} , \varphi^{r}\subseteq V_{r}$$ I implemented the constraint within my model using Gurobi but the model is infeasible and I am wondering why it does not work wether it is related to the way I formulated it or other reason I am not aware of.
Another way to define the affinity constraint might be using the form of if A then B
in the following way : If a given VM $u$ belonging to the affinity set say AffinitySet={VM1, VM2, VM3} then all the VMs within that set has to be put within the server x. However, I am not sure how to model this constraint mathematically.
Will appreciate any help, thanks.