InfiniteOpt.jl icon indicating copy to clipboard operation
InfiniteOpt.jl copied to clipboard

Cannot Transcribe Scalar Measures/Derivatives of Dependent Infinite Parameters

Open pulsipher opened this issue 5 years ago • 0 comments

Describe the bug Currently we support modeling of measures and derivatives that partially evaluate dependent parameter dependencies, however this cannot be transcripted in general. Fundamentally, this occurs because this produces reduced variables with partial dependent parameters and it is not clear how to reformulate this. For example, consider dependent parameters x[1:2] with supports [0 1], [1 1], [0.5 0]. Then by virtue of a measure or derivative with an infinite variable y(x) we can obtain the reduced expression: y(x[1] 0]) + y([x[1] 1]). So then the question is how would we (or does it even make sense to) transcribe this function given that x[1] is not restricted to a support and may have a different amount of possible values for each reduced variable.

To Reproduce

using InfiniteOpt, JuMP 

m = InfiniteModel()
@infinite_parameter(m, x[1:2] in [0, 1])
@infinite_variable(m, y(x))
@objective(m, Min, integral(y, x[1]))
build_optimizer_model!(m)
ERROR: Unable to locate transcription variable by support, consider rebuilding the infinite model with less significant digits. Note this might be due to partially evaluating dependent parameters which is not supported by TranscriptionOpt.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] _supp_error() at C:\Users\pulsipher\.julia\dev\InfiniteOpt\src\TranscriptionOpt\model.jl:285
 [3] get at .\dict.jl:523 [inlined]
 [4] lookup_by_support(::Model, ::GeneralVariableRef, ::Type{ReducedVariableIndex}, ::Array{Float64,1}) at C:\Users\pulsipher\.julia\dev\InfiniteOpt\src\TranscriptionOpt\model.jl:299
 [5] transcription_expression(::Model, ::GeneralVariableRef, ::Type{ReducedVariableIndex}, ::Array{Float64,1}) at C:\Users\pulsipher\.julia\dev\InfiniteOpt\src\TranscriptionOpt\transcribe.jl:300
 [6] transcription_expression(::Model, ::GeneralVariableRef, ::Array{Float64,1}) at C:\Users\pulsipher\.julia\dev\InfiniteOpt\src\TranscriptionOpt\transcribe.jl:289
 [7] macro expansion at C:\Users\pulsipher\.julia\packages\MutableArithmetics\H0Uof\src\rewrite.jl:224 [inlined]
 [8] macro expansion at C:\Users\pulsipher\.julia\packages\JuMP\MnJQc\src\macros.jl:45 [inlined]
 [9] transcription_expression(::Model, ::GenericAffExpr{Float64,GeneralVariableRef}, ::Array{Float64,1}) at C:\Users\pulsipher\.julia\dev\InfiniteOpt\src\TranscriptionOpt\transcribe.jl:336
 [10] transcribe_measures!(::Model, ::InfiniteModel) at C:\Users\pulsipher\.julia\dev\InfiniteOpt\src\TranscriptionOpt\transcribe.jl:387
 [11] build_transcription_model!(::Model, ::InfiniteModel) at C:\Users\pulsipher\.julia\dev\InfiniteOpt\src\TranscriptionOpt\transcribe.jl:618
 [12] build_optimizer_model! at C:\Users\pulsipher\.julia\dev\InfiniteOpt\src\TranscriptionOpt\optimize.jl:30 [inlined]
 [13] #build_optimizer_model!#322(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(build_optimizer_model!), ::InfiniteModel) at C:\Users\pulsipher\.julia\dev\InfiniteOpt\src\optimize.jl:532
 [14] build_optimizer_model!(::InfiniteModel) at C:\Users\pulsipher\.julia\dev\InfiniteOpt\src\optimize.jl:531
 [15] top-level scope at REPL[40]:1

Expected behavior Currently, we throw an error at transcription, but perhaps we can consider removing this capability all together to improve performance and simplicity. Or if this behavior makes sense mathematically, then perhaps we can enable TranscriptionOpt to handle this situation accordingly.

pulsipher avatar Sep 11 '20 00:09 pulsipher