# How to build a constraint with summation?

**URL:** <https://discourse.julialang.org/t/how-to-build-a-constraint-with-summation/41618>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [June 17, 2020, 6:20pm UTC](https://discourse.julialang.org/t/how-to-build-a-constraint-with-summation/41618 "2020-06-17T18:20:39Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![chisquared](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@chisquared](https://discourse.julialang.org/u/chisquared)\
**Post date:** [June 18, 2020, 5:10pm UTC](https://discourse.julialang.org/t/how-to-build-a-constraint-with-summation/41618/10 "2020-06-18T17:10:03Z")

</div>

Try replacing your definition of `Q` with `Q = rand(79,18)` and `WH` with `WH = rand(5,18)`. Do you still get the same error?

Also, are you sure the error you’re getting isn’t something like `ERROR: LoadError: BoundsError: attempt to access 8-element Array{Int64,1} at index [1, 5]`? Note the `[1, 5]` at the end and not the `[1.5]` as you wrote in a previous post.

---

_[View the full topic](https://discourse.julialang.org/t/how-to-build-a-constraint-with-summation/41618)._
