The problem is tackled of the allocation of the resources assigned for
upgrading an ensemble of buildings or other constructed facilities, w
hose seismic reliability is not considered sufficient. The resources a
re allocated in order to minimize the predicted value of either the ec
onomic losses, the number of endangered persons or the risk of severan
ce of a network. The optimization procedure, although formulated in ge
neral terms, is illustrated with reference to simple examples, in whic
h realistic values are attributed to the relevant parameters. These ex
amples refer to masonry buildings, whose damages can be summed with ea
ch other to obtain the total damage of the ensemble, and to a highway
network, whose critical elements are reinforced concrete bridges. The
presence of several discrete quantities and discontinuous relationship
s requires the use of specific algorithms, and in particular of dynami
c programming.