# JuMP: print constraint evaluated with start\_values of variables

**URL:** <https://discourse.julialang.org/t/jump-print-constraint-evaluated-with-start-values-of-variables/127752>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [April 5, 2025, 11:49pm UTC](https://discourse.julialang.org/t/jump-print-constraint-evaluated-with-start-values-of-variables/127752 "2025-04-05T23:49:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lamont](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lamont/32/27486_2.png) [@lamont](https://discourse.julialang.org/u/lamont)\
**Post date:** [April 5, 2025, 11:49pm UTC](https://discourse.julialang.org/t/jump-print-constraint-evaluated-with-start-values-of-variables/127752/1 "2025-04-05T23:49:33Z")

</div>

I’ve got a moderately complicated model that I’m trying to display the infeasibility of the start point via code that looks like:

```julia
    @constraint(model, dyn1, 0 == X1 - Ba * V1 - Xa1 .* ones(N))
    @constraint(model, dyn2, 0 == (t1 - t0) / 2 * F1 - V1)
    @constraint(model, dyn3, 0 == Xa1 + wB' * V1 - Xb1)
    display(start_value(dyn1))
    display(start_value(dyn2))
    display(start_value(dyn3))

```

I just get three lines of literally “nothing” printed out. I’m expecting a bunch of matrices that would hopefully be filled with values near zero. From the docs, it looks like you can assign a start\_value directly on a constraint, which is what that is presumably printing (I don’t want that, so haven’t set that). If I do e.g. `display(dyn1)` I get a large symbolic expression composed of all my variables, and my variables should all have starting values. How do I push those starting values through the constraint expression and print it out?

---

<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 6, 2025, 12:21am UTC](https://discourse.julialang.org/t/jump-print-constraint-evaluated-with-start-values-of-variables/127752/2 "2025-04-06T00:21:31Z")

</div>

I think you’re looking for:

```Julia
julia> model = Model()
A JuMP Model
├ solver: none
├ objective_sense: FEASIBILITY_SENSE
├ num_variables: 0
├ num_constraints: 0
└ Names registered in the model: none

julia> @variable(model, x, start = 1)
x

julia> @constraint(model, c1, x >= 0)
c1 : x ≥ 0

julia> @constraint(model, c2, 2 * x <= -1)
c2 : 2 x ≤ -1

julia> primal_feasibility_report(start_value, model)
Dict{Any, Float64} with 1 entry:
  c2 : 2 x ≤ -1 => 3.0

```

You could also do

```julia
julia> value(start_value, c2)
2.0

```

which gets the primal value of `c2` using `start_value` for the variables.

---

<div class="post-metadata">

**Author:** ![lamont](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lamont/32/27486_2.png) [@lamont](https://discourse.julialang.org/u/lamont)\
**Post date:** [April 6, 2025, 12:34am UTC](https://discourse.julialang.org/t/jump-print-constraint-evaluated-with-start-values-of-variables/127752/3 "2025-04-06T00:34:08Z")

</div>

Thanks, both of those look like they work, but the primal\_infeasibility\_report() is a bit harder to read. Using `display(value(start_value, dyn1))` gives me all the zeros I was looking for, though.

---

<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 6, 2025, 7:55am UTC](https://discourse.julialang.org/t/jump-print-constraint-evaluated-with-start-values-of-variables/127752/4 "2025-04-06T07:55:18Z")

</div>

> [@lamont](#):
>
> the primal\_infeasibility\_report() is a bit harder to read

The return value is a dictionary, so it’s intended to be iterated over, rather than pretty printing. You could do something like:

```julia
julia> for (k, v) in primal_feasibility_report(start_value, model)
           println("Constraint $(name(k)) is infeasible by $v")
           println("The primal value is ", value(start_value, k))
       end
Constraint c2 is infeasible by 3.0
The primal value is 2.0

```
