Some Stochastic Optimization Problems in Reinsurance and Insurance