chiark / gitweb /
Can compute route value
authorIan Jackson <ian@liberator.(none)>
Fri, 2 Oct 2009 22:12:51 +0000 (23:12 +0100)
committerIan Jackson <ian@liberator.(none)>
Fri, 2 Oct 2009 22:12:51 +0000 (23:12 +0100)
yarrg/rscommon.h
yarrg/rsvalue.c
yarrg/x.gdb

index 860409e..d068fa0 100644 (file)
@@ -51,6 +51,6 @@ void setup_commods(void);
 extern double max_mass, max_volu, max_capi;
 extern double distance_loss_factor_per_league;
 
-#define LOSS_FACTOR_PER_DELAY_SLOT (1-1e8)
+#define LOSS_FACTOR_PER_DELAY_SLOT (1-1e-8)
 
 #endif /*RSCOMMON_H*/
index 135583e..f1a8d22 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);
index 3e4083f..c3fc638 100644 (file)
@@ -1,5 +1,5 @@
 file routesearch
-set args 34 36
+set args -1 -1 -1 0 34 36 34 36
 break value_route
 run
 finish