Decision vs Optimisation Problem in P
Let us consider a generic optimization problem:

Maximize $f(x)$ subject to the constraint $x \in \mathcal{D}$.

The corresponding decision version is

Given $\mathcal{D}$ and $T$, is there $x \in \mathcal{D}$ such that $f(x) \geq T$?

In most cases, the range of $f(x)$ is at most exponential in the description length of $\mathcal{D}$, and so the optimization problem reduces to the decision version via binary search. For example, if $0 \leq f(x) \leq n$, then we first ask whether there is a solution with $f(x) \geq n/2$; depending on the answer, we ask whether there is a solution with $f(x) \geq n/4$ (if the answer was negative) or with $f(x) \geq 3n/4$ (if the answer was positive); and so on.
Conversely, if we can solve the optimization problem then we can easily answer the decision problem, and so the two are essentially equivalent.