This paper addresses optimal motion for general machines. Approximation for optimal motion needs a global path planning algorithm that precisely calculates the whole dynamics of a machine in a brief calculation. We propose a path planning algorithm that is composed of a path searching algorithm and a pruning algorithm. The pruning algorithm is based on our analysis for the resemblances of states. To confirm the precision, calculation cost, optimality, and applicability of the proposed algorithm, we conducted several shortest time path planning examinations for the dynamic models of double inverted pendulums. The precision to reach the goal state of the pendulums was better than other algorithms. The calculation was at least 58 times faster. There was a positive correlation between the optimality and the resolutions of the proposed algorithm. As a result of torque based feedback control simulation, we confirmed applicability of the proposed algorithm under noisy situation.