Optimization of Multi-Valued Multi-Level Networks