#define N 10 #define DEMAND 5000 #define FEE 3000.0 continuous Y[N]; continuous X[N],Z; double cap[N],cost[N]; int node_cnt; int solu_cnt; data() { cap = { 700, 1000, 1000, 1000, 400, 500, 4700, 9930, 3440, 7550 }; cost = { 18.0, 18.5, 20.0, 20.0, 14.0, 17.5, 22.0, 27.5, 24.5, 23.8 }; } basic_constraints() { and(int j=0;j= DEMAND; and(int j=0;j 0; // Supplier used ? then scratch = scratch + FEE; // then pay fee Z <= scratch; // A bluff for branch-and-bound printf("quick_and_dirty yields a cost of %f",scratch); } enforce(int i) { either { node_cnt = node_cnt +1; Y[i] == 1.0; } or { node_cnt = node_cnt +1; X[i] == 0; Y[i] == 0.0; } } #define fail 0==1 determine_first_pair(int & bv) { and(int i=0;i 0.0; wp(Y[i]) < 1.0; } then { bv = i; return; } fail; } search() { int bv; and(;;){ min: Z; if determine_first_pair(bv); then enforce(bv); // New version else break; } } output() { and(int i=0;i