I have an adjacency matrix $G_{i,j}$ that tells the distance between $i$ to $j$ (between 0 to 1) if there is no edge between $i$ to $j$ I am putting a large integer $100$.
This is my previous question related to it.
I am trying to linearize the following equation:
$s$ is the starting point, $e$ is the ending point.
$$\text{time}_j = \sum_i b_{i,j}\times \text{time}_i + G_{i, j} $$
My linearization is:
\begin{align}\text{time}_s&= 3.0\\\text{time}_j&\geq\text{time}_i + G_{i, j} - M \times(1 - b_{i, j})\\\text{time}_j&\leq\text{time}_i + G_{i, j}\\\text{time}_j&\geq 0\\\text{time}_j&\leq M \times b_{i, j}\end{align}
Value of $M$ is also $100$. Solver can't find the solution for this. If I remove the last 3 equations from linearization it finds the solution but for some node value of $\text{time}_j$ reaches to limit value $M$.
After the answer of @prubin: \begin{align} \text{time}_s&= 3.0\\ \text{time}_j&\geq\text{time}_i + G_{i, j} - M \times(1 - b_{i, j})\\ \text{time}_j&\leq\text{time}_i + G_{i, j} + M \times(1 - b_{i, j})\\ \text{time}_j&\geq 0\\ \end{align}
The value of $time_j$ is depending on $time_i$ and $b_{i,j}$ I can only decide whether value of $time_j$ is $0$ or dependent on $time_i$ when I have seen value of all $i$ in $b_{i,j}$ i.e, $time_j$ = 0 if $\sum _i b_{i,j} = 0$ otherwise it is $time_j = time_i + G_{i, j}$ if $\sum_i b_{i,j} = 1$ now the important thing to note here is that same $i$ should be used in $time_i$ for which $b_{i,j} = 1$
Now with the above two equations, I iterate through all values of $i$ and if it is $b_{i,j} = 0$ range of $time_j$ is $[-M, +M]$ whenever I find the $b_{i,j} = 1$ value of $time_j = time_i + G_{i, j}$ which is correct.
The problem is that when I don't find any $i$ for which $b_{i,j} = 1$ i.e., $\sum_i b_{i,j} = 0$ in that case the value range of $time_j$ is still $[-M, +M]$ but due to third equation it becomes $[0, +M]$.
My question is how that can be brought to the range $[0,0]$ if $\sum_i b_{i,j} = 0$
Update:
\begin{align} \text{time}_s&= 3.0\\ \text{time}_j&\geq\text{time}_i + G_{i, j} - M \times(1 - b_{i, j})\\ \text{time}_j&\leq\text{time}_i + G_{i, j} + M \times(1 - b_{i, j})\\ \text{time}_j&\geq 0\\ \text{time}_j&\leq M \times \sum_i b_{i,j}\\ \end{align}