# Why getting Infeasibility row despite it is not!?

**URL:** <https://discourse.julialang.org/t/why-getting-infeasibility-row-despite-it-is-not/97305>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, optimization\
**Created:** [April 10, 2023, 2:22pm UTC](https://discourse.julialang.org/t/why-getting-infeasibility-row-despite-it-is-not/97305 "2023-04-10T14:22:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Optimization](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/optimization/32/32462_2.png) [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Post date:** [April 10, 2023, 2:22pm UTC](https://discourse.julialang.org/t/why-getting-infeasibility-row-despite-it-is-not/97305/1 "2023-04-10T14:22:06Z")

</div>

I have a basic vehicle routing problem (VRP) model that I aim to solve using CPLEX and JuMP. Although I manually verified that the problem configuration(including the number of customers, drivers, locations, and costs) is feasible, the JuMP solver generates an Infeasibility row " `ERROR: syntax: extra token "row" after end of expression`" which corresponds to one of the routing constraints that require every individual to reach their destination, Mathematically

`sum(x[i,j,d] for (i,j,d) if (j==destination[d]) == 1) for all d`.

The output displays an associated equation in JuMP forms is:

`Destination_constraints["6d"] Destination_constraints["6d"]: x[(5, 2,"6d")] + x[(8, 2, "6d")] + x[(11, 2, "6d")] + x[(3, 2, "6d")] == 1.0`  
where `"6d"` is the id of the one of the drivers. Clearly, the LHS indicates three decision variables that can take a value of one, and the RHS is one. But it show the error of:

```julia
julia> Infeasibility row 'Destination_constraints["6d"]': 0 = 1.
ERROR: syntax: extra token "row" after end of expression
Stacktrace:
 [1] top-level scope
   @ none:1

```

I ran it for a number of other instances and there was no issue. What could be the problem here , and how can it be resolved?

---

<div class="post-metadata">

**Author:** ![barucden](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/barucden/32/26154_2.png) [@barucden](https://discourse.julialang.org/u/barucden)\
**Post date:** [April 10, 2023, 4:01pm UTC](https://discourse.julialang.org/t/why-getting-infeasibility-row-despite-it-is-not/97305/2 "2023-04-10T16:01:27Z")

</div>

You are getting a syntax error.

It looks that you are pasting the string `Infeasibility row 'Destination_constraints["6d"]': 0 = 1.` into the Julia REPL. This is not a valid Julia code so you are getting a syntax error.

---

<div class="post-metadata">

**Author:** ![Optimization](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/optimization/32/32462_2.png) [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Post date:** [April 10, 2023, 4:12pm UTC](https://discourse.julialang.org/t/why-getting-infeasibility-row-despite-it-is-not/97305/3 "2023-04-10T16:12:29Z")

</div>

@barucden I’m almost sure that the code and syntx is a valid one. It’s the following and it has no error with other instances.

```julia
@constraint(model, Destination_constraints[d in Dset], sum(x[(i, j, d)] for (i, j, d) in Edge_set[d] if j== Destination[d]) ==1)

```

where the `Edge_set` is a dict that nap every `d` to a list of tuples in form `(i,j,d)`  
similarly Destination is a dict that nap every `d` to destination node, and Dset is a list of all of taxi-drivers.

---

<div class="post-metadata">

**Author:** ![barucden](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/barucden/32/26154_2.png) [@barucden](https://discourse.julialang.org/u/barucden)\
**Post date:** [April 10, 2023, 4:26pm UTC](https://discourse.julialang.org/t/why-getting-infeasibility-row-despite-it-is-not/97305/4 "2023-04-10T16:26:41Z")

</div>

You are mixing two things.

One is that no solution has been found for your optimization task. I don’t know how to solve that, it might be useful to see the whole program.

Another is that you are seeing a syntax error, which has nothing to do with JuMP or your optimization task. Based on your first post:

> [@Optimization](#):
>
> ```julia
> julia> Infeasibility row 'Destination_constraints["6d"]': 0 = 1.
> ERROR: syntax: extra token "row" after end of expression
> Stacktrace:
> [1] top-level scope
> @ none:1
> 
> ```

it appears that you ran an invalid Julia code (`Infeasibility row 'Destination_constraints["6d"]': 0 = 1.`) in the REPL so you see the syntax error. Perhaps you did not mean to do that.

---

<div class="post-metadata">

**Author:** ![Optimization](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/optimization/32/32462_2.png) [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Post date:** [April 10, 2023, 7:21pm UTC](https://discourse.julialang.org/t/why-getting-infeasibility-row-despite-it-is-not/97305/5 "2023-04-10T19:21:46Z")

</div>

> [@barucden](#):
>
> Another is that you are seeing a syntax error, which has nothing to do with JuMP or your optimization task. Based on your first post:

Do you have any suggestion to debug it? I honestly have no idea why for “6d” I cannot see a solution but excluding this one and working with for example “1d”, “2d”,…“205d” has an optimal solution.  
What is exaclty confusing for me is that is return `0==1` and by `0` it means the LHS of the relevant constraints which is `Destination_constraints["6d"]` which is the same as `: x[(5, 2,"6d")] + x[(8, 2, "6d")] + x[(11, 2, "6d")] + x[(3, 2, "6d")] ` becomes zero. But Ido not see any conflict between having a value of one for any of the variable above (like `x[(5, 2,"6d")] `) and the rest of the solutions.

Any idea for debug would be appreciated 🙂

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [April 10, 2023, 8:24pm UTC](https://discourse.julialang.org/t/why-getting-infeasibility-row-despite-it-is-not/97305/6 "2023-04-10T20:24:43Z")

</div>

Can you provide a reproducible example? The `0 == 1` constraint suggests that you have a constraint for which

```julia
@constraint(model, Destination_constraints[d in Dset], sum(x[(i, j, d)] for (i, j, d) in Edge_set[d] if j== Destination[d]) ==1)

```

is empty on the left-hand side.

---

<div class="post-metadata">

**Author:** ![Optimization](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/optimization/32/32462_2.png) [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Post date:** [April 10, 2023, 9:55pm UTC](https://discourse.julialang.org/t/why-getting-infeasibility-row-despite-it-is-not/97305/7 "2023-04-10T21:55:08Z")

</div>

Thanks@odow, I have attempted to create a small, reproducible instance of the problem but have been unsuccessful. Interestingly, in the equation that I was working with, the left-hand-side was not empty. Specifically, it was of the form Destination\_constraints[“6d”] Destination\_constraints[“6d”]: x[(5, 2,“6d”)] + x[(8, 2, “6d”)] + x[(11, 2, “6d”)] + x[(3, 2, “6d”)] == 1.0.

Not sure but after isolating just “6d” and examination of related constraints, it appears that one of the constraints has an inappropriate Big-M value, which is causing a conflict. But what this has do with non-empty LHS is ambigious part of it.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [April 10, 2023, 10:12pm UTC](https://discourse.julialang.org/t/why-getting-infeasibility-row-despite-it-is-not/97305/8 "2023-04-10T22:12:09Z")

</div>

> I have attempted to create a small, reproducible instance of the problem but have been unsuccessful

See the tips here: [Debugging · JuMP](https://jump.dev/JuMP.jl/stable/tutorials/getting_started/debugging/#Debugging-an-infeasible-model)

The general method is to solve your problem. Double check it’s infeasible. Comment out a constraint. Re-solve. Etc.

For example you could try

```julia
# @constraint(model, Destination_constraints[d in Dset], sum(x[(i, j, d)] for (i, j, d) in Edge_set[d] if j== Destination[d]) ==1)
@constraint(model, Destination_constraints[d in ["6d"]], sum(x[(i, j, d)] for (i, j, d) in Edge_set[d] if j== Destination[d]) ==1)

```

It that’s still infeasible, keep going. If not, then the problem is elsewhere, and the error message from CPLEX is misleading.

It might be that CPLEX has presolved out some variables, and the error is coming from the presolved version of the model, not the original model that you input.
