Skip to content

Gadget3 & RTMB #252

@lentinj

Description

@lentinj

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions