  Benchmarks in the utility function have various interpretations, including
performance guarantees and risk constraints in fund contracts and reference
levels in cumulative prospect theory. In most literature, benchmarks are a
deterministic constant or a fraction of the underlying wealth variable; thus,
the utility is also a function of the wealth. In this paper, we propose a
general framework of state-dependent utility optimization with stochastic
benchmark variables, which includes stochastic reference levels as typical
examples. We provide the optimal solution(s) and investigate the issues of
well-definedness, feasibility, finiteness, and attainability. The major
difficulties include: (i) various reasons for the non-existence of the Lagrange
multiplier and corresponding results on the optimal solution; (ii)
measurability issues of the concavification of a state-dependent utility and
the selection of the optimal solutions. Finally, we show how to apply the
framework to solve some constrained utility optimization problems with
state-dependent performance and risk benchmarks as some nontrivial examples.
