How to use time-dependant parameters in InfiniteOpt

At a guess, you might need:

function u(c, t; k = k)
    InfiniteOpt.ifelse(t < tswitch, mult1 * -(c - k)^2, mult2 * -(c - k)^2)
end

This is not particularly well documented.

I got there by recognizing that we probably wanted ifelse(t < tswitch, ...), and then I got an error WARNING: both InfiniteOpt and Base export "ifelse"; uses of it in module Main must be qualified that pointed me to InfiniteOpt.ifelse.

cc @pulsipher.

1 Like