int Dev = 50;// Deviation
extern const int CNN = 4;// Case Index
extern const int P = 3;// Number of phases
extern const int PT = 6;// Number of periods in a phase
extern const int T = 18;// Number of periods
extern const int I1 =1;// Number of suppliers
extern const int I2 = 8;// Number of customers
extern const int I = 9;// Number of sites
extern const int BN = 72;//Number of bids
extern const int LBN = 9;//Number of bids on each arc
extern const int SPN = 349;//Number of shipments
extern const int SN = 10;//Number of scenarios at each stage
extern const int MBSN = 9;//Number of shipments in a bid
// tree parameters:
double PRO[P][SN]={{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1}}; // the probability of each scenario at each phase 
// timing parameters: 
int PTN[P]={6,6,6}; // number of periods in each phase 
int PTset[P][PT]={{0,1,2,3,4,5},{6,7,8,9,10,11},{12,13,14,15,16,17}}; // set of periods in each phase 
// distribution parameters: 
int sup[I][P][SN][PT]={{{{11089,0,0,0,0,0},{10883,0,0,0,0,0},{10297,0,0,0,0,0},{11314,0,0,0,0,0},{11426,0,0,0,0,0},{10745,0,0,0,0,0},{11176,0,0,0,0,0},{10164,0,0,0,0,0},{11126,0,0,0,0,0},{10747,0,0,0,0,0}},{{11337,0,0,0,0,0},{11026,0,0,0,0,0},{11178,0,0,0,0,0},{11129,0,0,0,0,0},{10649,0,0,0,0,0},{9632,0,0,0,0,0},{10847,0,0,0,0,0},{9906,0,0,0,0,0},{10955,0,0,0,0,0},{11099,0,0,0,0,0}},{{11600,0,0,0,0,0},{11254,0,0,0,0,0},{12070,0,0,0,0,0},{11462,0,0,0,0,0},{11122,0,0,0,0,0},{11462,0,0,0,0,0},{10675,0,0,0,0,0},{11130,0,0,0,0,0},{10881,0,0,0,0,0},{11655,0,0,0,0,0}}},{{{-215,-172,-255,-146,-121,-190},{-177,-332,-141,-309,-282,-179},{-253,-280,-186,-193,-188,-195},{-208,-130,-208,-278,-289,-318},{-302,-316,-316,-318,-311,-220},{-146,-150,-161,-143,-116,-199},{-307,-264,-246,-298,-190,-296},{-159,-177,-206,-336,-215,-123},{-215,-320,-139,-193,-119,-253},{-164,-276,-334,-220,-211,-224}},{{-329,-199,-226,-316,-289,-325},{-121,-329,-300,-190,-320,-197},{-233,-128,-267,-123,-262,-314},{-262,-190,-170,-327,-170,-271},{-184,-164,-130,-177,-258,-269},{-130,-132,-157,-271,-119,-255},{-244,-309,-305,-311,-244,-139},{-224,-320,-128,-119,-208,-217},{-255,-280,-284,-289,-307,-112},{-195,-255,-121,-177,-164,-233}},{{-318,-175,-211,-296,-215,-233},{-302,-293,-287,-190,-224,-242},{-325,-226,-242,-309,-121,-190},{-204,-264,-224,-152,-224,-284},{-320,-146,-150,-206,-181,-235},{-143,-195,-336,-336,-215,-278},{-164,-262,-276,-258,-155,-152},{-119,-325,-237,-114,-309,-177},{-287,-300,-157,-226,-217,-114},{-276,-164,-293,-251,-273,-329}}},{{{-119,-347,-255,-164,-243,-148},{-143,-214,-238,-271,-307,-121},{-145,-178,-271,-283,-288,-155},{-243,-202,-133,-221,-136,-167},{-131,-195,-219,-202,-221,-207},{-181,-288,-271,-240,-143,-317},{-202,-143,-355,-221,-321,-164},{-338,-347,-150,-205,-209,-138},{-262,-157,-302,-231,-157,-131},{-133,-319,-207,-207,-221,-278}},{{-340,-148,-343,-205,-152,-236},{-321,-250,-278,-138,-145,-321},{-138,-300,-338,-209,-129,-198},{-171,-276,-278,-121,-309,-167},{-119,-145,-295,-324,-126,-200},{-255,-281,-121,-286,-314,-138},{-338,-238,-307,-145,-274,-186},{-345,-167,-248,-231,-121,-148},{-121,-152,-314,-250,-202,-340},{-143,-278,-264,-169,-124,-255}},{{-307,-238,-238,-133,-167,-336},{-159,-355,-328,-121,-226,-345},{-314,-238,-228,-295,-326,-324},{-248,-190,-124,-257,-312,-350},{-357,-281,-159,-286,-307,-233},{-309,-333,-131,-307,-238,-290},{-205,-219,-328,-262,-167,-129},{-183,-302,-174,-314,-319,-314},{-262,-248,-328,-207,-352,-190},{-347,-309,-186,-331,-119,-248}}},{{{-207,-303,-385,-270,-235,-317},{-349,-401,-205,-366,-259,-268},{-156,-142,-328,-191,-333,-199},{-314,-371,-210,-308,-180,-396},{-191,-333,-199,-167,-257,-385},{-262,-358,-268,-199,-284,-388},{-248,-325,-306,-210,-308,-251},{-136,-205,-390,-235,-142,-202},{-243,-142,-401,-268,-366,-142},{-369,-379,-284,-251,-292,-180}},{{-303,-194,-360,-191,-205,-349},{-139,-292,-347,-399,-153,-210},{-276,-213,-369,-172,-287,-167},{-202,-295,-371,-319,-213,-251},{-401,-360,-197,-374,-145,-336},{-147,-311,-207,-199,-188,-248},{-374,-161,-161,-306,-243,-352},{-216,-322,-388,-257,-156,-235},{-186,-240,-150,-136,-377,-218},{-175,-366,-333,-344,-188,-289}},{{-355,-371,-300,-407,-363,-407},{-221,-377,-355,-265,-393,-262},{-369,-407,-371,-407,-328,-259},{-407,-410,-205,-251,-377,-218},{-161,-270,-352,-363,-308,-265},{-281,-257,-358,-298,-265,-142},{-382,-145,-308,-292,-377,-308},{-167,-262,-142,-396,-213,-224},{-404,-270,-292,-161,-317,-284},{-164,-341,-390,-300,-336,-248}}},{{{-172,-120,-77,-174,-206,-183},{-105,-191,-200,-171,-82,-154},{-111,-114,-222,-94,-156,-148},{-182,-220,-105,-137,-128,-216},{-160,-166,-203,-83,-208,-219},{-119,-194,-169,-162,-188,-177},{-105,-95,-200,-89,-165,-80},{-119,-142,-188,-139,-199,-159},{-189,-77,-163,-91,-137,-214},{-77,-85,-228,-199,-189,-219}},{{-137,-146,-171,-86,-165,-194},{-114,-114,-196,-99,-103,-82},{-77,-160,-86,-179,-189,-203},{-199,-217,-100,-100,-228,-108},{-157,-219,-160,-123,-136,-188},{-116,-151,-183,-88,-191,-92},{-211,-100,-213,-131,-99,-160},{-163,-88,-206,-134,-102,-226},{-219,-213,-105,-103,-156,-185},{-86,-114,-196,-99,-183,-214}},{{-154,-157,-219,-219,-186,-172},{-208,-105,-146,-177,-89,-88},{-191,-114,-139,-122,-219,-220},{-185,-189,-148,-171,-163,-226},{-100,-151,-92,-208,-169,-112},{-192,-165,-126,-157,-82,-185},{-205,-149,-200,-145,-191,-116},{-151,-95,-182,-209,-122,-211},{-179,-77,-211,-119,-148,-223},{-122,-95,-102,-99,-223,-79}}},{{{-231,-197,-166,-242,-268,-104},{-182,-136,-198,-217,-155,-146},{-104,-211,-231,-211,-211,-144},{-153,-142,-144,-135,-195,-266},{-166,-207,-235,-191,-135,-235},{-151,-184,-184,-127,-260,-273},{-184,-116,-197,-178,-258,-167},{-118,-249,-266,-177,-184,-206},{-184,-248,-118,-207,-169,-111},{-224,-157,-271,-120,-271,-98}},{{-253,-96,-228,-155,-264,-157},{-116,-169,-96,-240,-175,-189},{-268,-135,-129,-186,-218,-262},{-116,-96,-260,-120,-207,-109},{-146,-228,-213,-144,-173,-155},{-178,-129,-109,-104,-213,-273},{-209,-106,-255,-198,-107,-253},{-129,-151,-177,-249,-146,-167},{-215,-198,-102,-182,-217,-122},{-167,-204,-213,-100,-169,-104}},{{-167,-116,-189,-109,-95,-226},{-273,-189,-178,-257,-215,-211},{-218,-218,-249,-166,-122,-215},{-173,-104,-189,-133,-178,-228},{-111,-135,-249,-224,-171,-155},{-102,-220,-140,-209,-149,-200},{-111,-126,-157,-136,-266,-182},{-146,-260,-195,-240,-180,-222},{-158,-153,-198,-140,-209,-96},{-118,-158,-226,-133,-249,-180}}},{{{-355,-127,-186,-213,-348,-206},{-282,-122,-328,-274,-247,-130},{-208,-243,-201,-284,-201,-164},{-243,-363,-314,-147,-122,-365},{-333,-348,-127,-284,-238,-164},{-147,-135,-122,-245,-159,-272},{-255,-294,-333,-218,-294,-309},{-135,-191,-277,-211,-181,-304},{-365,-345,-343,-360,-318,-130},{-198,-262,-198,-260,-294,-326}},{{-331,-250,-267,-164,-162,-333},{-255,-162,-318,-360,-125,-333},{-267,-218,-218,-333,-282,-247},{-314,-326,-299,-360,-277,-186},{-216,-353,-225,-181,-260,-203},{-287,-167,-282,-262,-294,-208},{-348,-274,-341,-174,-125,-353},{-186,-181,-243,-174,-203,-159},{-211,-353,-353,-169,-198,-309},{-348,-292,-270,-238,-194,-304}},{{-350,-211,-365,-172,-301,-255},{-172,-174,-255,-142,-270,-145},{-137,-125,-208,-274,-345,-252},{-262,-167,-368,-135,-350,-184},{-265,-243,-174,-318,-279,-314},{-243,-321,-228,-262,-135,-355},{-343,-238,-140,-201,-135,-176},{-309,-137,-287,-294,-213,-272},{-135,-189,-145,-318,-287,-154},{-262,-216,-331,-277,-355,-252}}},{{{-291,-273,-203,-116,-182,-187},{-180,-268,-173,-298,-176,-118},{-150,-256,-162,-148,-215,-310},{-314,-275,-303,-259,-321,-236},{-231,-326,-139,-141,-328,-316},{-219,-328,-328,-136,-146,-289},{-245,-122,-270,-171,-293,-249},{-187,-148,-330,-116,-321,-240},{-129,-194,-125,-229,-319,-162},{-132,-169,-180,-182,-125,-134}},{{-252,-152,-201,-312,-213,-166},{-314,-243,-270,-206,-206,-316},{-321,-120,-210,-213,-176,-284},{-152,-335,-305,-226,-162,-330},{-254,-224,-215,-169,-182,-326},{-261,-132,-210,-240,-261,-141},{-164,-305,-208,-143,-222,-217},{-148,-305,-178,-208,-159,-159},{-203,-284,-273,-284,-129,-335},{-210,-136,-236,-189,-323,-194}},{{-273,-333,-199,-143,-189,-263},{-194,-134,-215,-312,-185,-224},{-316,-226,-249,-157,-247,-136},{-213,-196,-125,-185,-275,-150},{-148,-323,-240,-277,-305,-270},{-120,-323,-213,-157,-337,-236},{-252,-240,-254,-192,-176,-296},{-159,-164,-192,-319,-259,-162},{-213,-199,-326,-118,-330,-275},{-342,-240,-335,-296,-259,-199}}},{{{-438,-429,-282,-415,-253,-353},{-338,-197,-288,-347,-350,-268},{-406,-156,-273,-320,-385,-294},{-379,-244,-379,-303,-262,-150},{-320,-268,-297,-168,-397,-303},{-344,-417,-338,-353,-265,-200},{-244,-329,-256,-220,-232,-353},{-203,-268,-323,-341,-150,-179},{-429,-303,-303,-320,-412,-391},{-415,-376,-159,-159,-253,-238}},{{-341,-270,-335,-409,-220,-197},{-179,-270,-188,-429,-341,-368},{-441,-350,-409,-209,-312,-353},{-423,-182,-197,-226,-397,-209},{-270,-147,-188,-176,-432,-382},{-153,-370,-173,-250,-182,-173},{-171,-376,-156,-168,-229,-194},{-309,-312,-156,-262,-300,-276},{-391,-218,-220,-368,-262,-165},{-262,-376,-391,-376,-403,-435}},{{-415,-173,-168,-182,-244,-285},{-370,-279,-273,-297,-250,-282},{-356,-347,-320,-218,-303,-382},{-400,-294,-426,-409,-379,-156},{-150,-262,-256,-259,-353,-229},{-244,-147,-373,-268,-423,-438},{-253,-185,-303,-362,-312,-244},{-420,-162,-262,-362,-241,-412},{-244,-323,-212,-171,-409,-306},{-273,-238,-179,-265,-265,-382}}}}; // supply (positive for supply and negative for demand) under different scenarios 
int iniv[I]={1841,192,221,150,198,208,315,198,294}; // initial inventory 
int ubiv[I]={2104,384,442,300,396,416,630,396,588}; // the upper bounds of inventory 
int len[I1][I2]={{5,3,2,2,1,1,2,3}}; // the traveling time between two sites 
// cost parameters: 
double c1[I]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}; // inventory holding cost 
double c2[I]={0.05,13.32,8.46,5.6,4.24,2.89,1.51,4.53,7.74}; // cost of leftover and unmet 
double c3[BN]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}; // transportation cost for capacity contracts 
double c4[I1][I2]={{12.11,7.69,5.09,3.85,2.63,1.37,4.12,7.04}}; // cost of spot market 
// bid parameters: 
int RLBN[I1][I2]={{9,9,9,9,9,9,9,9}}; // number of bids on each arc 
int LBset[I1][I2][LBN]={{{0,1,2,3,4,5,6,7,8},{9,10,11,12,13,14,15,16,17},{18,19,20,21,22,23,24,25,26},{27,28,29,30,31,32,33,34,35},{36,37,38,39,40,41,42,43,44},{45,46,47,48,49,50,51,52,53},{54,55,56,57,58,59,60,61,62},{63,64,65,66,67,68,69,70,71}}}; // set of bids on each arc 
double frt[BN]={9.69,9.69,9.69,8.48,8.48,8.48,7.27,7.27,7.27,6.15,6.15,6.15,5.38,5.38,5.38,4.61,4.61,4.61,4.07,4.07,4.07,3.56,3.56,3.56,3.05,3.05,3.05,3.08,3.08,3.08,2.7,2.7,2.7,2.31,2.31,2.31,2.1,2.1,2.1,1.84,1.84,1.84,1.58,1.58,1.58,1.1,1.1,1.1,0.96,0.96,0.96,0.82,0.82,0.82,3.3,3.3,3.3,2.88,2.88,2.88,2.47,2.47,2.47,5.63,5.63,5.63,4.93,4.93,4.93,4.22,4.22,4.22}; // freight rate of each bid 
int lbcap[BN]={75,75,75,1,151,151,151,226,226,75,75,75,301,151,151,151,226,226,75,75,75,301,151,151,151,226,226,75,75,75,301,151,151,151,226,226,75,75,75,301,151,151,151,226,226,75,75,75,301,151,151,151,226,226,75,75,75,301,151,151,151,226,226,75,75,75,301,151,151,151,226,226}; // capacity lower bound of each bid 
int ubcap[BN]={150,150,150,225,225,225,300,300,300,150,150,150,225,225,225,300,300,300,150,150,150,225,225,225,300,300,300,150,150,150,225,225,225,300,300,300,150,150,150,225,225,225,300,300,300,150,150,150,225,225,225,300,300,300,150,150,150,225,225,225,300,300,300,150,150,150,225,225,225,300,300,300}; // capacity upper bound of each bid 
// shipment parameters: 
int SHN[BN]={6,4,2,6,4,3,6,4,2,8,4,3,7,4,3,7,4,3,8,4,3,7,4,3,7,4,3,8,4,3,8,4,3,7,4,3,8,4,3,9,5,3,9,4,3,8,5,3,9,4,3,8,5,3,7,4,3,8,4,3,8,4,3,7,4,3,7,4,3,7,4,3}; // number of shipment for each bid 
int SHset[BN][MBSN]={{0,1,2,3,4,5},{6,7,8,9},{10,11},{12,13,14,15,16,17},{18,19,20,21},{22,23,24},{25,26,27,28,29,30},{31,32,33,34},{35,36},{37,38,39,40,41,42,43,44},{45,46,47,48},{49,50,51},{52,53,54,55,56,57,58},{59,60,61,62},{63,64,65},{66,67,68,69,70,71,72},{73,74,75,76},{77,78,79},{80,81,82,83,84,85,86,87},{88,89,90,91},{92,93,94},{95,96,97,98,99,100,101},{102,103,104,105},{106,107,108},{109,110,111,112,113,114,115},{116,117,118,119},{120,121,122},{123,124,125,126,127,128,129,130},{131,132,133,134},{135,136,137},{138,139,140,141,142,143,144,145},{146,147,148,149},{150,151,152},{153,154,155,156,157,158,159},{160,161,162,163},{164,165,166},{167,168,169,170,171,172,173,174},{175,176,177,178},{179,180,181},{182,183,184,185,186,187,188,189,190},{191,192,193,194,195},{196,197,198},{199,200,201,202,203,204,205,206,207},{208,209,210,211},{212,213,214},{215,216,217,218,219,220,221,222},{223,224,225,226,227},{228,229,230},{231,232,233,234,235,236,237,238,239},{240,241,242,243},{244,245,246},{247,248,249,250,251,252,253,254},{255,256,257,258,259},{260,261,262},{263,264,265,266,267,268,269},{270,271,272,273},{274,275,276},{277,278,279,280,281,282,283,284},{285,286,287,288},{289,290,291},{292,293,294,295,296,297,298,299},{300,301,302,303},{304,305,306},{307,308,309,310,311,312,313},{314,315,316,317},{318,319,320},{321,322,323,324,325,326,327},{328,329,330,331},{332,333,334},{335,336,337,338,339,340,341},{342,343,344,345},{346,347,348}}; // set of shipments in each bid 
int SHsts[SPN]={2,4,6,8,10,12,0,4,8,12,1,7,1,3,5,7,9,11,0,4,8,12,0,6,12,2,4,6,8,10,12,0,4,8,12,1,7,0,2,4,6,8,10,12,14,0,4,8,12,2,8,14,1,3,5,7,9,11,13,1,5,9,13,0,6,12,1,3,5,7,9,11,13,0,4,8,12,1,7,13,0,2,4,6,8,10,12,14,1,5,9,13,2,8,14,2,4,6,8,10,12,14,1,5,9,13,2,8,14,2,4,6,8,10,12,14,1,5,9,13,0,6,12,0,2,4,6,8,10,12,14,2,6,10,14,0,6,12,1,3,5,7,9,11,13,15,1,5,9,13,2,8,14,2,4,6,8,10,12,14,0,4,8,12,1,7,13,2,4,6,8,10,12,14,16,1,5,9,13,1,7,13,0,2,4,6,8,10,12,14,16,0,4,8,12,16,0,6,12,0,2,4,6,8,10,12,14,16,2,6,10,14,1,7,13,1,3,5,7,9,11,13,15,0,4,8,12,16,1,7,13,0,2,4,6,8,10,12,14,16,2,6,10,14,2,8,14,2,4,6,8,10,12,14,16,0,4,8,12,16,0,6,12,2,4,6,8,10,12,14,2,6,10,14,0,6,12,0,2,4,6,8,10,12,14,0,4,8,12,1,7,13,1,3,5,7,9,11,13,15,2,6,10,14,2,8,14,2,4,6,8,10,12,14,0,4,8,12,0,6,12,1,3,5,7,9,11,13,2,6,10,14,2,8,14,2,4,6,8,10,12,14,1,5,9,13,2,8,14}; // set of start times of each shipment 
int SHets[SPN]={7,9,11,13,15,17,5,9,13,17,6,12,6,8,10,12,14,16,5,9,13,17,5,11,17,7,9,11,13,15,17,5,9,13,17,6,12,3,5,7,9,11,13,15,17,3,7,11,15,5,11,17,4,6,8,10,12,14,16,4,8,12,16,3,9,15,4,6,8,10,12,14,16,3,7,11,15,4,10,16,2,4,6,8,10,12,14,16,3,7,11,15,4,10,16,4,6,8,10,12,14,16,3,7,11,15,4,10,16,4,6,8,10,12,14,16,3,7,11,15,2,8,14,2,4,6,8,10,12,14,16,4,8,12,16,2,8,14,3,5,7,9,11,13,15,17,3,7,11,15,4,10,16,4,6,8,10,12,14,16,2,6,10,14,3,9,15,3,5,7,9,11,13,15,17,2,6,10,14,2,8,14,1,3,5,7,9,11,13,15,17,1,5,9,13,17,1,7,13,1,3,5,7,9,11,13,15,17,3,7,11,15,2,8,14,2,4,6,8,10,12,14,16,1,5,9,13,17,2,8,14,1,3,5,7,9,11,13,15,17,3,7,11,15,3,9,15,3,5,7,9,11,13,15,17,1,5,9,13,17,1,7,13,4,6,8,10,12,14,16,4,8,12,16,2,8,14,2,4,6,8,10,12,14,16,2,6,10,14,3,9,15,3,5,7,9,11,13,15,17,4,8,12,16,4,10,16,5,7,9,11,13,15,17,3,7,11,15,3,9,15,4,6,8,10,12,14,16,5,9,13,17,5,11,17,5,7,9,11,13,15,17,4,8,12,16,5,11,17}; // set of end times of each shipment 
