Path planning is an important research topic in the autonomous robot applications. In this paper, a path is obtained by optimizing a cost function which is composed of the costs of the path length and the desired behavior. It is assumed that the desired behavior of the robot is the wall following with obstacle avoidance. First, a map of an operational environment is constructed. The cost of the desired behavior can then be assigned for the map. After that, a path can be obtained based on the behavior cost and the path length to the target. In order to operate on a fine grid map with an acceptable computation time, a multi-resolution scheme is used to acquire the optimal path. Initially, a path is obtained on a coarse resolution. Then the final path on the original fine resolution can be found within a band containing the initial path. Simulation results show that the proposed approach can find the optimal path efficiently.