Approaching behavior with acceleration and unlimited velocity

I'm encountering a difficult programming/math/geometry problem. I think it's best to ask here, but I could be wrong, if so please let me know where you think it might be better suited.

I'd have a time-step based motion system that tries to minimize the time spent in transit between two objects, but with the caveat that there is constant acceleration during the trip, and now friction. This is for a space ship moving between two stationary planets.

The basic flow is that it accelerates up until the moment it is at the exact midpoint, and then it decelerates the rest of the time. The problem is that at any given step (an "hour") all I know is my current velocity, and the angle and distance to the target. Given that information, how can I tell if I should A) Accelerate for an hour, B) Decelerate for an hour, or C) some combination of both over the course of an hour?

Separate from that problem, if I'm traveling at an angle X, and the angle to my target is Y, how can I determine how much of my given hour must I spend fixing my trajectory, and at what angle do I accelerate to fix that, before resorting to a normal approach.

I have a page of algebra and geometry based on angles and the kinematic equations, but it keeps messing up and I'm not sure if it's my implementation or my math.