You can try and make a RTMB objective function with:
tmb_map <- lapply(parameters[parameters$optimise == FALSE & parameters$random == FALSE, 'switch'], function (n) {
factor(rep(NA, length(parameters[n, 'value'][[1]])))
})
names(tmb_map) <- parameters[parameters$optimise == FALSE & parameters$random == FALSE, 'switch']
RTMB::TapeConfig(comparison = "tape") # We do things like "if (lik_weight > 0)"
obj.rfun <- RTMB::MakeADFun(g3_to_r(full_actions), parameters$value, map = tmb_map)
...but get rapidly scuppered with:
Error in if (cur_time > total_steps) return(nll) :
missing value where TRUE/FALSE needed
I'm presuming that RTMB is trying to differentiate cur_time or total_steps, which is an obviously silly thing to do.
You can try and make a RTMB objective function with:
...but get rapidly scuppered with:
I'm presuming that RTMB is trying to differentiate
cur_timeortotal_steps, which is an obviously silly thing to do.