int Dev = 30;// Deviation
extern const int CNN = 5;// 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 = 347;//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]={{{{12156,0,0,0,0,0},{12138,0,0,0,0,0},{12028,0,0,0,0,0},{12414,0,0,0,0,0},{12444,0,0,0,0,0},{12764,0,0,0,0,0},{12597,0,0,0,0,0},{13190,0,0,0,0,0},{12499,0,0,0,0,0},{12018,0,0,0,0,0}},{{12270,0,0,0,0,0},{12173,0,0,0,0,0},{12669,0,0,0,0,0},{12703,0,0,0,0,0},{12296,0,0,0,0,0},{12589,0,0,0,0,0},{12520,0,0,0,0,0},{12676,0,0,0,0,0},{12745,0,0,0,0,0},{12450,0,0,0,0,0}},{{11835,0,0,0,0,0},{11835,0,0,0,0,0},{11353,0,0,0,0,0},{11673,0,0,0,0,0},{10882,0,0,0,0,0},{11326,0,0,0,0,0},{12025,0,0,0,0,0},{11592,0,0,0,0,0},{11868,0,0,0,0,0},{11697,0,0,0,0,0}}},{{{-212,-353,-288,-265,-376,-279},{-350,-297,-247,-209,-318,-326},{-297,-226,-220,-265,-220,-368},{-318,-306,-318,-218,-232,-379},{-229,-320,-365,-253,-379,-256},{-320,-306,-326,-270,-223,-326},{-353,-347,-297,-359,-309,-329},{-279,-229,-312,-329,-344,-353},{-332,-303,-362,-356,-341,-365},{-270,-276,-262,-300,-320,-220}},{{-267,-280,-246,-222,-214,-212},{-351,-206,-199,-342,-294,-220},{-351,-320,-246,-323,-323,-225},{-281,-263,-328,-269,-318,-321},{-299,-292,-288,-345,-248,-199},{-270,-255,-308,-208,-310,-236},{-270,-297,-344,-230,-267,-277},{-212,-229,-342,-247,-227,-199},{-354,-203,-350,-296,-299,-269},{-362,-349,-325,-225,-195,-267}},{{-202,-218,-198,-186,-238,-187},{-210,-273,-203,-278,-203,-190},{-190,-198,-254,-161,-233,-165},{-270,-276,-189,-184,-240,-187},{-278,-244,-168,-246,-205,-152},{-320,-249,-217,-164,-190,-154},{-205,-312,-294,-264,-223,-241},{-245,-264,-219,-164,-246,-253},{-260,-232,-172,-213,-197,-175},{-198,-305,-224,-177,-163,-233}}},{{{-150,-220,-135,-170,-180,-243},{-129,-194,-124,-134,-151,-155},{-131,-164,-175,-177,-182,-229},{-203,-183,-122,-226,-237,-227},{-150,-130,-186,-166,-171,-168},{-195,-155,-140,-217,-164,-214},{-144,-137,-149,-131,-234,-193},{-193,-162,-191,-206,-160,-208},{-173,-144,-219,-156,-237,-243},{-134,-134,-191,-159,-134,-136}},{{-182,-230,-149,-272,-293,-174},{-164,-226,-158,-210,-190,-302},{-172,-213,-198,-228,-284,-209},{-192,-178,-232,-285,-298,-264},{-174,-172,-175,-210,-183,-264},{-226,-148,-217,-250,-256,-250},{-202,-213,-183,-265,-208,-178},{-232,-154,-217,-170,-181,-245},{-164,-176,-232,-221,-231,-248},{-214,-217,-230,-261,-224,-207}},{{-240,-268,-293,-273,-302,-311},{-207,-263,-291,-202,-305,-252},{-217,-311,-194,-340,-208,-207},{-306,-273,-299,-273,-255,-252},{-217,-311,-223,-284,-222,-218},{-321,-258,-215,-238,-249,-198},{-252,-311,-231,-286,-197,-286},{-235,-199,-278,-351,-302,-255},{-249,-263,-293,-232,-355,-218},{-190,-319,-317,-251,-266,-218}}},{{{-415,-257,-355,-339,-276,-296},{-283,-382,-428,-237,-329,-388},{-290,-408,-359,-362,-319,-359},{-359,-247,-250,-263,-273,-260},{-273,-362,-415,-368,-306,-303},{-316,-355,-319,-329,-349,-266},{-368,-270,-237,-342,-415,-283},{-342,-359,-382,-345,-349,-392},{-352,-237,-424,-355,-260,-293},{-283,-234,-276,-398,-299,-247}},{{-423,-267,-360,-358,-237,-373},{-266,-264,-415,-380,-253,-241},{-374,-254,-274,-276,-342,-370},{-390,-267,-255,-358,-256,-292},{-417,-258,-316,-223,-373,-382},{-279,-238,-396,-380,-262,-235},{-230,-351,-364,-330,-382,-211},{-308,-341,-367,-251,-388,-334},{-249,-399,-345,-399,-283,-226},{-377,-303,-255,-248,-370,-280}},{{-268,-354,-336,-242,-307,-190},{-381,-331,-196,-291,-337,-239},{-242,-366,-322,-256,-329,-272},{-215,-294,-311,-272,-215,-260},{-354,-325,-216,-190,-318,-236},{-236,-291,-196,-335,-254,-198},{-339,-213,-325,-280,-344,-231},{-366,-305,-356,-218,-286,-254},{-366,-291,-302,-207,-339,-285},{-324,-222,-302,-196,-331,-334}}},{{{-101,-126,-83,-112,-159,-110},{-100,-111,-128,-99,-118,-146},{-127,-100,-102,-130,-109,-120},{-86,-130,-85,-132,-135,-137},{-110,-87,-103,-135,-110,-96},{-124,-118,-86,-146,-122,-125},{-98,-101,-113,-102,-142,-166},{-136,-85,-123,-131,-129,-122},{-118,-76,-109,-137,-135,-96},{-80,-107,-106,-90,-152,-136}},{{-176,-116,-145,-170,-200,-148},{-103,-173,-141,-116,-114,-139},{-140,-155,-166,-110,-204,-173},{-111,-110,-149,-118,-135,-212},{-131,-147,-164,-110,-203,-163},{-155,-178,-118,-140,-204,-192},{-161,-117,-148,-155,-135,-171},{-174,-159,-185,-197,-180,-156},{-99,-164,-175,-198,-140,-176},{-117,-103,-179,-194,-182,-151}},{{-217,-182,-221,-152,-227,-240},{-224,-234,-192,-220,-200,-152},{-158,-166,-141,-188,-145,-162},{-184,-135,-132,-156,-243,-196},{-173,-227,-177,-215,-145,-184},{-149,-137,-190,-173,-172,-206},{-133,-227,-175,-192,-153,-210},{-154,-194,-145,-188,-171,-218},{-184,-187,-232,-182,-206,-156},{-187,-202,-197,-222,-229,-145}}},{{{-217,-224,-205,-214,-276,-228},{-238,-264,-274,-188,-176,-217},{-259,-248,-174,-195,-248,-293},{-203,-259,-257,-178,-224,-169},{-261,-274,-198,-257,-259,-209},{-238,-248,-176,-257,-219,-217},{-193,-262,-276,-262,-183,-283},{-303,-288,-236,-214,-228,-228},{-170,-200,-233,-298,-167,-293},{-205,-228,-276,-214,-236,-193}},{{-233,-205,-277,-226,-264,-164},{-257,-236,-275,-263,-158,-219},{-214,-252,-306,-280,-269,-157},{-193,-188,-254,-300,-240,-239},{-276,-276,-301,-169,-246,-256},{-286,-236,-249,-215,-289,-234},{-286,-262,-277,-164,-183,-223},{-190,-250,-202,-164,-228,-208},{-271,-250,-233,-229,-282,-267},{-233,-298,-202,-208,-170,-243}},{{-185,-240,-210,-240,-243,-178},{-273,-265,-234,-185,-172,-202},{-170,-215,-246,-152,-135,-200},{-183,-211,-228,-236,-223,-175},{-155,-173,-194,-138,-168,-157},{-155,-238,-186,-181,-209,-146},{-170,-228,-248,-152,-198,-191},{-194,-199,-202,-250,-150,-153},{-237,-188,-252,-199,-185,-139},{-247,-215,-180,-228,-176,-131}}},{{{-346,-186,-197,-287,-287,-301},{-221,-231,-253,-239,-210,-293},{-207,-287,-207,-210,-303,-213},{-301,-200,-245,-332,-319,-311},{-301,-279,-269,-247,-340,-229},{-309,-340,-245,-213,-247,-200},{-186,-231,-311,-197,-346,-253},{-247,-319,-303,-189,-343,-245},{-218,-207,-200,-295,-221,-197},{-263,-197,-266,-266,-338,-250}},{{-277,-202,-250,-311,-210,-228},{-327,-298,-306,-207,-194,-324},{-189,-229,-266,-293,-283,-199},{-242,-295,-258,-311,-231,-329},{-245,-253,-340,-282,-309,-267},{-247,-303,-311,-335,-257,-249},{-226,-332,-277,-239,-267,-326},{-282,-330,-306,-223,-286,-272},{-186,-200,-309,-338,-231,-303},{-221,-245,-277,-327,-212,-287}},{{-334,-248,-275,-248,-201,-311},{-275,-238,-202,-253,-311,-224},{-300,-276,-290,-317,-201,-219},{-321,-321,-270,-193,-230,-308},{-210,-240,-252,-174,-203,-272},{-332,-258,-323,-280,-260,-258},{-287,-278,-320,-186,-318,-299},{-290,-238,-277,-206,-282,-306},{-259,-238,-224,-312,-294,-294},{-241,-276,-217,-265,-238,-212}}},{{{-373,-226,-286,-355,-262,-272},{-214,-367,-235,-334,-322,-299},{-376,-256,-316,-214,-223,-243},{-340,-331,-361,-241,-361,-317},{-220,-304,-364,-229,-214,-263},{-307,-241,-370,-388,-370,-219},{-358,-244,-352,-331,-226,-278},{-256,-241,-274,-379,-328,-358},{-316,-322,-334,-280,-349,-332},{-247,-343,-304,-253,-244,-382}},{{-275,-244,-274,-257,-244,-293},{-284,-344,-244,-268,-201,-221},{-237,-224,-238,-355,-302,-293},{-223,-356,-263,-191,-257,-326},{-208,-227,-302,-216,-209,-180},{-299,-278,-314,-289,-244,-265},{-255,-327,-350,-303,-331,-203},{-234,-339,-288,-319,-236,-319},{-357,-207,-269,-328,-281,-303},{-284,-290,-210,-257,-326,-329}},{{-241,-252,-227,-181,-157,-192},{-246,-240,-256,-272,-237,-216},{-184,-240,-199,-214,-148,-222},{-300,-276,-224,-261,-212,-206},{-216,-302,-284,-168,-208,-252},{-310,-266,-163,-194,-273,-218},{-198,-274,-263,-278,-229,-234},{-176,-211,-179,-274,-214,-196},{-203,-204,-211,-168,-187,-259},{-298,-194,-176,-168,-231,-196}}},{{{-276,-420,-280,-245,-280,-413},{-262,-430,-270,-406,-385,-427},{-389,-276,-364,-371,-455,-262},{-245,-452,-343,-371,-364,-364},{-368,-430,-350,-402,-452,-284},{-441,-343,-455,-420,-430,-360},{-284,-336,-340,-444,-413,-389},{-382,-259,-413,-438,-452,-406},{-357,-312,-392,-294,-360,-329},{-270,-444,-444,-402,-385,-424}},{{-285,-446,-386,-244,-413,-348},{-310,-405,-298,-424,-315,-328},{-258,-412,-356,-418,-387,-322},{-397,-302,-397,-351,-269,-409},{-310,-436,-363,-237,-298,-354},{-418,-309,-258,-384,-364,-245},{-411,-257,-251,-361,-321,-399},{-338,-340,-434,-394,-397,-402},{-251,-436,-349,-341,-364,-264},{-289,-439,-434,-291,-298,-245}},{{-381,-286,-270,-281,-305,-297},{-265,-259,-228,-369,-322,-217},{-359,-314,-390,-325,-276,-336},{-224,-373,-273,-243,-279,-286},{-227,-222,-228,-349,-234,-328},{-227,-320,-369,-217,-288,-345},{-274,-388,-216,-296,-245,-331},{-243,-317,-243,-208,-359,-359},{-384,-394,-321,-352,-282,-286},{-369,-302,-375,-366,-305,-339}}}}; // supply (positive for supply and negative for demand) under different scenarios 
int iniv[I]={1052,192,238,253,176,234,280,264,252}; // initial inventory 
int ubiv[I]={2104,384,476,507,352,468,350,495,504}; // 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.35,8.59,5.57,4.52,2.83,1.94,4.81,7.57}; // 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.14,7.81,5.06,4.11,2.57,1.76,4.37,6.88}}; // 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.71,9.71,9.71,8.5,8.5,8.5,7.28,7.28,7.28,6.25,6.25,6.25,5.47,5.47,5.47,4.69,4.69,4.69,4.05,4.05,4.05,3.54,3.54,3.54,3.04,3.04,3.04,3.29,3.29,3.29,2.88,2.88,2.88,2.47,2.47,2.47,2.06,2.06,2.06,1.8,1.8,1.8,1.54,1.54,1.54,1.41,1.41,1.41,1.23,1.23,1.23,1.06,1.06,1.06,3.5,3.5,3.5,3.06,3.06,3.06,2.62,2.62,2.62,5.5,5.5,5.5,4.82,4.82,4.82,4.13,4.13,4.13}; // 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,3,2,6,4,2,6,4,2,7,4,3,7,4,3,8,4,3,8,4,3,8,4,3,7,4,3,8,4,3,8,4,3,7,4,3,8,4,3,9,4,3,8,4,3,9,4,3,9,4,3,8,4,3,8,4,3,8,4,3,8,4,3,7,4,3,8,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}}; // set of shipments in each bid 
int SHsts[SPN]={1,3,5,7,9,11,2,6,10,1,7,1,3,5,7,9,11,0,4,8,12,1,7,2,4,6,8,10,12,0,4,8,12,1,7,2,4,6,8,10,12,14,1,5,9,13,0,6,12,1,3,5,7,9,11,13,2,6,10,14,0,6,12,0,2,4,6,8,10,12,14,2,6,10,14,1,7,13,1,3,5,7,9,11,13,15,2,6,10,14,2,8,14,1,3,5,7,9,11,13,15,0,4,8,12,2,8,14,2,4,6,8,10,12,14,2,6,10,14,2,8,14,1,3,5,7,9,11,13,15,0,4,8,12,2,8,14,1,3,5,7,9,11,13,15,0,4,8,12,2,8,14,2,4,6,8,10,12,14,1,5,9,13,2,8,14,1,3,5,7,9,11,13,15,2,6,10,14,1,7,13,0,2,4,6,8,10,12,14,16,2,6,10,14,1,7,13,1,3,5,7,9,11,13,15,2,6,10,14,1,7,13,0,2,4,6,8,10,12,14,16,1,5,9,13,1,7,13,0,2,4,6,8,10,12,14,16,1,5,9,13,0,6,12,1,3,5,7,9,11,13,15,2,6,10,14,0,6,12,1,3,5,7,9,11,13,15,2,6,10,14,0,6,12,0,2,4,6,8,10,12,14,0,4,8,12,1,7,13,0,2,4,6,8,10,12,14,1,5,9,13,0,6,12,1,3,5,7,9,11,13,1,5,9,13,1,7,13,0,2,4,6,8,10,12,14,2,6,10,14,0,6,12,2,4,6,8,10,12,14,0,4,8,12,2,8,14}; // set of start times of each shipment 
int SHets[SPN]={6,8,10,12,14,16,7,11,15,6,12,6,8,10,12,14,16,5,9,13,17,6,12,7,9,11,13,15,17,5,9,13,17,6,12,5,7,9,11,13,15,17,4,8,12,16,3,9,15,4,6,8,10,12,14,16,5,9,13,17,3,9,15,3,5,7,9,11,13,15,17,5,9,13,17,4,10,16,3,5,7,9,11,13,15,17,4,8,12,16,4,10,16,3,5,7,9,11,13,15,17,2,6,10,14,4,10,16,4,6,8,10,12,14,16,4,8,12,16,4,10,16,3,5,7,9,11,13,15,17,2,6,10,14,4,10,16,3,5,7,9,11,13,15,17,2,6,10,14,4,10,16,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,2,8,14,1,3,5,7,9,11,13,15,17,3,7,11,15,2,8,14,2,4,6,8,10,12,14,16,3,7,11,15,2,8,14,1,3,5,7,9,11,13,15,17,2,6,10,14,2,8,14,1,3,5,7,9,11,13,15,17,2,6,10,14,1,7,13,2,4,6,8,10,12,14,16,3,7,11,15,1,7,13,3,5,7,9,11,13,15,17,4,8,12,16,2,8,14,2,4,6,8,10,12,14,16,2,6,10,14,3,9,15,2,4,6,8,10,12,14,16,3,7,11,15,2,8,14,4,6,8,10,12,14,16,4,8,12,16,4,10,16,3,5,7,9,11,13,15,17,5,9,13,17,3,9,15,5,7,9,11,13,15,17,3,7,11,15,5,11,17}; // set of end times of each shipment 
