X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-live.git;a=blobdiff_plain;f=yarrg%2Frsvalue.c;fp=yarrg%2Frsvalue.c;h=f046c99a896c56ee753a9430144ebd99b6fe7857;hp=f1a8d224cab316a116012ff74b41c45d09704560;hb=0145dc7f4fcaf62090a77fb2d69d5d7807c8d48d;hpb=22f2c2e0c21461f4a5e78b9735bf6395cb7a367f diff --git a/yarrg/rsvalue.c b/yarrg/rsvalue.c index f1a8d22..f046c99 100644 --- a/yarrg/rsvalue.c +++ b/yarrg/rsvalue.c @@ -32,7 +32,6 @@ typedef struct { TradesBlock *trades; } IslandPair; -int nislands; IslandPair ***ipairs; /* ipairs[sislandid][dislandid] */ typedef struct IslandTradeEnd { @@ -108,7 +107,7 @@ static int setup_leg_constraints(double max_thing, int legs, const char *wh) { int leg, startrow; if (max_thing < 0 || !legs) return -1; startrow= lpx_add_rows(lp, legs); - for (leg=0; legdst_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, unit_profit); @@ -325,17 +323,21 @@ assert(unit_profit < 1e6); next_s:; } /* for (s) */ - if (DEBUGP(lp)) - lpx_write_cpxlp(lp, (char*)"/dev/stdout"); + double profit= 0; - int ipr= lpx_interior(lp); - assert(ipr==LPX_E_OK); + if (lpx_get_num_cols(lp)) { + if (DEBUGP(lp)) + lpx_write_cpxlp(lp, (char*)DEBUG_DEV); - if (DEBUGP(lp)) - lpx_print_ips(lp, (char*)"/dev/stdout"); + int ipr= lpx_interior(lp); + assert(ipr==LPX_E_OK); - assert(lpx_ipt_status(lp) == LPX_T_OPT); - double profit= lpx_ipt_obj_val(lp); + if (DEBUGP(lp)) + lpx_print_ips(lp, (char*)DEBUG_DEV); + + assert(lpx_ipt_status(lp) == LPX_T_OPT); + profit= lpx_ipt_obj_val(lp); + } lpx_delete_prob(lp); lp= 0; @@ -347,9 +349,6 @@ void setup_value(void) { sqlite3_stmt *sst; int i; - nislands= sql_single_int("SELECT max(islandid) FROM islands") + 1; - debugf("VALUE nislands=%d\n",nislands); - commodstablesz= sql_single_int("SELECT max(commodid) FROM commods") + 1; commodstable= mmalloc(sizeof(*commodstable)*commodstablesz); for (i=0; i