chiark / gitweb /
Use GLPK's simplex solver instead
[ypp-sc-tools.main.git] / yarrg / rsvalue.c
index da7dbaf232bca44c85d733f5cd8830215a044f1f..f86731923f873524a80e7446600f9d4a0f1f9694 100644 (file)
@@ -143,7 +143,7 @@ static IslandPair *ipair_get(int si, int di) {
   ip->ntrades= 0;
   ip->trades= 0;
   int inblock= TRADES_PER_BLOCK;
-  TradesBlock *block= 0;
+  TradesBlock *block=0, **tail=&ip->trades;
 
   debugf("VALUE ipair_get(%d,%d) running...\n", si,di);
   SQL_MUST( sqlite3_bind_int(ss_ipair_dist, 1, si) );
@@ -159,8 +159,9 @@ static IslandPair *ipair_get(int si, int di) {
   while (SQL_STEP(ss_ipair_trades)) {
     if (inblock == TRADES_PER_BLOCK) {
       block= mmalloc(sizeof(*block));
-      block->next= ip->trades;
-      ip->trades= block;
+      block->next= 0;
+      *tail= block;
+      tail= &block->next;
       inblock= 0;
     }
     int *irp, i;
@@ -312,14 +313,15 @@ double value_route(int nislands, const int *islands) {
     if (DEBUGP(lp))
       lpx_write_cpxlp(lp, (char*)DEBUG_DEV);
 
-    int ipr= lpx_interior(lp);
+    int ipr= lpx_simplex(lp);
     assert(ipr==LPX_E_OK);
 
     if (DEBUGP(lp))
-      lpx_print_ips(lp, (char*)DEBUG_DEV);
+      lpx_print_sol(lp, (char*)DEBUG_DEV);
 
-    assert(lpx_ipt_status(lp) == LPX_T_OPT);
-    profit= lpx_ipt_obj_val(lp);
+    int lpst= lpx_get_status(lp);
+    assert(lpst == LPX_OPT);
+    profit= lpx_get_obj_val(lp);
   }
 
   lpx_delete_prob(lp);