We consider a wireless relay network in a Rayleigh fading scenario where transmission power as well as transmission time per user are optimized. The criterion of optimization is the capacity. We apply an optimization algorithm based on Brent's method. Hence, we employ parabolic interpolation for finding the optimum whenever possible in order to achieve a faster convergence. If parabolic interpolation is not suitable, we use golden section search which is a robust root-finding method. Optimization takes place in two steps. First, we optimize power allocation and consider time as parameter. Second, time is optimized. We demonstrate that, depending on the cooperation strategy, remarkable capacity gains over direct transmission can be achieved by multi-routing. However, for a high overall transmission power, direct transmission outperforms multi-hopping. Generally, capacity gains increase with decreasing overall system power, which demonstrates that relaying is beneficial for low overall transmission powers.