int Dev = 50;// Deviation
extern const int CNN = 1;// 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 = 337;//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]={{{{11938,0,0,0,0,0},{11939,0,0,0,0,0},{11086,0,0,0,0,0},{10911,0,0,0,0,0},{10973,0,0,0,0,0},{11774,0,0,0,0,0},{11158,0,0,0,0,0},{11298,0,0,0,0,0},{10674,0,0,0,0,0},{11782,0,0,0,0,0}},{{11563,0,0,0,0,0},{11167,0,0,0,0,0},{11814,0,0,0,0,0},{11960,0,0,0,0,0},{11042,0,0,0,0,0},{11478,0,0,0,0,0},{10262,0,0,0,0,0},{12047,0,0,0,0,0},{11648,0,0,0,0,0},{11934,0,0,0,0,0}},{{11951,0,0,0,0,0},{12210,0,0,0,0,0},{11981,0,0,0,0,0},{11571,0,0,0,0,0},{11010,0,0,0,0,0},{12640,0,0,0,0,0},{12081,0,0,0,0,0},{11845,0,0,0,0,0},{12076,0,0,0,0,0},{11485,0,0,0,0,0}}},{{{-300,-240,-248,-110,-252,-223},{-304,-248,-199,-231,-128,-280},{-130,-144,-106,-112,-104,-298},{-130,-177,-120,-231,-150,-294},{-185,-136,-179,-248,-304,-136},{-162,-102,-284,-173,-205,-300},{-152,-296,-244,-294,-158,-108},{-130,-215,-282,-242,-126,-162},{-134,-116,-132,-250,-102,-166},{-300,-227,-179,-280,-181,-175}},{{-235,-227,-242,-162,-290,-181},{-132,-102,-270,-250,-150,-110},{-211,-144,-162,-233,-244,-219},{-266,-189,-225,-250,-290,-122},{-148,-158,-168,-197,-233,-256},{-138,-211,-120,-294,-296,-201},{-286,-110,-102,-126,-187,-122},{-213,-215,-270,-266,-183,-296},{-166,-284,-150,-193,-282,-280},{-181,-252,-231,-278,-300,-179}},{{-189,-221,-270,-233,-238,-144},{-296,-292,-148,-122,-274,-195},{-252,-106,-266,-246,-191,-177},{-195,-221,-122,-185,-158,-181},{-185,-197,-278,-158,-296,-191},{-148,-260,-242,-191,-197,-201},{-116,-240,-104,-211,-120,-154},{-288,-244,-235,-302,-148,-286},{-244,-128,-148,-128,-171,-300},{-158,-189,-300,-284,-132,-296}}},{{{-126,-221,-229,-182,-179,-97},{-140,-122,-174,-187,-97,-135},{-188,-203,-119,-230,-229,-175},{-126,-89,-179,-85,-204,-111},{-132,-100,-82,-111,-151,-95},{-147,-135,-203,-242,-198,-126},{-97,-211,-169,-169,-219,-111},{-143,-106,-132,-159,-216,-114},{-134,-235,-114,-182,-229,-150},{-217,-111,-195,-101,-213,-182}},{{-213,-238,-177,-147,-100,-167},{-232,-116,-143,-118,-180,-187},{-204,-188,-200,-195,-203,-161},{-138,-193,-140,-201,-219,-171},{-87,-208,-171,-80,-101,-98},{-109,-106,-175,-177,-163,-161},{-84,-109,-113,-95,-242,-163},{-204,-166,-232,-92,-134,-193},{-109,-122,-135,-114,-177,-151},{-147,-203,-82,-179,-142,-148}},{{-217,-237,-213,-233,-118,-145},{-92,-201,-142,-142,-92,-92},{-124,-82,-126,-177,-187,-214},{-132,-180,-216,-126,-229,-89},{-174,-159,-151,-159,-103,-184},{-185,-171,-129,-100,-127,-132},{-179,-225,-196,-114,-127,-130},{-200,-184,-164,-235,-114,-233},{-95,-203,-167,-209,-142,-216},{-93,-132,-222,-93,-153,-97}}},{{{-180,-122,-120,-238,-340,-296},{-213,-249,-141,-273,-256,-312},{-210,-286,-120,-120,-217,-280},{-127,-277,-224,-152,-273,-261},{-143,-185,-259,-116,-328,-282},{-280,-206,-286,-273,-122,-164},{-337,-261,-245,-150,-166,-293},{-132,-296,-224,-143,-180,-185},{-305,-196,-252,-206,-180,-330},{-335,-148,-328,-157,-196,-323}},{{-217,-252,-169,-219,-268,-155},{-305,-169,-307,-152,-164,-238},{-245,-270,-268,-206,-249,-256},{-335,-335,-296,-141,-132,-210},{-187,-189,-173,-282,-134,-171},{-277,-316,-169,-243,-259,-136},{-146,-185,-305,-333,-166,-326},{-293,-139,-178,-166,-263,-305},{-286,-118,-316,-201,-284,-252},{-316,-346,-210,-303,-150,-268}},{{-215,-280,-116,-231,-300,-194},{-312,-152,-266,-298,-243,-169},{-293,-286,-224,-289,-247,-321},{-199,-326,-159,-120,-286,-263},{-342,-171,-210,-326,-192,-286},{-116,-314,-340,-282,-323,-231},{-328,-337,-296,-293,-208,-310},{-307,-268,-300,-157,-344,-134},{-277,-229,-143,-187,-326,-180},{-194,-259,-243,-226,-298,-127}}},{{{-154,-326,-154,-304,-180,-219},{-176,-247,-182,-145,-215,-124},{-182,-200,-156,-139,-163,-269},{-215,-247,-132,-189,-293,-130},{-135,-206,-304,-263,-189,-182},{-161,-169,-206,-226,-224,-143},{-208,-260,-208,-132,-269,-234},{-115,-323,-119,-148,-323,-254},{-200,-115,-126,-197,-132,-273},{-122,-167,-150,-247,-178,-295}},{{-187,-154,-108,-163,-119,-252},{-184,-252,-152,-293,-256,-135},{-117,-200,-224,-191,-286,-139},{-306,-241,-291,-252,-299,-321},{-130,-197,-310,-184,-178,-269},{-312,-217,-193,-317,-252,-132},{-232,-178,-135,-297,-204,-265},{-145,-306,-317,-200,-178,-130},{-317,-165,-284,-156,-263,-245},{-217,-263,-256,-315,-226,-195}},{{-282,-295,-263,-308,-213,-171},{-278,-310,-208,-317,-161,-219},{-128,-237,-132,-161,-284,-271},{-289,-326,-165,-150,-226,-169},{-141,-228,-113,-165,-308,-263},{-291,-182,-293,-258,-197,-224},{-191,-206,-161,-321,-165,-135},{-299,-234,-119,-126,-289,-202},{-321,-250,-215,-145,-284,-258},{-299,-241,-289,-323,-163,-280}}},{{{-253,-290,-202,-301,-325,-388},{-295,-184,-255,-295,-309,-271},{-354,-226,-138,-322,-370,-247},{-247,-362,-319,-144,-242,-226},{-356,-340,-237,-234,-274,-218},{-367,-343,-178,-165,-229,-396},{-359,-136,-290,-391,-189,-186},{-146,-383,-170,-176,-218,-231},{-181,-309,-383,-184,-234,-295},{-303,-356,-362,-269,-271,-250}},{{-380,-239,-239,-362,-309,-370},{-287,-388,-205,-386,-234,-202},{-221,-303,-309,-218,-364,-343},{-327,-325,-247,-157,-250,-192},{-378,-287,-285,-154,-306,-168},{-231,-314,-348,-317,-388,-346},{-301,-367,-152,-197,-141,-149},{-136,-173,-364,-266,-221,-245},{-325,-295,-322,-319,-181,-370},{-138,-309,-396,-168,-141,-154}},{{-325,-162,-223,-269,-277,-317},{-396,-378,-343,-229,-253,-144},{-263,-231,-205,-378,-274,-359},{-338,-168,-388,-396,-351,-146},{-356,-274,-247,-325,-239,-258},{-386,-309,-367,-335,-314,-317},{-218,-173,-394,-380,-386,-136},{-375,-229,-399,-282,-364,-242},{-327,-138,-266,-237,-380,-396},{-184,-391,-330,-202,-144,-378}}},{{{-358,-291,-325,-400,-328,-238},{-356,-314,-274,-202,-199,-417},{-344,-297,-216,-403,-339,-235},{-409,-386,-294,-347,-204,-224},{-157,-277,-339,-328,-356,-406},{-221,-406,-300,-420,-375,-204},{-171,-210,-283,-174,-199,-188},{-302,-288,-361,-193,-185,-221},{-328,-171,-188,-260,-364,-322},{-350,-277,-266,-308,-230,-182}},{{-235,-286,-316,-246,-207,-378},{-235,-160,-274,-283,-381,-168},{-291,-311,-316,-165,-151,-372},{-420,-420,-302,-182,-403,-300},{-291,-151,-414,-325,-266,-367},{-232,-381,-322,-168,-193,-165},{-160,-255,-216,-246,-160,-322},{-330,-322,-409,-210,-305,-386},{-160,-188,-386,-386,-179,-154},{-143,-221,-409,-319,-328,-389}},{{-146,-272,-274,-246,-154,-238},{-409,-350,-199,-325,-224,-330},{-218,-216,-171,-291,-358,-381},{-252,-375,-210,-328,-182,-157},{-370,-406,-218,-344,-280,-146},{-174,-409,-207,-414,-406,-356},{-277,-246,-291,-283,-409,-347},{-179,-325,-244,-252,-283,-277},{-241,-372,-378,-258,-283,-305},{-328,-381,-288,-238,-146,-305}}},{{{-364,-199,-168,-232,-179,-305},{-367,-269,-255,-370,-395,-347},{-266,-218,-193,-185,-308,-356},{-146,-386,-210,-288,-230,-249},{-322,-274,-148,-207,-367,-216},{-179,-272,-381,-263,-283,-232},{-325,-333,-333,-216,-204,-400},{-398,-314,-230,-409,-400,-230},{-154,-174,-160,-263,-274,-260},{-157,-409,-176,-316,-157,-350}},{{-291,-286,-336,-319,-176,-171},{-333,-162,-260,-325,-417,-258},{-255,-305,-157,-386,-269,-414},{-274,-255,-165,-344,-202,-274},{-263,-409,-224,-241,-140,-336},{-171,-347,-160,-246,-216,-330},{-286,-347,-241,-179,-148,-297},{-400,-283,-344,-148,-400,-330},{-350,-148,-384,-244,-339,-176},{-258,-412,-325,-314,-165,-342}},{{-294,-364,-367,-291,-227,-347},{-420,-171,-140,-260,-367,-260},{-400,-378,-238,-258,-294,-258},{-420,-414,-241,-185,-196,-221},{-193,-154,-230,-157,-283,-218},{-140,-286,-216,-420,-196,-381},{-168,-384,-258,-314,-389,-227},{-241,-171,-302,-235,-154,-252},{-311,-146,-417,-322,-330,-171},{-193,-386,-283,-190,-230,-151}}},{{{-143,-263,-372,-308,-378,-288},{-342,-350,-277,-249,-367,-202},{-294,-412,-367,-148,-202,-266},{-386,-258,-160,-165,-364,-249},{-372,-294,-263,-224,-165,-148},{-213,-339,-389,-246,-336,-300},{-283,-227,-140,-199,-333,-398},{-417,-356,-241,-372,-168,-420},{-381,-286,-244,-266,-232,-305},{-322,-210,-291,-168,-392,-403}},{{-174,-417,-196,-414,-218,-356},{-412,-151,-274,-381,-148,-246},{-154,-235,-342,-361,-319,-238},{-319,-199,-154,-207,-258,-221},{-291,-280,-381,-227,-403,-146},{-294,-143,-347,-375,-305,-165},{-249,-176,-249,-300,-381,-232},{-336,-232,-308,-375,-185,-255},{-386,-381,-160,-241,-258,-266},{-395,-333,-151,-154,-370,-213}},{{-196,-398,-148,-342,-356,-392},{-398,-288,-202,-414,-272,-417},{-372,-213,-400,-269,-286,-249},{-216,-246,-350,-367,-398,-314},{-151,-148,-207,-291,-336,-199},{-277,-403,-266,-258,-378,-291},{-414,-322,-305,-403,-190,-300},{-308,-395,-196,-230,-277,-221},{-330,-356,-294,-328,-378,-146},{-339,-333,-162,-213,-266,-333}}}}; // supply (positive for supply and negative for demand) under different scenarios 
int iniv[I]={2070,261,23,150,170,304,400,300,160}; // initial inventory 
int ubiv[I]={2740,522,414,300,341,608,800,600,320}; // the upper bounds of inventory 
int len[I1][I2]={{3,6,2,2,3,3,2,1}}; // 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,7.19,13.32,4.32,2.64,5.16,6.85,4.63,1.82}; // 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]={{6.54,12.11,3.93,2.4,4.69,6.23,4.21,1.65}}; // 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]={5.23,5.23,5.23,4.58,4.58,4.58,3.92,3.92,3.92,9.69,9.69,9.69,8.48,8.48,8.48,7.27,7.27,7.27,3.14,3.14,3.14,2.75,2.75,2.75,2.36,2.36,2.36,1.92,1.92,1.92,1.68,1.68,1.68,1.44,1.44,1.44,3.75,3.75,3.75,3.28,3.28,3.28,2.81,2.81,2.81,4.98,4.98,4.98,4.36,4.36,4.36,3.74,3.74,3.74,3.37,3.37,3.37,2.95,2.95,2.95,2.53,2.53,2.53,1.32,1.32,1.32,1.16,1.16,1.16,0.99,0.99,0.99}; // 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]={7,4,3,7,4,3,8,4,3,5,3,2,6,3,2,6,3,2,8,4,3,8,4,3,8,4,3,8,4,3,7,4,3,7,4,3,8,4,3,7,4,3,7,4,3,7,4,3,8,4,3,7,4,3,7,4,3,7,4,3,8,4,3,8,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}}; // set of shipments in each bid 
int SHsts[SPN]={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,2,8,14,0,2,4,6,8,10,12,14,0,4,8,12,2,8,14,2,4,6,8,10,1,5,9,1,7,1,3,5,7,9,11,1,5,9,2,8,0,2,4,6,8,10,1,5,9,0,6,1,3,5,7,9,11,13,15,2,6,10,14,2,8,14,0,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,0,6,12,0,2,4,6,8,10,12,14,0,4,8,12,0,6,12,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,1,5,9,13,2,8,14,1,3,5,7,9,11,13,2,6,10,14,1,7,13,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,0,6,12,0,2,4,6,8,10,12,14,1,5,9,13,1,7,13,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,2,4,6,8,10,12,14,1,5,9,13,1,7,13,0,2,4,6,8,10,12,14,2,6,10,14,2,8,14,2,4,6,8,10,12,14,16,1,5,9,13,2,8,14,1,3,5,7,9,11,13,15,2,6,10,14,2,8,14,2,4,6,8,10,12,14,16,2,6,10,14,2,8,14}; // set of start times of each shipment 
int SHets[SPN]={5,7,9,11,13,15,17,3,7,11,15,4,10,16,4,6,8,10,12,14,16,4,8,12,16,5,11,17,3,5,7,9,11,13,15,17,3,7,11,15,5,11,17,8,10,12,14,16,7,11,15,7,13,7,9,11,13,15,17,7,11,15,8,14,6,8,10,12,14,16,7,11,15,6,12,3,5,7,9,11,13,15,17,4,8,12,16,4,10,16,2,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,2,8,14,2,4,6,8,10,12,14,16,2,6,10,14,2,8,14,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,3,5,7,9,11,13,15,17,4,8,12,16,5,11,17,4,6,8,10,12,14,16,5,9,13,17,4,10,16,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,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,4,8,12,16,5,11,17,4,6,8,10,12,14,16,3,7,11,15,2,8,14,4,6,8,10,12,14,16,3,7,11,15,3,9,15,2,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,3,9,15,2,4,6,8,10,12,14,16,3,7,11,15,3,9,15,3,5,7,9,11,13,15,17,3,7,11,15,3,9,15}; // set of end times of each shipment 
