Abstract. The degree of locality of a program re ects the level of temporal and spatial concentration of related data and computations. Locality optimization can speed up programs by reducing the communication costs. A possible human approach to locality optimization is to consider several small program instances of a given program, nd optimal or close to optimal mappings of data and computations for the program instances, and generalize them to the program. This paper suggests the use of this approach in a semi-automatic locality optimization method. Emphasis is given to the phase of optimizing the program instances. We introduce a fuzzy objective function that re ects the degree of locality of a program instance, and show its advantages over a crisp function such as communicationcosts. We provide a framework for applying several optimization techniques and describe an implementation that uses local search. The paper refers to a two-level memory hierarchy.