  We present a numerical method to compute the optimal maintenance time for a
complex dynamic system applied to an example of maintenance of a metallic
structure subject to corrosion. An arbitrarily early intervention may be
uselessly costly, but a late one may lead to a partial/complete failure of the
system, which has to be avoided. One must therefore find a balance between
these too simple maintenance policies. To achieve this aim, we model the system
by a stochastic hybrid process. The maintenance problem thus corresponds to an
optimal stopping problem. We propose a numerical method to solve the optimal
stopping problem and optimize the maintenance time for this kind of processes.
