int Dev = 20;// 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 = 346;//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]={{{{12265,0,0,0,0,0},{12558,0,0,0,0,0},{11913,0,0,0,0,0},{12246,0,0,0,0,0},{12395,0,0,0,0,0},{12337,0,0,0,0,0},{12756,0,0,0,0,0},{12775,0,0,0,0,0},{12400,0,0,0,0,0},{12603,0,0,0,0,0}},{{12196,0,0,0,0,0},{12495,0,0,0,0,0},{12195,0,0,0,0,0},{12271,0,0,0,0,0},{12504,0,0,0,0,0},{12374,0,0,0,0,0},{12262,0,0,0,0,0},{12171,0,0,0,0,0},{12687,0,0,0,0,0},{12621,0,0,0,0,0}},{{11450,0,0,0,0,0},{11644,0,0,0,0,0},{11495,0,0,0,0,0},{11320,0,0,0,0,0},{11468,0,0,0,0,0},{11600,0,0,0,0,0},{11633,0,0,0,0,0},{11584,0,0,0,0,0},{11504,0,0,0,0,0},{11320,0,0,0,0,0}}},{{{-297,-270,-279,-276,-270,-279},{-329,-276,-273,-312,-303,-332},{-250,-268,-303,-256,-279,-270},{-303,-247,-320,-300,-329,-241},{-318,-344,-262,-335,-309,-279},{-288,-303,-250,-332,-320,-250},{-341,-288,-315,-323,-329,-332},{-273,-285,-270,-294,-279,-300},{-262,-288,-276,-335,-285,-338},{-335,-270,-256,-318,-332,-300}},{{-331,-269,-238,-249,-251,-231},{-299,-286,-227,-247,-320,-259},{-310,-295,-252,-263,-246,-251},{-313,-246,-252,-321,-259,-218},{-235,-335,-238,-222,-219,-280},{-249,-249,-246,-258,-318,-241},{-336,-235,-274,-236,-259,-262},{-313,-232,-230,-263,-224,-282},{-328,-332,-291,-288,-286,-290},{-241,-257,-322,-315,-318,-220}},{{-265,-283,-198,-260,-235,-208},{-232,-247,-259,-228,-201,-179},{-282,-230,-261,-202,-240,-181},{-272,-269,-219,-208,-229,-231},{-228,-254,-280,-202,-242,-218},{-298,-281,-189,-188,-250,-216},{-235,-208,-193,-211,-188,-208},{-270,-203,-266,-264,-182,-181},{-202,-218,-268,-188,-199,-198},{-260,-276,-277,-220,-203,-177}}},{{{-160,-166,-159,-175,-190,-216},{-192,-199,-205,-163,-178,-178},{-180,-179,-189,-199,-151,-174},{-185,-169,-158,-197,-173,-214},{-185,-193,-158,-192,-199,-225},{-160,-186,-170,-166,-167,-176},{-178,-179,-173,-188,-212,-168},{-134,-196,-182,-177,-202,-202},{-134,-183,-206,-177,-162,-191},{-197,-196,-142,-208,-171,-223}},{{-184,-213,-198,-214,-195,-238},{-190,-164,-177,-252,-208,-243},{-192,-236,-215,-179,-263,-262},{-228,-211,-253,-179,-236,-236},{-164,-228,-256,-236,-240,-278},{-168,-201,-245,-245,-245,-202},{-174,-217,-256,-192,-261,-233},{-218,-170,-196,-210,-275,-259},{-226,-221,-234,-236,-192,-269},{-234,-236,-200,-236,-197,-190}},{{-205,-242,-241,-281,-224,-340},{-230,-252,-215,-267,-324,-311},{-235,-240,-280,-284,-307,-252},{-217,-214,-278,-275,-280,-232},{-227,-245,-249,-256,-269,-320},{-240,-293,-304,-267,-241,-340},{-269,-273,-233,-292,-263,-308},{-291,-283,-257,-300,-302,-275},{-287,-286,-225,-267,-324,-260},{-264,-209,-286,-316,-291,-246}}},{{{-266,-283,-283,-392,-355,-290},{-283,-375,-342,-372,-359,-336},{-276,-280,-303,-290,-309,-309},{-280,-270,-352,-339,-293,-345},{-339,-355,-362,-270,-359,-345},{-339,-375,-329,-290,-303,-355},{-368,-322,-339,-329,-336,-306},{-283,-339,-270,-378,-362,-352},{-273,-352,-395,-342,-319,-319},{-319,-355,-316,-286,-368,-349}},{{-361,-338,-383,-308,-268,-241},{-285,-338,-364,-314,-367,-343},{-285,-367,-354,-267,-336,-268},{-318,-328,-345,-273,-326,-307},{-384,-348,-293,-349,-348,-241},{-312,-325,-303,-342,-286,-343},{-285,-280,-370,-345,-326,-328},{-364,-280,-290,-339,-256,-343},{-354,-348,-348,-311,-290,-256},{-295,-264,-287,-371,-370,-346}},{{-289,-334,-269,-288,-212,-260},{-342,-256,-322,-234,-315,-208},{-289,-239,-238,-231,-284,-208},{-283,-236,-230,-267,-246,-213},{-307,-242,-258,-231,-260,-283},{-333,-314,-241,-250,-270,-242},{-289,-265,-269,-269,-215,-283},{-251,-317,-297,-250,-289,-283},{-348,-256,-322,-267,-289,-290},{-313,-291,-286,-277,-244,-247}}},{{{-92,-85,-95,-106,-111,-133},{-93,-105,-96,-96,-99,-120},{-112,-87,-112,-117,-138,-122},{-113,-89,-118,-121,-123,-109},{-94,-87,-103,-113,-138,-122},{-109,-127,-130,-96,-131,-105},{-106,-87,-123,-132,-121,-106},{-98,-98,-118,-117,-113,-113},{-97,-89,-92,-95,-126,-125},{-92,-102,-113,-104,-101,-127}},{{-117,-165,-161,-135,-155,-173},{-157,-130,-163,-174,-151,-197},{-122,-142,-158,-164,-169,-166},{-153,-138,-118,-167,-156,-143},{-108,-131,-145,-150,-156,-181},{-162,-117,-133,-167,-137,-176},{-113,-145,-138,-163,-163,-186},{-147,-113,-126,-127,-169,-171},{-139,-137,-173,-180,-180,-198},{-154,-124,-160,-167,-187,-180}},{{-161,-178,-160,-222,-172,-228},{-189,-158,-182,-224,-180,-214},{-200,-211,-221,-190,-184,-160},{-182,-166,-153,-211,-167,-238},{-198,-189,-171,-169,-159,-232},{-175,-149,-153,-154,-192,-230},{-186,-203,-208,-224,-225,-220},{-173,-180,-156,-222,-157,-184},{-156,-153,-160,-218,-206,-160},{-145,-198,-164,-156,-221,-234}}},{{{-186,-283,-255,-278,-207,-238},{-277,-202,-214,-271,-262,-236},{-203,-240,-269,-248,-198,-236},{-200,-195,-252,-286,-198,-226},{-242,-193,-278,-252,-224,-224},{-224,-212,-276,-271,-264,-238},{-280,-283,-278,-255,-193,-245},{-217,-226,-281,-259,-190,-250},{-273,-250,-271,-278,-255,-236},{-245,-214,-231,-259,-238,-264}},{{-281,-286,-263,-196,-217,-228},{-278,-248,-207,-268,-242,-259},{-200,-190,-207,-261,-197,-181},{-269,-236,-200,-185,-201,-217},{-248,-240,-214,-254,-199,-186},{-278,-264,-204,-203,-246,-265},{-219,-238,-273,-203,-242,-241},{-231,-259,-228,-210,-217,-181},{-198,-195,-230,-261,-188,-208},{-228,-267,-212,-215,-208,-241}},{{-224,-236,-226,-177,-153,-187},{-226,-230,-162,-191,-174,-212},{-230,-242,-172,-232,-213,-203},{-219,-167,-230,-205,-194,-146},{-206,-215,-224,-185,-194,-171},{-258,-236,-212,-172,-213,-169},{-243,-201,-192,-234,-181,-187},{-213,-192,-206,-215,-183,-149},{-187,-192,-204,-224,-217,-153},{-243,-186,-180,-174,-178,-211}}},{{{-295,-303,-258,-213,-215,-314},{-314,-277,-213,-290,-242,-277},{-303,-242,-221,-311,-295,-274},{-266,-314,-226,-279,-290,-311},{-245,-242,-245,-245,-221,-282},{-231,-253,-226,-317,-277,-221},{-319,-221,-285,-295,-274,-290},{-277,-295,-285,-301,-306,-295},{-282,-301,-229,-282,-223,-277},{-237,-266,-314,-314,-303,-234}},{{-306,-213,-295,-255,-215,-293},{-287,-293,-303,-221,-301,-243},{-239,-298,-239,-258,-217,-275},{-229,-245,-301,-223,-225,-256},{-295,-215,-258,-306,-233,-259},{-213,-319,-271,-255,-270,-241},{-231,-223,-213,-223,-301,-280},{-261,-282,-255,-306,-228,-298},{-290,-295,-234,-311,-307,-246},{-255,-317,-285,-258,-259,-272}},{{-259,-220,-290,-206,-272,-193},{-293,-281,-272,-263,-225,-231},{-293,-299,-272,-258,-230,-219},{-254,-281,-217,-255,-279,-210},{-225,-205,-207,-213,-223,-272},{-241,-205,-297,-275,-277,-227},{-256,-299,-227,-223,-203,-200},{-308,-202,-207,-283,-220,-275},{-228,-238,-297,-295,-284,-212},{-275,-288,-257,-208,-213,-246}}},{{{-304,-274,-343,-325,-325,-320},{-307,-265,-292,-280,-256,-314},{-337,-301,-253,-280,-283,-323},{-349,-319,-280,-334,-292,-275},{-262,-343,-325,-301,-274,-305},{-253,-349,-253,-328,-280,-272},{-349,-313,-250,-292,-331,-290},{-334,-355,-265,-328,-319,-314},{-301,-268,-295,-286,-328,-296},{-349,-259,-253,-340,-352,-349}},{{-249,-287,-308,-281,-270,-218},{-272,-253,-314,-276,-249,-247},{-302,-313,-269,-240,-215,-254},{-314,-330,-258,-268,-236,-272},{-284,-316,-283,-319,-278,-283},{-261,-247,-300,-319,-315,-236},{-296,-278,-235,-303,-238,-267},{-352,-296,-291,-276,-260,-257},{-352,-290,-269,-289,-289,-298},{-340,-273,-241,-325,-297,-296}},{{-233,-276,-227,-225,-193,-162},{-236,-233,-211,-234,-227,-208},{-243,-269,-195,-197,-227,-198},{-295,-194,-234,-208,-195,-228},{-265,-252,-254,-214,-218,-230},{-255,-288,-238,-192,-176,-188},{-213,-209,-275,-228,-233,-184},{-203,-218,-243,-203,-199,-210},{-278,-211,-243,-179,-225,-204},{-260,-204,-192,-250,-180,-184}}},{{{-290,-389,-336,-410,-322,-354},{-326,-413,-343,-357,-416,-298},{-298,-364,-329,-290,-354,-308},{-280,-315,-287,-350,-332,-402},{-315,-280,-326,-280,-420,-385},{-336,-326,-385,-290,-420,-378},{-368,-374,-287,-332,-357,-294},{-399,-329,-357,-357,-416,-385},{-315,-308,-294,-357,-332,-402},{-315,-332,-354,-318,-385,-298}},{{-278,-405,-271,-367,-279,-319},{-296,-285,-329,-277,-312,-380},{-320,-340,-403,-397,-302,-316},{-376,-381,-397,-327,-308,-293},{-317,-398,-390,-287,-394,-283},{-341,-364,-400,-271,-318,-303},{-372,-377,-342,-321,-305,-264},{-313,-319,-298,-324,-371,-261},{-313,-274,-302,-301,-344,-296},{-320,-316,-376,-301,-358,-290}},{{-375,-249,-285,-267,-299,-261},{-353,-330,-291,-249,-271,-272},{-284,-259,-249,-278,-314,-270},{-375,-265,-267,-346,-268,-272},{-340,-286,-357,-246,-271,-306},{-302,-256,-246,-234,-305,-328},{-359,-317,-306,-290,-305,-331},{-356,-348,-285,-240,-282,-311},{-265,-290,-288,-284,-331,-228},{-271,-249,-324,-237,-256,-253}}}}; // 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]={7,3,2,6,4,2,6,3,2,7,4,3,8,4,3,7,4,3,8,4,3,8,4,3,8,4,3,8,4,3,8,4,3,7,4,3,8,4,3,8,4,3,8,4,3,9,4,3,9,4,3,8,4,3,8,4,3,8,4,3,7,4,3,8,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}}; // set of shipments in each bid 
int SHsts[SPN]={0,2,4,6,8,10,12,2,6,10,2,8,2,4,6,8,10,12,0,4,8,12,1,7,2,4,6,8,10,12,1,5,9,2,8,1,3,5,7,9,11,13,0,4,8,12,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,1,5,9,13,2,8,14,0,2,4,6,8,10,12,14,1,5,9,13,1,7,13,1,3,5,7,9,11,13,15,1,5,9,13,2,8,14,0,2,4,6,8,10,12,14,1,5,9,13,0,6,12,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,2,8,14,2,4,6,8,10,12,14,2,6,10,14,1,7,13,2,4,6,8,10,12,14,16,2,6,10,14,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,1,7,13,0,2,4,6,8,10,12,14,16,1,5,9,13,2,8,14,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,1,7,13,0,2,4,6,8,10,12,14,2,6,10,14,2,8,14,1,3,5,7,9,11,13,15,2,6,10,14,1,7,13,2,4,6,8,10,12,14,2,6,10,14,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,2,8,14,2,4,6,8,10,12,14,0,4,8,12,2,8,14}; // set of start times of each shipment 
int SHets[SPN]={5,7,9,11,13,15,17,7,11,15,7,13,7,9,11,13,15,17,5,9,13,17,6,12,7,9,11,13,15,17,6,10,14,7,13,4,6,8,10,12,14,16,3,7,11,15,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,4,8,12,16,5,11,17,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,4,10,16,2,4,6,8,10,12,14,16,3,7,11,15,2,8,14,3,5,7,9,11,13,15,17,3,7,11,15,2,8,14,3,5,7,9,11,13,15,17,4,8,12,16,4,10,16,4,6,8,10,12,14,16,4,8,12,16,3,9,15,3,5,7,9,11,13,15,17,3,7,11,15,1,7,13,2,4,6,8,10,12,14,16,3,7,11,15,1,7,13,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,3,9,15,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,2,8,14,2,4,6,8,10,12,14,16,4,8,12,16,4,10,16,3,5,7,9,11,13,15,17,4,8,12,16,3,9,15,4,6,8,10,12,14,16,4,8,12,16,3,9,15,3,5,7,9,11,13,15,17,4,8,12,16,3,9,15,4,6,8,10,12,14,16,4,8,12,16,5,11,17,5,7,9,11,13,15,17,3,7,11,15,5,11,17}; // set of end times of each shipment 
