chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.web-live.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
WIP routesearch: trade value; before separate query for qties
[ypp-sc-tools.web-live.git]
/
yarrg
/
rsvalue.c
diff --git
a/yarrg/rsvalue.c
b/yarrg/rsvalue.c
index 9cc9ec757987ce9230380ab02381bed496a1d5f3..ad301b0b135fe13cb6602800c54208d3c39583fb 100644
(file)
--- a/
yarrg/rsvalue.c
+++ b/
yarrg/rsvalue.c
@@
-108,6
+108,7
@@
static int setup_leg_constraints(double max_thing, int legs, const char *wh) {
static void add_leg_c(int startrow, int leg, double value) {
if (startrow<=0) return;
static void add_leg_c(int startrow, int leg, double value) {
if (startrow<=0) return;
+ assert(value > 0);
add_constraint(startrow+leg, value);
}
add_constraint(startrow+leg, value);
}
@@
-243,6
+244,7
@@
void value_route(int nislands, const int *islands) {
if (islands[already_d] == di)
/* visited this island already since we left s, uninteresting */
goto next_d;
if (islands[already_d] == di)
/* visited this island already since we left s, uninteresting */
goto next_d;
+
if (d>s && di==si)
/* route has returned to si, no need to think more about s */
goto next_s;
if (d>s && di==si)
/* route has returned to si, no need to think more about s */
goto next_s;
@@
-252,6
+254,9
@@
void value_route(int nislands, const int *islands) {
IslandPair *ip= ipair_get(islands[s], islands[d]);
TradesBlock *block= ip->trades;
int tradestodo= ip->ntrades;
IslandPair *ip= ipair_get(islands[s], islands[d]);
TradesBlock *block= ip->trades;
int tradestodo= ip->ntrades;
+ if (!tradestodo)
+ goto next_d;
+
int inblock= 0;
int col= lpx_add_cols(lp,ip->ntrades);
int inblock= 0;
int col= lpx_add_cols(lp,ip->ntrades);