I have a squarewave implemented like so:
function sqw(t; period::Float64=1, duty::Float64=0.5)
return t % period < duty*period ? 1.0 : 0.0
end
I am running an InfiniteOpt.jl optimization where I pass in sqw
as a parameter and call it with an infinite parameter:
@infinite_parameter(model, t ∈ [0, T], num_supports = n)
@constraint(model, ∂(x, t) == sqw(t))
I get the error
MethodError: no method matching rem(::InfiniteOpt.GeneralVariableRef, ::Float64)
Clearly, the rem
has not been implemented for InfiniteOpt
So I have two options:
- find another way to model the signal
- implement
rem
for theGeneralVariableRef
If #1 is do-able in a InfiniteOpt.jl compatible way, I would love to hear suggestions.
Otherwise, how can I get started on #2?