For the high end-to-end channel capacity, the amplify-and-forward scheme multiple-hop MIMO relays system is considered. The distance between each transceiver is optimized to prevent some relays from being the bottleneck and guarantee the high end-to-end channel capacity. However, in some cases, the location of relays can't be set at the desired location, the transmit power of each relay should be optimized. Additionally, in order to achieve the higher end-to-end channel capacity, the distance and the transmit power are optimized simultaneously. The authors propose the Markov Chain Monte Carlo method to optimize both the distance and the transmit power in complex propagation environments.