int Dev = 50;// 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 = 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]={{{{12964,0,0,0,0,0},{11333,0,0,0,0,0},{11790,0,0,0,0,0},{11978,0,0,0,0,0},{11979,0,0,0,0,0},{12202,0,0,0,0,0},{12376,0,0,0,0,0},{12553,0,0,0,0,0},{12852,0,0,0,0,0},{12178,0,0,0,0,0}},{{11803,0,0,0,0,0},{11550,0,0,0,0,0},{12367,0,0,0,0,0},{12144,0,0,0,0,0},{13197,0,0,0,0,0},{12884,0,0,0,0,0},{12377,0,0,0,0,0},{12384,0,0,0,0,0},{11855,0,0,0,0,0},{12263,0,0,0,0,0}},{{10849,0,0,0,0,0},{11019,0,0,0,0,0},{12631,0,0,0,0,0},{11563,0,0,0,0,0},{11219,0,0,0,0,0},{11526,0,0,0,0,0},{11460,0,0,0,0,0},{11775,0,0,0,0,0},{12099,0,0,0,0,0},{12011,0,0,0,0,0}}},{{{-191,-391,-291,-188,-197,-229},{-341,-288,-176,-312,-191,-238},{-256,-229,-191,-165,-206,-376},{-368,-185,-185,-173,-412,-247},{-403,-153,-235,-309,-232,-282},{-412,-318,-297,-188,-326,-165},{-147,-335,-415,-268,-256,-206},{-182,-432,-173,-323,-247,-356},{-400,-206,-441,-435,-150,-203},{-162,-215,-288,-350,-279,-229}},{{-235,-220,-246,-301,-360,-376},{-276,-232,-148,-345,-200,-174},{-412,-263,-162,-260,-384,-321},{-157,-217,-302,-375,-230,-332},{-386,-203,-314,-301,-262,-347},{-368,-315,-269,-263,-155,-376},{-188,-257,-146,-203,-398,-233},{-435,-183,-358,-307,-142,-360},{-392,-240,-272,-244,-336,-285},{-397,-326,-176,-277,-195,-272}},{{-322,-324,-289,-168,-218,-266},{-172,-225,-263,-316,-167,-216},{-160,-283,-284,-307,-312,-307},{-338,-189,-119,-130,-188,-169},{-130,-133,-196,-280,-238,-181},{-138,-356,-168,-235,-312,-299},{-335,-336,-247,-121,-122,-218},{-218,-152,-170,-123,-253,-165},{-325,-145,-317,-177,-210,-200},{-230,-196,-219,-307,-319,-210}}},{{{-245,-161,-198,-154,-247,-136},{-178,-199,-98,-143,-247,-101},{-205,-86,-231,-174,-155,-241},{-123,-115,-175,-197,-270,-136},{-217,-206,-256,-213,-217,-103},{-96,-128,-166,-184,-195,-256},{-235,-174,-250,-261,-250,-216},{-99,-232,-182,-258,-272,-107},{-134,-164,-222,-93,-138,-181},{-123,-252,-247,-95,-221,-260}},{{-172,-182,-232,-270,-266,-209},{-176,-199,-153,-267,-266,-333},{-214,-156,-185,-292,-208,-167},{-139,-158,-228,-168,-247,-167},{-158,-209,-294,-261,-330,-131},{-224,-236,-268,-210,-158,-250},{-180,-213,-198,-141,-309,-355},{-202,-123,-147,-301,-176,-298},{-202,-250,-119,-239,-334,-307},{-166,-144,-294,-170,-302,-219}},{{-252,-252,-189,-335,-388,-241},{-153,-332,-223,-151,-227,-142},{-227,-260,-173,-267,-194,-181},{-264,-260,-141,-230,-402,-175},{-215,-258,-283,-373,-349,-263},{-207,-140,-267,-170,-407,-280},{-161,-375,-328,-378,-150,-291},{-368,-143,-288,-284,-271,-226},{-348,-303,-307,-230,-360,-393},{-299,-143,-244,-319,-296,-294}}},{{{-464,-401,-461,-451,-431,-237},{-260,-355,-263,-464,-171,-306},{-293,-329,-171,-257,-306,-220},{-257,-207,-303,-260,-470,-332},{-201,-461,-230,-411,-368,-197},{-250,-168,-424,-220,-365,-247},{-217,-286,-411,-316,-309,-477},{-457,-197,-405,-227,-342,-355},{-266,-415,-382,-290,-211,-243},{-487,-184,-273,-372,-349,-352}},{{-361,-248,-242,-355,-185,-166},{-249,-238,-316,-232,-225,-238},{-295,-422,-341,-468,-293,-265},{-358,-441,-396,-317,-348,-208},{-374,-409,-160,-421,-434,-178},{-410,-345,-236,-295,-249,-334},{-210,-370,-290,-471,-447,-259},{-207,-267,-271,-198,-169,-301},{-220,-184,-319,-392,-176,-268},{-492,-364,-242,-455,-394,-154}},{{-201,-262,-283,-397,-217,-175},{-171,-291,-174,-280,-138,-270},{-360,-222,-361,-335,-363,-350},{-171,-412,-241,-190,-366,-224},{-227,-158,-146,-397,-191,-164},{-268,-314,-190,-220,-286,-375},{-174,-343,-213,-185,-191,-146},{-177,-213,-238,-136,-215,-159},{-434,-325,-392,-196,-236,-316},{-186,-409,-333,-223,-159,-337}}},{{{-153,-134,-110,-167,-62,-100},{-91,-55,-65,-156,-90,-182},{-80,-134,-114,-113,-105,-90},{-89,-61,-65,-166,-101,-159},{-142,-125,-136,-87,-94,-186},{-146,-55,-62,-97,-98,-182},{-64,-87,-97,-84,-83,-183},{-68,-77,-95,-150,-176,-164},{-61,-155,-111,-138,-106,-110},{-74,-65,-143,-111,-179,-175}},{{-150,-189,-192,-228,-137,-180},{-73,-154,-173,-175,-204,-131},{-97,-87,-74,-87,-82,-193},{-143,-125,-89,-189,-187,-118},{-136,-102,-198,-81,-161,-161},{-185,-178,-102,-226,-101,-128},{-193,-203,-192,-88,-156,-118},{-173,-151,-172,-228,-233,-252},{-126,-72,-189,-194,-188,-155},{-131,-135,-179,-99,-134,-223}},{{-219,-182,-164,-277,-169,-216},{-93,-256,-132,-215,-206,-152},{-107,-151,-134,-230,-163,-249},{-210,-239,-117,-124,-245,-123},{-98,-252,-212,-122,-251,-214},{-105,-130,-147,-272,-192,-109},{-107,-185,-108,-239,-131,-242},{-163,-112,-242,-268,-149,-188},{-200,-103,-234,-251,-290,-297},{-252,-115,-216,-179,-106,-192}}},{{{-277,-245,-143,-276,-262,-248},{-177,-188,-169,-236,-236,-248},{-266,-295,-331,-307,-302,-276},{-189,-324,-228,-333,-228,-326},{-221,-226,-259,-231,-145,-331},{-305,-174,-259,-248,-143,-336},{-147,-176,-131,-305,-159,-307},{-219,-167,-271,-319,-286,-190},{-324,-307,-293,-274,-355,-328},{-326,-336,-155,-328,-312,-157}},{{-248,-338,-315,-256,-221,-217},{-236,-155,-214,-148,-172,-179},{-178,-136,-204,-132,-244,-186},{-309,-145,-268,-335,-156,-113},{-257,-283,-193,-259,-201,-126},{-121,-176,-202,-236,-314,-212},{-126,-119,-179,-222,-296,-170},{-317,-121,-242,-270,-142,-139},{-262,-126,-125,-307,-158,-234},{-219,-259,-160,-328,-197,-287}},{{-166,-169,-192,-197,-107,-236},{-271,-242,-113,-179,-151,-117},{-314,-238,-301,-283,-155,-227},{-252,-169,-162,-156,-194,-238},{-183,-121,-301,-283,-241,-194},{-211,-238,-190,-158,-110,-205},{-211,-146,-283,-273,-166,-94},{-260,-301,-210,-234,-172,-166},{-249,-178,-252,-98,-280,-157},{-181,-242,-238,-216,-280,-110}}},{{{-245,-263,-279,-253,-335,-306},{-287,-221,-157,-282,-378,-258},{-152,-269,-154,-154,-327,-229},{-146,-383,-271,-317,-295,-181},{-386,-181,-213,-271,-239,-261},{-394,-266,-189,-258,-383,-351},{-213,-274,-258,-378,-298,-383},{-223,-279,-391,-261,-290,-136},{-146,-359,-359,-354,-184,-181},{-287,-370,-133,-133,-184,-303}},{{-176,-176,-380,-189,-186,-378},{-269,-375,-189,-237,-196,-210},{-168,-226,-311,-255,-259,-321},{-386,-269,-231,-200,-202,-272},{-338,-314,-319,-391,-204,-360},{-218,-287,-335,-317,-388,-161},{-327,-226,-295,-162,-265,-223},{-247,-133,-362,-255,-157,-319},{-245,-327,-231,-242,-356,-246},{-181,-160,-234,-378,-152,-215}},{{-264,-278,-169,-246,-154,-166},{-352,-266,-340,-278,-294,-236},{-298,-296,-257,-365,-365,-214},{-223,-129,-292,-352,-345,-342},{-303,-215,-323,-174,-220,-202},{-300,-369,-126,-184,-127,-313},{-321,-369,-239,-325,-365,-253},{-153,-329,-305,-345,-311,-333},{-300,-293,-181,-223,-137,-253},{-269,-331,-166,-228,-201,-207}}},{{{-298,-452,-250,-217,-238,-314},{-403,-172,-241,-295,-433,-204},{-196,-331,-445,-223,-355,-323},{-286,-403,-205,-358,-262,-172},{-436,-433,-367,-241,-250,-284},{-406,-175,-187,-424,-313,-364},{-316,-196,-415,-217,-184,-397},{-169,-379,-150,-430,-172,-314},{-241,-268,-223,-352,-430,-388},{-247,-229,-169,-331,-250,-175}},{{-190,-362,-160,-295,-186,-308},{-196,-316,-224,-322,-273,-378},{-437,-367,-269,-393,-143,-144},{-208,-169,-370,-158,-398,-270},{-440,-327,-179,-191,-284,-357},{-416,-278,-344,-139,-326,-324},{-231,-293,-375,-363,-321,-360},{-437,-276,-274,-210,-398,-368},{-220,-144,-305,-401,-215,-290},{-264,-376,-213,-205,-159,-298}},{{-218,-130,-144,-172,-257,-301},{-365,-170,-302,-283,-286,-129},{-350,-230,-144,-186,-114,-202},{-322,-233,-227,-159,-318,-141},{-243,-274,-334,-256,-176,-188},{-300,-350,-344,-135,-310,-299},{-340,-178,-124,-170,-157,-156},{-216,-329,-325,-301,-223,-269},{-154,-250,-238,-219,-244,-277},{-174,-298,-309,-270,-191,-113}}},{{{-315,-346,-448,-448,-448,-259},{-273,-448,-259,-214,-238,-346},{-290,-469,-350,-280,-270,-469},{-266,-500,-238,-287,-416,-308},{-241,-186,-340,-241,-308,-224},{-270,-301,-346,-494,-214,-357},{-490,-399,-322,-315,-280,-189},{-518,-410,-318,-374,-224,-487},{-378,-360,-193,-480,-368,-452},{-290,-266,-494,-448,-494,-276}},{{-289,-233,-193,-284,-344,-177},{-383,-196,-502,-384,-233,-386},{-445,-316,-454,-424,-276,-351},{-174,-202,-370,-468,-462,-370},{-247,-504,-271,-464,-413,-264},{-386,-374,-339,-458,-462,-190},{-487,-178,-356,-281,-440,-264},{-407,-370,-251,-498,-328,-209},{-358,-185,-342,-307,-239,-287},{-348,-182,-308,-397,-423,-380}},{{-277,-357,-159,-161,-162,-161},{-372,-231,-315,-246,-205,-311},{-375,-367,-402,-325,-234,-409},{-236,-428,-423,-284,-379,-292},{-472,-360,-303,-158,-219,-145},{-378,-219,-153,-188,-362,-370},{-211,-360,-309,-393,-385,-306},{-198,-434,-447,-316,-410,-267},{-230,-277,-270,-278,-222,-250},{-315,-416,-441,-428,-276,-328}}}}; // 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,4,3,8,4,3,7,4,3,7,4,3,8,4,3,8,4,3,7,4,3,7,4,3,7,4,3,8,4,3,9,4,3,8,4,3,9,5,3,9,4,3,8,5,3,9,5,3,8,4,3,7,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,1,5,9,1,7,0,2,4,6,8,10,12,2,6,10,2,8,1,3,5,7,9,11,0,4,8,12,0,6,12,0,2,4,6,8,10,12,14,0,4,8,12,1,7,13,2,4,6,8,10,12,14,2,6,10,14,2,8,14,1,3,5,7,9,11,13,2,6,10,14,0,6,12,0,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,0,6,12,2,4,6,8,10,12,14,2,6,10,14,2,8,14,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,1,5,9,13,0,6,12,0,2,4,6,8,10,12,14,16,2,6,10,14,0,6,12,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,1,7,13,0,2,4,6,8,10,12,14,16,2,6,10,14,0,6,12,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,0,4,8,12,16,2,8,14,1,3,5,7,9,11,13,15,1,5,9,13,1,7,13,2,4,6,8,10,12,14,1,5,9,13,2,8,14,0,2,4,6,8,10,12,14,2,6,10,14,1,7,13,2,4,6,8,10,12,14,0,4,8,12,0,6,12,1,3,5,7,9,11,13,1,5,9,13,1,7,13,1,3,5,7,9,11,13,0,4,8,12,0,6,12}; // set of start times of each shipment 
int SHets[SPN]={7,9,11,13,15,17,6,10,14,6,12,5,7,9,11,13,15,17,7,11,15,7,13,6,8,10,12,14,16,5,9,13,17,5,11,17,3,5,7,9,11,13,15,17,3,7,11,15,4,10,16,5,7,9,11,13,15,17,5,9,13,17,5,11,17,4,6,8,10,12,14,16,5,9,13,17,3,9,15,2,4,6,8,10,12,14,16,3,7,11,15,4,10,16,3,5,7,9,11,13,15,17,4,8,12,16,2,8,14,4,6,8,10,12,14,16,4,8,12,16,4,10,16,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,3,7,11,15,2,8,14,1,3,5,7,9,11,13,15,17,3,7,11,15,1,7,13,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,2,8,14,1,3,5,7,9,11,13,15,17,3,7,11,15,1,7,13,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,1,5,9,13,17,3,9,15,3,5,7,9,11,13,15,17,3,7,11,15,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,4,8,12,16,3,9,15,5,7,9,11,13,15,17,3,7,11,15,3,9,15,4,6,8,10,12,14,16,4,8,12,16,4,10,16,4,6,8,10,12,14,16,3,7,11,15,3,9,15}; // set of end times of each shipment 
