, dCdm, dMds, dSds, dCds, dMdp] = policy.fcn(policy, m, s);
    df = dMdp;
end
f = M;

function [f, df] = conT7(p, policy, m, s)
policy.p = p;
if nargout < 2
    [M, S] = policy.fcn(policy, m, s);
else
    [M, S, C, dMdm, dSdm, dCdm, dMds, dSds, dCds, dMdp, dSdp] = policy.fcn(policy, m, s);
    df = dSdp;
end
f = S;

function [f, df] = conT8(p, policy, m, s)
policy.p = p;
if nargout < 2
    [M, S, C] = policy.fcn(policy, m, s);
else
    [M, S, C, dMdm, dSdm, dCdm, dMds, dSds, dCds, dMdp, dSdp, dCdp] = ...
 