This question became quite a mess because of unclarities and need to edit several times, so I made a new one over here. Please do not answer this question but go to the updated one instead.
I am aware of many methods in statistics to optimize with respect to moments like mean $\mu$ and variance $\sigma^2$, but which methods exist to optimize with respect to a given median $(50\%)$ or more general case $x\%$ percentile? I don't remember it being treated in any literature I have read.
Edit: Clarification. The intent was to ask about methods which estimate the parameters of parametric distributions given the position of the prescribed percentiles. For a trivial example a uniform distribution prescribed $50\%$ at $x=1$ and $100\%$ at $x=2$ would be the uniform distribution with density function constant $0.5$ on the interval $x\in [0,2]$ and $0$ everywhere else.
Edit 2
Ok I will try rephrase again. How to find the parameters for a distribution having the cumulative distribution function $F$ satisfying $F(x_k) = c_k$ for some $n$ prescribed pairs $(x_k,c_k)$, $k \in \{1,2,\cdots,n\}$ or in terms of density function $f$: $\int_{-\infty}^{x_k} f(t) dt=c_k$. Or if not solvable, to minimize the error in some suitable way. (Maybe this error minimization procedure is where efforts should be spent?)
Not sure what you mean by "optimize with respect to." An obvious way to estimate the population median, sometimes denoted $\eta,$ is to find the sample median, sometimes denoted $H.$
For many symmetrical distributions, the population mean $\mu$ is the same as the population median $\eta.$ Then the 'best' estimator of $\eta$ from a sample $X_1, X_2, \dots, X_n$ may be the sample mean $\bar X.$ An example is a normal distribution. The unbiased estimator of the 'center' $\mu = \eta$ with the smallest variance is $\bar X.$
However, the Laplace (double exponential) distribution is also symmetrical and the best estimator of the center $\mu = \eta$ is the sample median $H.$
Also, there are cases in which neither $\bar X$ nor $H$ is best. An example is uniform distributions of the form $\mathsf{Unif}(0, \theta),$ for which the center is $\mu = \eta = \theta/2.$ An unbiased estimator of $\theta$ is $\hat \theta = \frac{n+1}{n}X_{(n)} = \max X_i.$ Then the best estimator of the center is $\hat \theta/2.$
There are even some useful symmetrical distributions that do not have a population mean $\mu,$ and so one may use the median $\eta$ as the center and try to estimate it by $H$. An example is Student's t distribution with one degree of freedom.
Finally, there are distributions in which $\mu \ne \eta,$ such as the family of gamma distributions, including the exponential. For these, it may be best to use $\bar X$ to estimate $\mu,$ find the relationship between $\mu$ and $\eta,$ and modify the estimator of $\mu$ to get an estimator of $\eta.$
In a mathematical statistics course one important topic of discussion is methods of finding optimal estimators for various parameters. This is not the place for a full discussion. If you can say something about your background in statistics and the situation(s) in which you want to estimate population medians and quantiles, perhaps I or someone else can give an answer targeted on your primary interests.