# MethodError: no method matching similar\_array\_type

**URL:** https://discourse.julialang.org/t/methoderror-no-method-matching-similar-array-type/57154
**Category:** General Usage
**Created:** [March 15, 2021, 1:03am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-similar-array-type/57154 "2021-03-15T01:03:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![javiera\_vergara](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/javiera_vergara/32/20083_2.png) [@javiera\_vergara](https://discourse.julialang.org/u/javiera_vergara)
#### Post date: [March 15, 2021, 1:03am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-similar-array-type/57154/1 "2021-03-15T01:03:59Z")

</div>

Hi there,

I am running my code and have the following error:

MethodError: no method matching similar\_array\_type(::Type{JuMP.Containers.DenseAxisArray{VariableRef,1,Tuple{UnitRange{Int64}},Tuple{Dict{Int64,Int64}}}}, ::Type{GenericAffExpr{Float64,VariableRef}})  
Closest candidates are:  
similar\_array\_type(::Type{LinearAlgebra.Symmetric{T,MT}}, ::Type{S}) where {S, T, MT} at /Users/Javi/.julia/packages/MutableArithmetics/bPWR4/src/linear\_algebra.jl:137  
similar\_array\_type(::Type{Array{T,N}}, ::Type{S}) where {S, T, N} at /Users/Javi/.julia/packages/MutableArithmetics/bPWR4/src/linear\_algebra.jl:141  
similar\_array\_type(::Type{var"#s17"} where var"#s17"\<:Union{LinearAlgebra.Adjoint{T,A}, LinearAlgebra.Transpose{T,A}}, ::Type{S}) where {S, T, A} at /Users/Javi/.julia/packages/MutableArithmetics/bPWR4/src/linear\_algebra.jl:353  
…

Stacktrace:  
[1] promote\_operation(::typeof(\*), ::Type{Int64}, ::Type{JuMP.Containers.DenseAxisArray{VariableRef,1,Tuple{UnitRange{Int64}},Tuple{Dict{Int64,Int64}}}}) at /Users/Javi/.julia/packages/MutableArithmetics/bPWR4/src/linear\_algebra.jl:156  
[2] promote\_operation(::typeof(MutableArithmetics.sub\_mul), ::Type{T} where T, ::Type{T} where T, ::Type{T} where T) at /Users/Javi/.julia/packages/MutableArithmetics/bPWR4/src/shortcuts.jl:53  
[3] mutability(::Type{T} where T, ::Function, ::Type{T} where T, ::Type{T} where T, ::Type{T} where T) at /Users/Javi/.julia/packages/MutableArithmetics/bPWR4/src/interface.jl:154  
[4] mutability(::GenericAffExpr{Float64,VariableRef}, ::Function, ::GenericAffExpr{Float64,VariableRef}, ::Int64, ::JuMP.Containers.DenseAxisArray{VariableRef,1,Tuple{UnitRange{Int64}},Tuple{Dict{Int64,Int64}}}) at /Users/Javi/.julia/packages/MutableArithmetics/bPWR4/src/interface.jl:160  
[5] operate!(::typeof(MutableArithmetics.sub\_mul), ::GenericAffExpr{Float64,VariableRef}, ::Int64, ::JuMP.Containers.DenseAxisArray{VariableRef,1,Tuple{UnitRange{Int64}},Tuple{Dict{Int64,Int64}}}) at /Users/Javi/.julia/packages/MutableArithmetics/bPWR4/src/rewrite.jl:80  
[6] macro expansion at /Users/Javi/.julia/packages/MutableArithmetics/bPWR4/src/rewrite.jl:276 [inlined]  
[7] macro expansion at /Users/Javi/.julia/packages/JuMP/y5vgk/src/macros.jl:447 [inlined]  
[8] top-level scope at ./In[60]:43  
[9] include\_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091

The problem occurs with this constraint: [@constraint] (m, p\_gen[t]-p\_load[t]+epsilon\<=M\*z\_excess), p\_gen is a continuos variable, z\_excess a binary variable, p\_load is data from a csv

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [March 15, 2021, 9:15am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-similar-array-type/57154/2 "2021-03-15T09:15:52Z")

</div>

Welcome to the Julia community!

It would be much easier to help with a minimal code example that reproduces your problem.

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …
