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 (which includes standard probability courses up to MSc level Electrical Engineering and PhD courses signal processing).

---

In technical terms what I am interested to do: 
I am looking for an algorithm to find the parameters for a distribution having the cumulative distribution function $F$ satisfying $$F(x\_k) = c\_k$$ for some prescribed pairs $$(x\_k,c\_k) \,,\,k \in \{1,2,\cdots,n\}$$ or in terms of the probability density function $f$: $$\int\_{-\infty}^{x\_k} f(t) dt=c\_k$$If these are not solvable exactly, the algorithm should strive to minimize the error in some suitable way. (Maybe to develop / derive this error minimization procedure is where efforts should be spent?)

---

To give a simple example the method I am searching for if we had a uniform distribution prescribed $50\%$ at $x=1$ and $100\%$ at $x=2$ the output should be the uniform distribution with density function constant $0.5$ on the interval $x\in [0,2]$ and $0$ everywhere else.

If we are searching for a normal distribution then prescribing the $50\%$ percentile then our method should lock in our parameter $\mu$ (as median and mean are the same for the normal distributions).