Type safe cost model