When solving life-cycle / OLG models with both nondurable consumption and (rental) housing services, there is a standard trick that significantly reduces the dimensionality of the household’s problem: rather than treating c and d as two separate choices inside the value function, you define total non-housing-asset expenditure
cspend \equiv c + p\,d
use the budget constraint to pin down cspend, and then split cspend into c and d analytically using the intratemporal FOCs. The split has a closed form, so it can be evaluated inline inside the ReturnFn and the renter’s decision collapses to a one-dimensional choice from the toolkit’s point of view.
This is exactly what the Chen2010housing example codes do — see Chen (2010), A Life-Cycle Analysis of Social Security with Housing, Review of Economic Dynamics 13, where renters choose both c and d at the within-period stage. The same trick shows up in many other housing models with a rental margin (it is, in essence, just the textbook two-good static demand problem given a CES/Cobb-Douglas aggregator).
Below is the full derivation. The household’s period utility is the CES aggregator
u(c,d) \;=\; \frac{\big[\theta c^{\upsilon} + (1-\theta) d^{\upsilon}\big]^{(1-\sigma)/\upsilon}}{1-\sigma},
and at the within-period stage the renter solves
\max_{c,\,d}\ \ \theta c^{\upsilon} + (1-\theta) d^{\upsilon} \quad \text{s.t.}\quad c + p\,d = cspend.
The monotone transformation of the CES aggregator does not change the argmax, so we drop the outer exponent.
Lagrangian and FOCs
\mathcal{L}(c,d,\lambda) \;=\; \theta c^{\upsilon} + (1-\theta) d^{\upsilon} + \lambda\big(cspend - c - p\,d\big)
\frac{\partial \mathcal{L}}{\partial c} = 0: \qquad \theta\upsilon c^{\upsilon-1} - \lambda = 0 \tag{1}
\frac{\partial \mathcal{L}}{\partial d} = 0: \qquad (1-\theta)\upsilon d^{\upsilon-1} - \lambda p = 0 \tag{2}
\frac{\partial \mathcal{L}}{\partial \lambda} = 0: \qquad c + p\,d = cspend \tag{3}
Solve for d in terms of c
Setting (1) equal to \lambda and substituting into (2):
\theta\upsilon c^{\upsilon-1} \;=\; \lambda \;=\; \frac{1}{p}(1-\theta)\upsilon d^{\upsilon-1}
Rearrange:
p\,\frac{\theta}{1-\theta}\, c^{\upsilon-1} \;=\; d^{\upsilon-1}
\boxed{\,d \;=\; c\,\left[p\,\frac{\theta}{1-\theta}\right]^{\tfrac{1}{\upsilon-1}}\,} \tag{4}
Substitute (4) into (3) to solve for c
c + p\,c\left[p\,\frac{\theta}{1-\theta}\right]^{\tfrac{1}{\upsilon-1}} \;=\; cspend
c\left[\,1 + p \cdot p^{\tfrac{1}{\upsilon-1}}\left(\frac{\theta}{1-\theta}\right)^{\tfrac{1}{\upsilon-1}}\,\right] \;=\; cspend
Combine the powers of p using 1 + \tfrac{1}{\upsilon-1} = \tfrac{\upsilon}{\upsilon-1}:
c\left[\,1 + p^{\tfrac{\upsilon}{\upsilon-1}}\left(\frac{\theta}{1-\theta}\right)^{\tfrac{1}{\upsilon-1}}\,\right] \;=\; cspend
\boxed{\;c \;=\; \dfrac{cspend}{\,1 + p^{\tfrac{\upsilon}{\upsilon-1}}\left(\dfrac{\theta}{1-\theta}\right)^{\tfrac{1}{\upsilon-1}}\,}\;}
Then d follows directly from (4), or equivalently from the budget constraint d = (cspend - c)/p.
Cobb-Douglas special case (\upsilon \to 0)
Chen (2010) writes the utility function in CES form but calibrates \upsilon = 0, so the aggregator collapses to Cobb–Douglas c^{\theta} d^{1-\theta}. Taking \upsilon \to 0 in the formula above gives \upsilon/(\upsilon-1) \to 0 and 1/(\upsilon-1) \to -1, so
c \;=\; \frac{cspend}{1 + \tfrac{1-\theta}{\theta}} \;=\; \theta\, cspend, \qquad p\,d \;=\; (1-\theta)\, cspend.
These are the standard Cobb–Douglas expenditure shares — \theta of cspend goes to c and 1-\theta of cspend goes to rental spending p d — which is the formula actually used in the Chen2010housing ReturnFn.
How this is used in the ReturnFn
Inside the return function, you use the budget constraint to compute cspend from the state and choices (for a renter, cspend = (1+r)a + (1-\tau_p) w \kappa_j z + (1-\delta_o)h - \tau_{h,h'} + Tr + \mathbb{I}_{j\ge J_r} b - a'), then apply the closed form above to split it into c and d and plug both into the utility function. The renter’s housing-services choice d never has to appear as an explicit decision variable on a grid — it is determined analytically given cspend and the rental price p.
The full implementation is in the Chen2010housing repo.