The potential offered by computer simulation is of- ten not realized: Due to the interaction of system vari- ables, simulation users rarely know how to choose input parameter settings that lead to optimal perfor- mance of a given system. Thus, a program called GenOpt that automatically determines optimal pa- rameter settings has been developed. GenOpt is a generic optimization program. It min- imizes an objective function with respect to multi- ple parameters. The objective function is evaluated by a simulation program that is iteratively called by GenOpt. In thermal building simulation - which is the main target of GenOpt - the simulation pro- gram usually has text-based I/O. The paper shows how GenOpt's simulation program interface allows the coupling of any simulation program with text based I/O by simply editing a configuration file, avoiding code modification of the simulation program. By us- ing object-oriented programming, a high-level inter- face for adding minimization algorithms to GenOpt's library has been developed. We show how the algo- rithm interface separates the minimization algorithms and GenOpt's kernel, which allows implementing ad- ditional algorithms without being familiar with the kernel or having to recompile it. The algorithms can access utility classes that are commonly used for min- imization, such as optimality check, line-search, etc. GenOpt has successfully solved various optimiza- tion problems in thermal building simulation. We show an example of minimizing source energy con- sumption of an office building using EnergyPlus, and of minimizing auxiliary electric energy of a solar do- mestic hot water system using TRNSYS. For both ex- amples, the time required to set up the optimization was less than one hour, and the energy savings are about , together with better daylighting usage or lower investment costs, respectively.