Optimización de red con programación lineal: Maximizando el rendimiento con restricciones de capacidad

Enviado por Chuletator online y clasificado en Informática y Telecomunicaciones

Escrito el en español con un tamaño de 1,88 KB

for (Demand d : netPlan.getDemands())
{
List shortestPath = GraphUtils.getShortestPath(netPlan.getNodes(),
netPlan.getLinks(), d.getIngressNode(), d.getEgressNode(), null);
if (shortestPath.isEmpty()) throw new Net2PlanException("kk");
netPlan.addRoute(d, 0, 0, shortestPath, null);
}

Optimización del problema

OptimizationProblem op = new OptimizationProblem();

Variables de decisión

final int D = netPlan.getNumberOfDemands();
op.addDecisionVariable("h_d", false, new int [] {1, D}, 0, Double.MAX_VALUE);

Función objetivo

final double [] propDelay_d = netPlan.getVectorDemandWorseCasePropagationTimeInMs().toArray();
double [] z_d = new double[D];
for (int d = 0; d < D; d++)
z_d [d] = -3 / (2 * Math.pow(propDelay_d [d] * 2, 2));
op.setInputParameter("z_d", z_d, "row");
op.setObjectiveFunction("maximize", "sum (z_d ./ h_d)");

Restricciones

Restricciones de enlace

for (Link e : netPlan.getLinks())
{
op.setInputParameter("P_e", NetPlan.getIndexes(e.getTraversingRoutes()), "row");
op.setInputParameter("u_e", e.getCapacity());
op.addConstraint("sum(h_d(P_e)) <= u_e");
}

Solución

op.solve("ipopt");
if (!op.solutionIsOptimal()) throw new Net2PlanException("An optimal solution was not found");
double [] h_d = op.getPrimalSolution("h_d").to1DArray();

Guardar la solución

for (Route r : netPlan.getRoutes())
{
final double traf = h_d [r.getIndex()];
r.setCarriedTraffic(traf, traf);
r.getDemand().setOfferedTraffic(traf);
}
return "Ok! Total throughput: " + netPlan.getDemandTotalOfferedTraffic();
}

Entradas relacionadas: