Many species of animals, plants, cyanobacteria, and fungi are reported to have circadian clocks, that is, gene regulatory and biochemical network in a cell exhibiting endogenous oscillatory dynamics with a period close to 24 hours. There is diversity in the members of the circadian system, but all clocks share similar features such as temperature-compensated circadian period. Therefore, theoretical studies on a general (and abstract) network are as important as studies focusing on a specific network found in each species. Previous simulation studies using evolutionary algorithm have established a method to obtain networks that follow an autonomously oscillating dynamics. In those simulations the degree of deviation from the demanded period was defined as the cost function to be minimized by the optimization process because natural selection apparently favours a clock with a certain period, namely, 24 hours. However, if the ultimate goal is to implement the 24-hour period, it may be easier and more reliable to refer to external cues such as sunlight. Indeed, the circadian clocks are reported to have sensitivity to the light signal, and their phases are adjusted by sunlight. In addition, empirical studies have suggested that the circadian clocks play more sophisticated roles such as predicting timing of the next dawn (respectively, the next dusk) and preparing molecules required during the day (resp. during night) in advance. In the present study, we first examine the effect of sunlight as an external oscillator represented by a binary function (1 = light; 0 = dark). We compare the proportions of regulatory networks that exhibit and do not exhibit an oscillation autonomously (i.e., without the external force) among those oscillating with the same period as the external force. We also found that even the non-autonomous oscillators have an adaptive feature of the day-length compensation, showing 24-hour oscillation regardless of the proportion of the light period. Next, we introduce a novel cost function that reflects the merit of predicting future, and report shared features of networks optimized based on this cost function.