We consider estimation of causal effects when treatment assignment is potentially subject to unmeasured confounding, but a valid instrumental variable is available. Moreover, our models capture treatment effect heterogeneity, and we allow conditioning on an arbitrary subset of baseline covariates in estimating causal effects. We develop detailed methodology to estimate several types of quantities of interest: 1) the dose-response curve, where our parameter of interest is the projection unto a finite-dimensional working model; 2) the mean outcome under an optimal treatment regime, subject to a cost constraint; and 3) the mean outcome under an optimal intent-to-treat regime, subject to a cost constraint, in which an optimal intervention is done on the instrumental variable. These quantities have a central role for calculating and evaluating individualized treatment regimes. We use semiparametric modeling throughout and make minimal assumptions. Our estimate of the dose-response curve allows treatment to be continuous and makes slightly weaker assumptions than previous research. This work is the first to estimate the effect of an optimal treatment regime in the instrumental variables setting. For each of our parameters of interest, we establish identifiability, derive the efficient influence curve, and develop a new targeted minimum loss-based estimator (TMLE). In accordance with the TMLE methodology, these substitution estimators are asymptotically efficient and double robust. Detailed simulations confirm these desirable properties, and that our estimators can greatly outperform standard approaches. We also apply our estimator to a real dataset to estimate the effect of parents' education on their infant's health.