int Dev = 50;// Deviation
extern const int CNN = 3;// 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 = 343;//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]={{{{12692,0,0,0,0,0},{12357,0,0,0,0,0},{13198,0,0,0,0,0},{12763,0,0,0,0,0},{12299,0,0,0,0,0},{12358,0,0,0,0,0},{12410,0,0,0,0,0},{13225,0,0,0,0,0},{12385,0,0,0,0,0},{11818,0,0,0,0,0}},{{12790,0,0,0,0,0},{12718,0,0,0,0,0},{11755,0,0,0,0,0},{12403,0,0,0,0,0},{12737,0,0,0,0,0},{12336,0,0,0,0,0},{12092,0,0,0,0,0},{11295,0,0,0,0,0},{12806,0,0,0,0,0},{12762,0,0,0,0,0}},{{11502,0,0,0,0,0},{11411,0,0,0,0,0},{10692,0,0,0,0,0},{11395,0,0,0,0,0},{11586,0,0,0,0,0},{11471,0,0,0,0,0},{10954,0,0,0,0,0},{11376,0,0,0,0,0},{12357,0,0,0,0,0},{11939,0,0,0,0,0}}},{{{-320,-309,-435,-318,-206,-429},{-259,-188,-191,-194,-300,-291},{-150,-370,-238,-423,-320,-341},{-153,-420,-326,-315,-276,-250},{-406,-379,-168,-373,-150,-238},{-409,-385,-259,-253,-435,-159},{-173,-441,-250,-323,-344,-297},{-329,-318,-276,-259,-253,-203},{-376,-238,-206,-256,-173,-423},{-335,-238,-250,-406,-215,-291}},{{-412,-252,-316,-315,-243,-332},{-151,-154,-255,-266,-336,-176},{-351,-295,-210,-173,-318,-233},{-238,-209,-230,-219,-211,-184},{-342,-174,-300,-290,-304,-357},{-252,-332,-378,-345,-190,-360},{-412,-275,-266,-148,-363,-231},{-336,-186,-176,-162,-187,-282},{-409,-389,-165,-137,-339,-352},{-220,-423,-277,-195,-182,-355}},{{-238,-235,-212,-213,-188,-124},{-368,-160,-294,-271,-210,-161},{-368,-167,-128,-195,-268,-264},{-282,-351,-249,-152,-321,-243},{-260,-232,-247,-262,-270,-241},{-195,-322,-175,-211,-116,-111},{-192,-157,-282,-150,-276,-192},{-330,-172,-154,-206,-197,-154},{-185,-206,-294,-242,-263,-144},{-270,-327,-315,-132,-248,-247}}},{{{-244,-245,-248,-190,-144,-164},{-94,-216,-136,-247,-162,-201},{-232,-161,-189,-265,-256,-285},{-155,-191,-144,-124,-116,-153},{-124,-112,-186,-195,-202,-269},{-160,-171,-243,-134,-261,-128},{-86,-196,-91,-229,-230,-210},{-113,-243,-191,-97,-186,-193},{-249,-176,-107,-158,-153,-252},{-121,-105,-158,-107,-241,-126}},{{-277,-199,-292,-177,-153,-259},{-141,-197,-141,-261,-332,-295},{-190,-238,-215,-110,-300,-155},{-277,-146,-213,-234,-243,-183},{-279,-242,-247,-186,-119,-257},{-119,-303,-292,-234,-279,-143},{-295,-158,-273,-188,-165,-178},{-214,-107,-234,-234,-300,-209},{-212,-102,-138,-243,-231,-350},{-295,-273,-158,-146,-332,-305}},{{-180,-252,-351,-402,-343,-258},{-333,-227,-262,-235,-191,-147},{-235,-173,-162,-243,-363,-345},{-257,-319,-181,-343,-416,-308},{-351,-280,-275,-146,-346,-396},{-178,-372,-286,-194,-307,-408},{-348,-150,-147,-238,-277,-337},{-341,-133,-335,-178,-388,-175},{-333,-380,-320,-248,-219,-337},{-282,-214,-165,-256,-141,-365}}},{{{-408,-174,-408,-401,-428,-362},{-303,-494,-260,-447,-477,-339},{-405,-299,-352,-316,-168,-332},{-365,-349,-467,-467,-398,-490},{-266,-164,-339,-431,-474,-188},{-234,-257,-188,-415,-313,-484},{-438,-345,-207,-164,-178,-431},{-484,-313,-257,-194,-349,-398},{-494,-270,-263,-392,-467,-467},{-234,-401,-280,-257,-247,-257}},{{-285,-396,-399,-411,-348,-238},{-400,-390,-447,-336,-428,-427},{-177,-196,-354,-257,-197,-232},{-390,-277,-418,-468,-262,-286},{-262,-309,-459,-430,-385,-415},{-256,-177,-287,-214,-437,-415},{-226,-283,-287,-405,-176,-253},{-325,-171,-214,-207,-234,-205},{-472,-242,-284,-446,-222,-220},{-351,-193,-325,-270,-265,-385}},{{-236,-222,-193,-370,-276,-260},{-342,-225,-224,-204,-270,-352},{-201,-363,-294,-155,-246,-247},{-431,-236,-151,-171,-376,-234},{-431,-216,-280,-280,-244,-324},{-375,-193,-358,-389,-326,-293},{-437,-170,-154,-332,-278,-198},{-186,-363,-146,-326,-321,-267},{-336,-271,-414,-294,-382,-285},{-289,-196,-395,-267,-217,-342}}},{{{-78,-69,-165,-172,-96,-73},{-87,-144,-144,-108,-105,-154},{-114,-158,-130,-74,-101,-157},{-102,-116,-162,-80,-93,-183},{-119,-71,-111,-131,-81,-110},{-92,-111,-148,-88,-134,-143},{-120,-74,-90,-58,-95,-70},{-92,-126,-76,-160,-162,-156},{-62,-106,-69,-112,-142,-141},{-125,-64,-96,-68,-127,-163}},{{-101,-176,-170,-229,-114,-124},{-77,-76,-209,-205,-192,-128},{-73,-141,-151,-195,-135,-133},{-96,-80,-200,-226,-105,-234},{-84,-116,-215,-231,-224,-173},{-184,-106,-188,-107,-151,-123},{-202,-85,-111,-113,-164,-104},{-200,-188,-204,-102,-159,-139},{-82,-159,-145,-122,-161,-176},{-104,-110,-84,-205,-98,-106}},{{-163,-234,-262,-131,-202,-230},{-262,-193,-246,-127,-120,-109},{-102,-230,-195,-142,-171,-129},{-100,-265,-182,-169,-171,-117},{-133,-225,-253,-224,-196,-269},{-180,-252,-195,-243,-174,-285},{-126,-135,-236,-224,-241,-220},{-224,-265,-249,-205,-131,-206},{-234,-115,-182,-220,-131,-236},{-205,-205,-229,-200,-198,-129}}},{{{-210,-143,-352,-181,-200,-286},{-130,-288,-326,-126,-207,-269},{-345,-145,-333,-286,-269,-283},{-144,-347,-336,-169,-188,-343},{-331,-119,-355,-228,-274,-355},{-261,-264,-157,-131,-321,-219},{-175,-252,-293,-138,-298,-267},{-273,-357,-317,-186,-338,-198},{-182,-255,-205,-133,-333,-145},{-273,-300,-338,-309,-355,-240}},{{-155,-207,-247,-203,-163,-245},{-174,-336,-216,-333,-276,-150},{-312,-274,-197,-298,-287,-190},{-164,-171,-352,-178,-217,-219},{-252,-231,-275,-238,-305,-329},{-121,-152,-179,-203,-228,-203},{-219,-190,-287,-143,-140,-254},{-267,-152,-219,-282,-273,-119},{-124,-309,-183,-155,-145,-232},{-221,-319,-343,-268,-258,-287}},{{-187,-278,-174,-138,-148,-239},{-252,-167,-202,-257,-127,-259},{-277,-134,-285,-125,-140,-261},{-286,-178,-160,-281,-239,-166},{-288,-219,-188,-248,-131,-200},{-135,-288,-154,-111,-273,-97},{-142,-270,-216,-222,-116,-245},{-202,-265,-184,-259,-118,-128},{-297,-293,-242,-281,-133,-122},{-168,-228,-172,-277,-252,-236}}},{{{-338,-298,-380,-319,-144,-359},{-348,-242,-269,-157,-160,-242},{-202,-221,-351,-279,-362,-370},{-279,-138,-176,-293,-290,-146},{-330,-226,-282,-149,-298,-396},{-332,-202,-356,-239,-388,-332},{-359,-348,-367,-202,-247,-194},{-338,-255,-306,-327,-372,-261},{-146,-290,-370,-170,-322,-173},{-266,-356,-170,-343,-218,-181}},{{-229,-271,-154,-338,-238,-148},{-282,-144,-343,-330,-291,-376},{-213,-354,-213,-261,-296,-259},{-258,-311,-213,-271,-249,-282},{-290,-239,-223,-306,-252,-194},{-136,-144,-325,-325,-393,-176},{-378,-231,-359,-152,-244,-184},{-141,-274,-218,-266,-162,-259},{-285,-351,-168,-396,-343,-368},{-370,-388,-184,-364,-217,-192}},{{-262,-240,-277,-322,-247,-123},{-233,-149,-280,-275,-181,-212},{-254,-164,-207,-146,-162,-308},{-350,-175,-156,-213,-130,-212},{-197,-190,-224,-126,-162,-236},{-145,-281,-161,-211,-262,-333},{-259,-238,-348,-298,-353,-137},{-218,-354,-340,-243,-208,-241},{-376,-190,-302,-159,-304,-169},{-254,-228,-345,-365,-243,-183}}},{{{-250,-226,-415,-217,-415,-195},{-298,-385,-211,-340,-352,-340},{-265,-415,-187,-379,-187,-186},{-289,-367,-427,-190,-157,-426},{-430,-217,-304,-394,-150,-213},{-244,-220,-274,-430,-217,-329},{-445,-340,-364,-199,-406,-394},{-406,-298,-370,-280,-415,-382},{-346,-409,-400,-178,-157,-263},{-286,-169,-307,-406,-214,-243}},{{-398,-413,-384,-347,-342,-195},{-208,-281,-204,-205,-268,-252},{-185,-166,-176,-347,-286,-146},{-366,-155,-266,-308,-270,-278},{-237,-261,-288,-281,-294,-306},{-275,-290,-266,-229,-366,-136},{-375,-410,-260,-243,-323,-221},{-378,-350,-336,-270,-143,-141},{-440,-362,-157,-390,-294,-164},{-199,-241,-347,-257,-278,-254}},{{-357,-358,-263,-256,-161,-210},{-181,-250,-268,-159,-123,-156},{-216,-125,-199,-214,-167,-222},{-166,-252,-156,-309,-307,-139},{-124,-322,-149,-146,-108,-133},{-340,-307,-174,-201,-127,-119},{-260,-190,-227,-130,-165,-143},{-131,-173,-332,-232,-314,-109},{-303,-144,-327,-292,-167,-301},{-223,-317,-231,-281,-159,-145}}},{{{-518,-200,-371,-186,-200,-203},{-326,-364,-326,-399,-410,-301},{-273,-350,-357,-487,-441,-389},{-354,-406,-430,-497,-182,-294},{-301,-322,-406,-284,-322,-326},{-371,-259,-326,-238,-343,-301},{-287,-332,-354,-410,-231,-368},{-452,-392,-200,-332,-466,-276},{-284,-402,-525,-280,-483,-182},{-294,-329,-354,-248,-504,-203}},{{-292,-333,-319,-354,-207,-390},{-261,-511,-285,-431,-367,-174},{-421,-316,-237,-434,-459,-399},{-487,-316,-261,-384,-354,-444},{-237,-178,-227,-317,-335,-242},{-445,-357,-444,-484,-194,-393},{-435,-343,-359,-371,-430,-180},{-393,-336,-288,-468,-266,-319},{-177,-305,-403,-441,-459,-357},{-438,-412,-373,-411,-197,-287}},{{-290,-425,-165,-220,-242,-145},{-284,-320,-435,-416,-408,-284},{-359,-200,-162,-390,-319,-270},{-186,-154,-357,-337,-222,-239},{-422,-213,-438,-366,-211,-164},{-205,-231,-399,-355,-171,-253},{-167,-333,-300,-272,-279,-147},{-180,-231,-435,-281,-162,-384},{-265,-240,-447,-311,-165,-256},{-189,-382,-186,-357,-425,-259}}}}; // 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,7,3,2,6,3,2,7,4,3,7,4,3,7,4,3,7,4,3,7,4,3,8,4,3,7,4,3,7,4,3,7,4,3,9,4,3,8,4,3,8,4,3,8,5,3,8,4,3,9,5,3,8,4,3,7,4,3,8,4,3,7,4,3,8,4,3,8,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}}; // set of shipments in each bid 
int SHsts[SPN]={2,4,6,8,10,12,2,6,10,2,8,0,2,4,6,8,10,12,1,5,9,1,7,2,4,6,8,10,12,1,5,9,1,7,1,3,5,7,9,11,13,2,6,10,14,1,7,13,1,3,5,7,9,11,13,2,6,10,14,2,8,14,1,3,5,7,9,11,13,0,4,8,12,1,7,13,2,4,6,8,10,12,14,0,4,8,12,2,8,14,2,4,6,8,10,12,14,1,5,9,13,2,8,14,0,2,4,6,8,10,12,14,0,4,8,12,2,8,14,2,4,6,8,10,12,14,2,6,10,14,0,6,12,2,4,6,8,10,12,14,1,5,9,13,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,16,2,6,10,14,1,7,13,1,3,5,7,9,11,13,15,1,5,9,13,0,6,12,1,3,5,7,9,11,13,15,2,6,10,14,1,7,13,1,3,5,7,9,11,13,15,0,4,8,12,16,1,7,13,2,4,6,8,10,12,14,16,2,6,10,14,1,7,13,0,2,4,6,8,10,12,14,16,0,4,8,12,16,1,7,13,0,2,4,6,8,10,12,14,1,5,9,13,0,6,12,2,4,6,8,10,12,14,0,4,8,12,1,7,13,0,2,4,6,8,10,12,14,0,4,8,12,0,6,12,1,3,5,7,9,11,13,0,4,8,12,2,8,14,0,2,4,6,8,10,12,14,2,6,10,14,0,6,12,0,2,4,6,8,10,12,14,1,5,9,13,1,7,13}; // set of start times of each shipment 
int SHets[SPN]={7,9,11,13,15,17,7,11,15,7,13,5,7,9,11,13,15,17,6,10,14,6,12,7,9,11,13,15,17,6,10,14,6,12,4,6,8,10,12,14,16,5,9,13,17,4,10,16,4,6,8,10,12,14,16,5,9,13,17,5,11,17,4,6,8,10,12,14,16,3,7,11,15,4,10,16,4,6,8,10,12,14,16,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,2,6,10,14,4,10,16,4,6,8,10,12,14,16,4,8,12,16,2,8,14,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,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,2,6,10,14,1,7,13,2,4,6,8,10,12,14,16,3,7,11,15,2,8,14,2,4,6,8,10,12,14,16,1,5,9,13,17,2,8,14,3,5,7,9,11,13,15,17,3,7,11,15,2,8,14,1,3,5,7,9,11,13,15,17,1,5,9,13,17,2,8,14,2,4,6,8,10,12,14,16,3,7,11,15,2,8,14,4,6,8,10,12,14,16,2,6,10,14,3,9,15,2,4,6,8,10,12,14,16,2,6,10,14,2,8,14,4,6,8,10,12,14,16,3,7,11,15,5,11,17,3,5,7,9,11,13,15,17,5,9,13,17,3,9,15,3,5,7,9,11,13,15,17,4,8,12,16,4,10,16}; // set of end times of each shipment 
