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 860409e41a99ea0e6a7a06f3ed4b756344f6c3fe..d068fa02ba25a040eae556ebb3b278519f67a76e 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;
 
 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*/
 
 #endif /*RSCOMMON_H*/
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);
        }
 
          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_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);
        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);
        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 3e4083f556e636a9c3b2e42500e8f099ef6c9edb..c3fc6388a4b353fb1da2adb52465e5f9bdb97037 100644 (file)
@@ -1,5 +1,5 @@
 file routesearch
 file routesearch
-set args 34 36
+set args -1 -1 -1 0 34 36 34 36
 break value_route
 run
 finish
 break value_route
 run
 finish