int Dev = 20;// 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 = 347;//Number of shipments
extern const int SN = 10;//Number of scenarios at each stage
extern const int MBSN = 8;//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]={{{{12404,0,0,0,0,0},{12783,0,0,0,0,0},{12288,0,0,0,0,0},{12339,0,0,0,0,0},{11955,0,0,0,0,0},{12237,0,0,0,0,0},{12509,0,0,0,0,0},{12669,0,0,0,0,0},{12639,0,0,0,0,0},{12229,0,0,0,0,0}},{{12304,0,0,0,0,0},{12306,0,0,0,0,0},{12263,0,0,0,0,0},{12299,0,0,0,0,0},{12095,0,0,0,0,0},{12771,0,0,0,0,0},{12860,0,0,0,0,0},{12421,0,0,0,0,0},{12680,0,0,0,0,0},{12320,0,0,0,0,0}},{{11525,0,0,0,0,0},{11359,0,0,0,0,0},{11735,0,0,0,0,0},{11386,0,0,0,0,0},{11785,0,0,0,0,0},{11644,0,0,0,0,0},{11588,0,0,0,0,0},{11424,0,0,0,0,0},{11081,0,0,0,0,0},{11604,0,0,0,0,0}}},{{{-309,-285,-256,-323,-341,-244},{-347,-315,-238,-315,-238,-323},{-318,-253,-256,-341,-262,-332},{-273,-238,-326,-276,-294,-312},{-338,-250,-344,-294,-235,-297},{-350,-259,-241,-323,-276,-241},{-306,-306,-297,-268,-353,-256},{-270,-315,-306,-350,-350,-323},{-241,-341,-288,-353,-329,-265},{-235,-285,-279,-312,-270,-241}},{{-232,-332,-241,-255,-312,-246},{-316,-292,-263,-269,-259,-241},{-296,-315,-328,-310,-214,-298},{-249,-235,-314,-315,-291,-259},{-241,-257,-241,-304,-238,-212},{-336,-320,-308,-219,-307,-275},{-307,-229,-291,-236,-251,-254},{-299,-266,-246,-260,-315,-290},{-313,-277,-280,-258,-307,-259},{-342,-303,-300,-225,-270,-218}},{{-205,-227,-196,-251,-190,-202},{-242,-201,-205,-204,-229,-218},{-278,-220,-263,-251,-248,-214},{-205,-208,-189,-258,-248,-245},{-290,-266,-207,-255,-257,-216},{-215,-240,-263,-231,-231,-175},{-232,-230,-261,-193,-240,-202},{-205,-259,-238,-258,-220,-175},{-275,-213,-221,-255,-214,-185},{-255,-225,-219,-193,-255,-208}}},{{{-141,-159,-156,-179,-199,-210},{-195,-162,-152,-195,-199,-197},{-143,-169,-172,-209,-164,-214},{-202,-198,-166,-184,-160,-218},{-134,-145,-152,-166,-151,-212},{-192,-135,-177,-170,-169,-180},{-192,-137,-156,-200,-206,-218},{-186,-159,-142,-188,-147,-170},{-143,-199,-208,-145,-156,-201},{-192,-201,-170,-152,-208,-174}},{{-176,-242,-226,-256,-243,-193},{-216,-176,-236,-228,-222,-243},{-178,-207,-245,-245,-215,-257},{-222,-217,-222,-192,-238,-231},{-176,-182,-181,-177,-236,-231},{-194,-246,-239,-177,-190,-240},{-216,-176,-239,-188,-231,-281},{-184,-205,-239,-183,-190,-212},{-196,-244,-239,-192,-183,-198},{-230,-166,-211,-179,-204,-214}},{{-245,-268,-262,-230,-302,-266},{-235,-286,-299,-246,-271,-289},{-257,-268,-223,-294,-271,-337},{-198,-275,-254,-278,-260,-317},{-284,-263,-259,-262,-247,-266},{-277,-268,-278,-324,-319,-243},{-289,-275,-312,-259,-280,-300},{-264,-280,-244,-273,-244,-328},{-274,-235,-246,-251,-332,-280},{-277,-217,-288,-216,-307,-283}}},{{{-395,-319,-385,-273,-375,-375},{-273,-303,-378,-375,-392,-362},{-319,-299,-286,-375,-339,-270},{-368,-273,-319,-283,-286,-378},{-293,-345,-283,-355,-306,-378},{-372,-359,-355,-329,-362,-392},{-293,-263,-342,-375,-273,-339},{-309,-296,-276,-378,-359,-382},{-352,-293,-365,-316,-375,-372},{-299,-270,-296,-382,-276,-388}},{{-276,-357,-281,-257,-290,-301},{-315,-277,-306,-323,-293,-247},{-331,-274,-284,-267,-286,-265},{-295,-377,-316,-345,-336,-265},{-351,-374,-303,-295,-333,-334},{-328,-274,-281,-279,-320,-352},{-331,-367,-370,-367,-357,-244},{-341,-303,-354,-295,-317,-289},{-380,-364,-309,-333,-256,-256},{-321,-322,-360,-317,-286,-253}},{{-339,-314,-316,-269,-315,-252},{-348,-236,-308,-228,-310,-239},{-268,-331,-249,-245,-289,-211},{-251,-262,-300,-226,-215,-280},{-277,-288,-314,-226,-238,-270},{-307,-282,-297,-310,-236,-239},{-242,-331,-255,-248,-238,-254},{-257,-276,-328,-302,-225,-301},{-274,-282,-235,-286,-225,-216},{-339,-279,-322,-313,-260,-249}}},{{{-94,-90,-119,-132,-118,-120},{-123,-91,-114,-113,-116,-111},{-103,-121,-93,-109,-146,-143},{-109,-100,-99,-116,-102,-152},{-122,-96,-101,-106,-126,-110},{-106,-107,-109,-112,-128,-136},{-105,-107,-111,-133,-109,-137},{-108,-117,-120,-104,-110,-133},{-111,-127,-101,-99,-142,-154},{-91,-108,-132,-124,-124,-111}},{{-142,-127,-138,-146,-156,-161},{-139,-128,-167,-181,-193,-163},{-143,-147,-176,-143,-184,-186},{-153,-154,-173,-186,-177,-155},{-148,-155,-155,-135,-148,-185},{-148,-144,-129,-132,-172,-195},{-128,-159,-155,-169,-164,-190},{-124,-140,-138,-170,-155,-190},{-159,-145,-130,-170,-129,-155},{-135,-128,-141,-132,-148,-151}},{{-189,-189,-160,-215,-190,-186},{-166,-153,-162,-173,-223,-166},{-186,-194,-173,-160,-225,-226},{-161,-191,-203,-156,-180,-222},{-175,-158,-216,-213,-194,-228},{-163,-176,-177,-209,-235,-202},{-164,-203,-216,-200,-176,-180},{-175,-155,-153,-200,-176,-194},{-184,-194,-186,-173,-206,-162},{-200,-198,-164,-171,-159,-204}}},{{{-256,-214,-195,-195,-252,-262},{-270,-198,-200,-276,-202,-283},{-259,-259,-228,-269,-214,-190},{-235,-281,-219,-226,-205,-283},{-268,-281,-214,-278,-217,-250},{-191,-262,-286,-198,-202,-255},{-268,-274,-283,-255,-240,-283},{-249,-264,-212,-250,-243,-283},{-266,-278,-267,-245,-248,-200},{-235,-283,-245,-259,-243,-264}},{{-228,-207,-247,-270,-210,-239},{-195,-281,-268,-215,-192,-217},{-209,-207,-230,-224,-271,-245},{-269,-240,-207,-192,-231,-199},{-240,-212,-207,-213,-240,-210},{-262,-252,-273,-247,-255,-183},{-224,-231,-223,-196,-192,-265},{-276,-262,-237,-187,-251,-256},{-257,-243,-216,-194,-251,-250},{-212,-202,-270,-247,-210,-183}},{{-239,-203,-162,-187,-183,-151},{-252,-176,-240,-181,-150,-164},{-176,-192,-230,-207,-151,-194},{-249,-190,-182,-158,-191,-214},{-237,-232,-214,-230,-151,-180},{-213,-196,-184,-232,-181,-166},{-200,-219,-182,-168,-223,-214},{-202,-196,-196,-181,-185,-207},{-215,-171,-232,-185,-155,-214},{-241,-188,-196,-215,-189,-169}}},{{{-314,-247,-253,-250,-221,-303},{-287,-290,-245,-287,-319,-314},{-314,-245,-234,-263,-301,-261},{-226,-226,-277,-319,-303,-221},{-223,-215,-245,-215,-301,-258},{-317,-277,-282,-258,-237,-266},{-242,-277,-271,-231,-255,-317},{-298,-229,-319,-269,-285,-287},{-245,-319,-309,-285,-223,-215},{-309,-285,-285,-319,-263,-250}},{{-237,-277,-293,-274,-301,-298},{-303,-247,-290,-237,-262,-223},{-231,-237,-311,-242,-225,-259},{-314,-317,-221,-253,-238,-215},{-295,-301,-250,-247,-231,-215},{-306,-290,-279,-319,-283,-311},{-237,-319,-303,-319,-301,-295},{-218,-261,-309,-290,-249,-254},{-314,-298,-277,-231,-278,-280},{-293,-311,-258,-237,-309,-215}},{{-238,-261,-219,-258,-230,-277},{-212,-281,-270,-283,-255,-268},{-207,-210,-300,-233,-228,-275},{-241,-288,-209,-218,-198,-202},{-275,-240,-227,-241,-240,-284},{-254,-238,-232,-203,-233,-246},{-290,-291,-202,-263,-240,-289},{-225,-223,-214,-246,-206,-231},{-228,-293,-229,-248,-233,-202},{-236,-276,-270,-226,-235,-272}}},{{{-301,-250,-322,-316,-355,-334},{-310,-340,-361,-247,-286,-314},{-325,-322,-355,-247,-268,-349},{-331,-259,-301,-358,-346,-305},{-250,-271,-337,-280,-355,-278},{-256,-328,-256,-286,-247,-290},{-295,-298,-346,-352,-352,-290},{-247,-346,-265,-319,-250,-293},{-307,-301,-289,-289,-265,-252},{-295,-325,-280,-241,-277,-326}},{{-311,-319,-330,-281,-254,-254},{-352,-304,-224,-224,-231,-244},{-340,-281,-274,-224,-215,-290},{-293,-278,-305,-314,-228,-221},{-255,-313,-322,-298,-278,-265},{-343,-324,-300,-292,-236,-234},{-325,-336,-258,-314,-254,-278},{-319,-247,-325,-314,-220,-278},{-261,-287,-308,-314,-241,-257},{-311,-276,-311,-314,-315,-252}},{{-258,-254,-250,-203,-250,-174},{-226,-271,-215,-188,-246,-172},{-270,-238,-220,-245,-210,-220},{-246,-218,-270,-212,-210,-212},{-201,-226,-204,-256,-197,-184},{-293,-271,-250,-250,-254,-200},{-265,-226,-208,-208,-252,-172},{-280,-192,-254,-223,-191,-218},{-231,-192,-211,-219,-201,-190},{-216,-252,-243,-241,-240,-166}}},{{{-290,-343,-315,-357,-340,-322},{-336,-374,-378,-364,-371,-304},{-413,-304,-318,-315,-287,-312},{-298,-389,-280,-410,-301,-308},{-308,-360,-332,-312,-284,-284},{-308,-301,-318,-322,-392,-322},{-312,-336,-336,-312,-280,-322},{-371,-346,-360,-284,-382,-420},{-385,-371,-399,-287,-326,-392},{-284,-336,-343,-290,-374,-298}},{{-331,-288,-329,-347,-335,-258},{-386,-298,-393,-351,-367,-309},{-324,-288,-373,-331,-364,-274},{-379,-333,-302,-271,-285,-277},{-317,-377,-278,-371,-262,-306},{-369,-353,-370,-271,-318,-296},{-282,-384,-366,-354,-321,-383},{-285,-408,-298,-367,-289,-316},{-379,-357,-305,-387,-377,-386},{-376,-281,-363,-384,-341,-293}},{{-359,-286,-255,-293,-285,-272},{-271,-336,-258,-284,-248,-275},{-365,-351,-309,-275,-228,-320},{-337,-311,-333,-337,-311,-267},{-375,-326,-360,-272,-311,-253},{-271,-271,-243,-325,-291,-250},{-293,-259,-336,-290,-259,-259},{-296,-351,-246,-349,-271,-311},{-331,-253,-267,-293,-242,-242},{-359,-277,-276,-246,-271,-303}}}}; // 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,4,2,7,3,2,7,4,2,7,4,3,7,4,3,7,4,3,7,4,3,8,4,3,8,4,3,8,4,3,8,4,3,8,4,3,8,5,3,8,4,3,8,4,3,8,5,3,8,4,3,8,5,3,8,4,3,8,4,3,7,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}}; // set of shipments in each bid 
int SHsts[SPN]={2,4,6,8,10,12,0,4,8,12,1,7,0,2,4,6,8,10,12,2,6,10,1,7,0,2,4,6,8,10,12,0,4,8,12,2,8,2,4,6,8,10,12,14,2,6,10,14,2,8,14,1,3,5,7,9,11,13,0,4,8,12,2,8,14,2,4,6,8,10,12,14,0,4,8,12,1,7,13,2,4,6,8,10,12,14,0,4,8,12,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,0,4,8,12,2,8,14,0,2,4,6,8,10,12,14,2,6,10,14,0,6,12,1,3,5,7,9,11,13,15,0,4,8,12,0,6,12,0,2,4,6,8,10,12,14,0,4,8,12,2,8,14,1,3,5,7,9,11,13,15,0,4,8,12,16,2,8,14,1,3,5,7,9,11,13,15,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,16,0,4,8,12,16,2,8,14,1,3,5,7,9,11,13,15,1,5,9,13,2,8,14,1,3,5,7,9,11,13,15,0,4,8,12,16,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,1,5,9,13,2,8,14,2,4,6,8,10,12,14,0,4,8,12,1,7,13,1,3,5,7,9,11,13,1,5,9,13,1,7,13,1,3,5,7,9,11,13,1,5,9,13,2,8,14,1,3,5,7,9,11,13,1,5,9,13,0,6,12}; // set of start times of each shipment 
int SHets[SPN]={7,9,11,13,15,17,5,9,13,17,6,12,5,7,9,11,13,15,17,7,11,15,6,12,5,7,9,11,13,15,17,5,9,13,17,7,13,5,7,9,11,13,15,17,5,9,13,17,5,11,17,4,6,8,10,12,14,16,3,7,11,15,5,11,17,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,2,8,14,2,4,6,8,10,12,14,16,3,7,11,15,4,10,16,3,5,7,9,11,13,15,17,2,6,10,14,4,10,16,2,4,6,8,10,12,14,16,4,8,12,16,2,8,14,3,5,7,9,11,13,15,17,2,6,10,14,2,8,14,2,4,6,8,10,12,14,16,2,6,10,14,4,10,16,2,4,6,8,10,12,14,16,1,5,9,13,17,3,9,15,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,1,7,13,3,5,7,9,11,13,15,17,1,5,9,13,17,3,9,15,2,4,6,8,10,12,14,16,2,6,10,14,3,9,15,2,4,6,8,10,12,14,16,1,5,9,13,17,1,7,13,3,5,7,9,11,13,15,17,4,8,12,16,3,9,15,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,4,6,8,10,12,14,16,4,8,12,16,4,10,16,4,6,8,10,12,14,16,4,8,12,16,5,11,17,4,6,8,10,12,14,16,4,8,12,16,3,9,15}; // set of end times of each shipment 
