What you also need to consider is when is peak TQ? By keeping the motor between those two peaks, you should have the most power.
You also want to not run the car to redline because, unless the HP and TQ curves show otherwise, peak HP and TQ will drop off (relatively) at that point. I know in my stock 911SC, peak hp was somewhere around 5200rpm and fell off quite abit thereafter (redline was 6250), and peak TQ was around 3700 rpm for instance.
You also dont mention what you wish to optimize? I am assuming speed/acceleration as opposed to Fuel Economy