This paper deals with the problem of retrieving the optimal path between two points inside an unknown environment, utilizing a robot-scouter. The vast majority of the path planning frameworks for an unknown environment focuses on the problem of navigating a robot, as soon as possible, towards a pre-specified location. As a result, the final followed path between the start and end location is not necessarily the optimal one, as the objective of the robot at each timestamp is to minimize its current distance to the desirable location. However, there are several real-life applications, like the one formulated in this paper, where the robot-scouter has to find the minimum path between two positions in an unknown environment, which is going to be used in a future phase. In principle, the optimal path can be guaranteed by a searching agent that adopts an A∗-like decision mechanism. In this paper, we propose a specifically-tailored variation (CIA∗) of the A∗ algorithm to the problem in hand. CIA∗ inherits the A∗ optimality and efficiency guarantees, while at the same time exploits the learnt formation of the obstacles, to on-line revise the heuristic evaluation of the candidate states. As reported in the simulation results, CIA∗ achieves an enhancement in the range of 20-50%, over the typical A∗, on the cells that have to be visited to guarantee the optimal path construction. An open-source implementation of the proposed algorithm along with a Matlab GUI are available<sup>1</sup>.