chiark / gitweb /
Can compute route value
[ypp-sc-tools.db-live.git] / yarrg / rsvalue.c
index 135583ed1720ac2dd4556afedabf9c97d9df9df5..f1a8d224cab316a116012ff74b41c45d09704560 100644 (file)
@@ -299,11 +299,15 @@ double value_route(int nislands, const int *islands) {
          add_leg_c(capi_constraints, leg, t->src_price);
        }
 
+       double unit_profit= (t->dst_price - t->src_price) * loss_factor;
+       debugf("    unit profit %f\n", unit_profit);
+assert(unit_profit < 1e6);
+
        lpx_set_col_bnds(lp, col, LPX_LO, 0, 0);
-       lpx_set_obj_coef(lp, col,
-                        (t->dst_price - t->src_price) * loss_factor);
+       lpx_set_obj_coef(lp, col, unit_profit);
        lpx_set_mat_col(lp, col, nconstraint_rows,
                        constraint_rows, constraint_coeffs);
+
        if (DEBUGP(value)) {
          char *name= masprintf("c%d_p%d_%d_p%d_%d",
                                t->commodid, s, t->src_price, d, t->dst_price);