Assign numbers to letters with respect to lowest graph peaks
This smells like it might be hard (e.g., NP-hard).

Therefore, I suggest solving it with a SAT solver.  SAT solvers implement a number of clever optimizations.  Rather than trying to devise custom optimizations for this specific problem, you might try using an off-the-shelf SAT solver: that might be a much more efficient use of your time.  In particular, here's what I would try.  I would formulate the problem as follows:

Input: a string $S$ with $n$ unique letters, an integer $d$

Question: is there an assignment that maps each letter to a different number in $\{1,2,\dots,n\}$, such that any pair of adjacent letters are mapped to numbers that differ by at most $d$?

You can then formulate this as a SAT instance, in a fairly straightforward way.  For instance, you can use a one-hot encoding: introduce boolean variables $x_{c,j}$, where $x_{c,j}=$ True means that the letter $c$ is mapped to the number $j$.  Now if letters $c,c'$ are adjacent in the string $S$, you get a constraint $\bigvee_{|j-j'|\le d} (x_{c,j} \land x_{c',j'})$.  You also get constraints forcing different letters to map to different numbers.

Finally, throw this to an off-the-shelf SAT solver.  If it finds a solution, you know that distance $d$ is achievable.  Otherwise, it's not: distance $d$ is unattainable.  You can now iterate over $d=1$, $d=2$, $d=3$, etc., until you get the first solution.  (You can also try binary search, but I suspect it might be less efficient.)

This doesn't account for peaks, because I couldn't understand your definition of the peak stuff.