# Array variable - matrix multplication in JuMP

**URL:** <https://discourse.julialang.org/t/array-variable-matrix-multplication-in-jump/49801>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [November 8, 2020, 7:57pm UTC](https://discourse.julialang.org/t/array-variable-matrix-multplication-in-jump/49801 "2020-11-08T19:57:02Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![shashankchahar](https://avatars.discourse-cdn.com/v4/letter/s/ee59a6/32.png) [@shashankchahar](https://discourse.julialang.org/u/shashankchahar)\
**Post date:** [November 9, 2020, 1:12pm UTC](https://discourse.julialang.org/t/array-variable-matrix-multplication-in-jump/49801/3 "2020-11-09T13:12:30Z")

</div>

Hi,

Thanks @odow, I will remember about the screenshots in future.

Re:

@constraint(model, [t = 1:30], x \* y[:, t] .== y[:, t + 1])

I think I get the idea. Shouldn’t y be the same size as x on the first two dimensions and 1:31 on the third dimension?

I will try the following:

```julia
model = Model()
@variable(model, 0 <= x[1:8, 1:8] <= 1)
@variable(model, y[1:8, 1:8, 1:31])
@constraint(model, first_t, y[:, :, 1] .== x[:, :]) # I think this is needed
@constraint(model, [t = 1:30], x * y[:, :, t] .== y[:, :, t + 1])

```

Then, I can set my objective to be based on y.

Let me try this out. Thanks!

---

_[View the full topic](https://discourse.julialang.org/t/array-variable-matrix-multplication-in-jump/49801)._
