JuliaStochOpt / ParameterJuMP.jl

A JuMP extension to use parameter in constraints RHS
MIT License
41 stars 5 forks source link

Parametrized (in terms of type) ParametrizedAffExpr #39

Closed jd-lara closed 5 years ago

jd-lara commented 5 years ago

Currently we use this container for JuMP.AffineExpression in order to hold expressions of any type of VariableRef

const JuMPAffineExpressionArray = Matrix{JuMP.GenericAffExpr{Float64,V}} where V <: JuMP.AbstractVariableRef

However, ParameterJuMP.ParametrizedAffExpr only seems to take the type of the number and not the type of variables which leads to the defintion

const JuMPParamAffineExprArray = Matrix{ParameterJuMP.ParametrizedAffExpr{Float64}}

Is there a way to enable AbstractVariableRef parametrization in ParametrizedAffExpr{Float64,V}?

joaquimg commented 5 years ago

yes, we can change this by redefining:

mutable struct ParametrizedAffExpr{C, V} <: JuMP.AbstractJuMPScalar
    v::JuMP.GenericAffExpr{C,V}
    p::JuMP.GenericAffExpr{C,Parameter}
end

Some other parts of the code will need minor modifications

joaquimg commented 5 years ago

solved by #45