int Dev = 10;// 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 = 350;//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]={{{{12553,0,0,0,0,0},{12405,0,0,0,0,0},{12250,0,0,0,0,0},{12529,0,0,0,0,0},{12185,0,0,0,0,0},{12483,0,0,0,0,0},{12364,0,0,0,0,0},{12296,0,0,0,0,0},{12550,0,0,0,0,0},{12470,0,0,0,0,0}},{{12344,0,0,0,0,0},{12469,0,0,0,0,0},{12353,0,0,0,0,0},{12556,0,0,0,0,0},{12157,0,0,0,0,0},{12524,0,0,0,0,0},{12392,0,0,0,0,0},{12473,0,0,0,0,0},{12387,0,0,0,0,0},{12337,0,0,0,0,0}},{{11522,0,0,0,0,0},{11565,0,0,0,0,0},{11614,0,0,0,0,0},{11486,0,0,0,0,0},{11524,0,0,0,0,0},{11533,0,0,0,0,0},{11622,0,0,0,0,0},{11525,0,0,0,0,0},{11376,0,0,0,0,0},{11370,0,0,0,0,0}}},{{{-309,-323,-291,-270,-300,-320},{-303,-279,-300,-279,-323,-323},{-279,-282,-273,-268,-303,-320},{-320,-270,-312,-300,-270,-323},{-303,-270,-282,-265,-276,-265},{-294,-270,-270,-306,-320,-270},{-268,-312,-312,-323,-268,-297},{-320,-270,-285,-270,-279,-279},{-285,-268,-276,-265,-303,-265},{-309,-285,-268,-323,-297,-312}},{{-307,-277,-305,-263,-259,-246},{-304,-277,-274,-263,-259,-238},{-304,-312,-266,-285,-286,-269},{-281,-272,-260,-299,-275,-277},{-304,-280,-260,-279,-256,-249},{-313,-309,-252,-277,-254,-254},{-316,-263,-255,-282,-286,-267},{-276,-309,-300,-249,-286,-280},{-304,-312,-252,-285,-248,-277},{-261,-292,-297,-269,-288,-256}},{{-268,-235,-226,-202,-197,-204},{-235,-242,-247,-217,-225,-216},{-235,-254,-224,-228,-208,-192},{-240,-257,-235,-213,-218,-210},{-225,-240,-221,-215,-229,-185},{-250,-247,-249,-211,-201,-208},{-242,-254,-212,-242,-227,-210},{-270,-235,-228,-224,-214,-185},{-230,-220,-214,-208,-195,-214},{-230,-266,-224,-226,-203,-192}}},{{{-173,-155,-180,-179,-175,-174},{-183,-181,-168,-184,-195,-201},{-156,-154,-182,-175,-184,-176},{-185,-161,-166,-174,-177,-193},{-155,-171,-191,-181,-173,-172},{-156,-176,-186,-170,-197,-187},{-163,-184,-159,-172,-173,-183},{-163,-152,-180,-163,-190,-201},{-163,-174,-193,-193,-195,-206},{-151,-176,-158,-168,-201,-180}},{{-192,-205,-213,-228,-222,-240},{-194,-203,-204,-241,-213,-255},{-198,-187,-222,-232,-222,-262},{-192,-205,-228,-210,-211,-238},{-180,-209,-217,-230,-231,-228},{-216,-209,-207,-239,-234,-262},{-212,-217,-230,-234,-229,-245},{-186,-211,-234,-201,-218,-240},{-200,-223,-207,-210,-222,-236},{-198,-199,-226,-221,-213,-224}},{{-257,-247,-262,-289,-291,-291},{-262,-235,-267,-262,-299,-306},{-272,-252,-270,-248,-296,-308},{-249,-273,-244,-248,-263,-283},{-264,-280,-286,-246,-258,-300},{-247,-273,-238,-289,-283,-291},{-254,-252,-270,-262,-294,-272},{-245,-260,-272,-259,-260,-275},{-237,-265,-244,-251,-269,-297},{-222,-255,-241,-270,-249,-277}}},{{{-349,-326,-329,-309,-316,-319},{-299,-332,-339,-332,-313,-309},{-322,-339,-362,-342,-329,-359},{-306,-316,-296,-355,-342,-345},{-313,-336,-313,-306,-303,-359},{-309,-345,-359,-332,-313,-296},{-349,-326,-309,-342,-326,-349},{-355,-339,-316,-309,-316,-322},{-339,-313,-306,-355,-326,-316},{-349,-362,-339,-329,-339,-303}},{{-328,-319,-303,-320,-283,-307},{-358,-312,-332,-289,-308,-325},{-331,-306,-309,-317,-286,-301},{-354,-335,-329,-336,-336,-292},{-298,-299,-348,-295,-305,-325},{-335,-290,-329,-336,-283,-307},{-312,-293,-316,-339,-302,-286},{-321,-293,-319,-336,-296,-319},{-341,-296,-300,-330,-323,-325},{-321,-325,-293,-314,-339,-280}},{{-322,-276,-291,-258,-292,-234},{-304,-291,-297,-280,-278,-272},{-292,-268,-305,-264,-254,-278},{-295,-300,-277,-258,-286,-242},{-301,-294,-252,-275,-268,-234},{-298,-314,-255,-264,-286,-247},{-310,-274,-269,-286,-292,-283},{-295,-291,-283,-294,-284,-272},{-280,-297,-260,-277,-268,-265},{-324,-288,-255,-283,-254,-252}}},{{{-98,-108,-111,-123,-111,-116},{-113,-95,-111,-119,-116,-116},{-112,-104,-105,-129,-129,-132},{-105,-99,-121,-115,-129,-141},{-102,-112,-109,-124,-123,-133},{-106,-109,-106,-119,-134,-116},{-97,-103,-119,-124,-134,-137},{-116,-100,-109,-128,-112,-141},{-111,-103,-116,-105,-124,-115},{-111,-116,-110,-124,-122,-134}},{{-122,-127,-160,-163,-156,-173},{-148,-141,-138,-152,-175,-178},{-123,-135,-151,-143,-177,-161},{-134,-130,-149,-147,-169,-180},{-135,-127,-133,-169,-159,-163},{-138,-141,-145,-170,-156,-155},{-139,-145,-138,-164,-151,-160},{-138,-138,-158,-144,-145,-175},{-122,-149,-135,-161,-172,-183},{-135,-141,-142,-166,-163,-158}},{{-182,-167,-197,-186,-184,-186},{-175,-178,-193,-207,-176,-210},{-172,-187,-182,-194,-206,-194},{-189,-162,-169,-171,-206,-218},{-173,-185,-180,-175,-176,-180},{-159,-187,-195,-190,-192,-212},{-158,-182,-180,-190,-188,-206},{-180,-193,-186,-207,-188,-192},{-187,-171,-186,-184,-190,-202},{-163,-189,-167,-209,-184,-190}}},{{{-245,-255,-221,-233,-228,-259},{-235,-250,-224,-238,-248,-243},{-226,-245,-217,-228,-214,-221},{-219,-255,-240,-240,-240,-243},{-245,-228,-252,-255,-248,-238},{-249,-250,-217,-252,-228,-228},{-210,-217,-219,-217,-214,-231},{-231,-240,-243,-224,-243,-259},{-256,-226,-238,-252,-221,-259},{-249,-217,-214,-248,-248,-250}},{{-252,-248,-226,-217,-219,-219},{-250,-231,-251,-217,-224,-210},{-240,-219,-247,-249,-235,-201},{-245,-252,-214,-254,-242,-219},{-236,-231,-249,-238,-235,-225},{-238,-238,-242,-229,-226,-234},{-243,-214,-219,-236,-221,-203},{-252,-255,-242,-240,-210,-228},{-248,-252,-258,-245,-212,-210},{-233,-257,-223,-222,-231,-228}},{{-209,-199,-204,-181,-196,-184},{-204,-230,-216,-185,-189,-176},{-215,-205,-220,-195,-194,-176},{-196,-213,-186,-199,-194,-171},{-215,-201,-182,-207,-178,-176},{-196,-224,-210,-187,-181,-194},{-204,-211,-202,-209,-176,-180},{-206,-201,-196,-189,-178,-169},{-206,-203,-184,-203,-174,-193},{-219,-222,-198,-176,-193,-180}}},{{{-279,-263,-293,-274,-287,-279},{-242,-287,-266,-255,-290,-266},{-269,-242,-239,-250,-250,-253},{-245,-282,-258,-266,-266,-266},{-269,-263,-245,-242,-255,-285},{-269,-239,-266,-263,-277,-285},{-250,-269,-290,-255,-285,-258},{-266,-269,-258,-245,-266,-258},{-285,-290,-253,-271,-271,-279},{-255,-282,-258,-258,-290,-269}},{{-269,-253,-277,-250,-275,-285},{-269,-279,-285,-261,-270,-238},{-253,-250,-239,-242,-236,-249},{-245,-266,-287,-269,-265,-275},{-271,-277,-239,-250,-238,-241},{-274,-285,-290,-261,-283,-233},{-269,-250,-269,-277,-283,-241},{-261,-277,-245,-282,-262,-285},{-239,-253,-261,-287,-259,-256},{-282,-242,-258,-245,-246,-269}},{{-256,-268,-234,-270,-230,-227},{-236,-273,-247,-226,-220,-243},{-249,-261,-260,-236,-240,-243},{-285,-230,-257,-233,-250,-248},{-264,-256,-270,-226,-250,-253},{-241,-238,-227,-263,-257,-234},{-282,-245,-249,-223,-255,-222},{-241,-253,-229,-236,-267,-260},{-277,-266,-242,-241,-220,-224},{-254,-253,-249,-263,-233,-229}}},{{{-310,-274,-325,-325,-307,-326},{-304,-286,-331,-286,-298,-296},{-325,-289,-331,-298,-313,-281},{-331,-289,-298,-304,-304,-293},{-286,-322,-271,-277,-271,-275},{-274,-301,-322,-304,-316,-302},{-322,-280,-325,-295,-280,-311},{-319,-271,-289,-274,-325,-266},{-295,-322,-325,-325,-331,-290},{-286,-283,-274,-310,-298,-323}},{{-270,-293,-277,-270,-268,-249},{-272,-313,-308,-246,-249,-265},{-319,-264,-286,-248,-262,-262},{-316,-284,-288,-248,-281,-283},{-316,-281,-274,-259,-249,-239},{-275,-301,-274,-246,-273,-272},{-299,-258,-260,-246,-265,-278},{-302,-264,-288,-273,-238,-267},{-293,-270,-283,-278,-254,-231},{-281,-296,-263,-248,-286,-236}},{{-263,-242,-227,-228,-195,-196},{-255,-252,-215,-219,-208,-208},{-236,-245,-211,-199,-225,-196},{-248,-250,-211,-208,-201,-222},{-263,-254,-220,-212,-206,-192},{-246,-264,-231,-221,-204,-212},{-268,-264,-218,-239,-210,-182},{-258,-252,-213,-239,-220,-194},{-223,-247,-222,-243,-210,-204},{-228,-245,-229,-208,-233,-204}}},{{{-346,-343,-343,-364,-374,-336},{-374,-371,-315,-322,-322,-343},{-346,-350,-322,-350,-343,-332},{-364,-374,-364,-364,-371,-332},{-371,-357,-385,-340,-346,-322},{-368,-382,-374,-357,-346,-368},{-354,-364,-315,-357,-371,-346},{-378,-343,-332,-350,-382,-350},{-364,-343,-368,-322,-385,-364},{-360,-336,-346,-318,-368,-364}},{{-324,-312,-359,-337,-358,-319},{-331,-329,-353,-361,-328,-348},{-362,-340,-356,-327,-331,-351},{-351,-319,-349,-334,-315,-316},{-358,-312,-319,-314,-302,-325},{-369,-346,-329,-354,-351,-290},{-376,-336,-359,-337,-331,-341},{-313,-340,-373,-357,-325,-322},{-334,-319,-319,-357,-305,-351},{-334,-353,-370,-317,-348,-348}},{{-328,-299,-306,-293,-268,-275},{-309,-308,-270,-281,-268,-253},{-340,-317,-270,-299,-296,-303},{-312,-277,-321,-319,-279,-270},{-337,-330,-309,-299,-282,-300},{-299,-314,-285,-264,-299,-256},{-343,-286,-312,-275,-291,-267},{-290,-293,-270,-293,-314,-272},{-340,-280,-282,-319,-276,-286},{-321,-296,-282,-305,-276,-261}}}}; // 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,3,6,3,2,7,4,2,7,4,3,7,4,3,7,4,3,8,4,3,8,4,3,7,4,3,8,4,3,7,4,3,8,4,3,9,5,3,8,4,3,9,5,3,8,5,3,9,5,3,8,4,3,7,4,3,7,4,3,7,4,3,8,4,3,7,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},{343,344,345,346},{347,348,349}}; // set of shipments in each bid 
int SHsts[SPN]={1,3,5,7,9,11,0,4,8,12,0,6,12,2,4,6,8,10,12,1,5,9,1,7,0,2,4,6,8,10,12,0,4,8,12,1,7,1,3,5,7,9,11,13,0,4,8,12,2,8,14,2,4,6,8,10,12,14,1,5,9,13,2,8,14,1,3,5,7,9,11,13,1,5,9,13,1,7,13,1,3,5,7,9,11,13,15,2,6,10,14,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,0,4,8,12,0,6,12,0,2,4,6,8,10,12,14,2,6,10,14,1,7,13,2,4,6,8,10,12,14,2,6,10,14,0,6,12,0,2,4,6,8,10,12,14,2,6,10,14,1,7,13,0,2,4,6,8,10,12,14,16,0,4,8,12,16,1,7,13,2,4,6,8,10,12,14,16,2,6,10,14,2,8,14,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,0,4,8,12,16,0,6,12,0,2,4,6,8,10,12,14,16,0,4,8,12,16,0,6,12,2,4,6,8,10,12,14,16,1,5,9,13,1,7,13,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,2,6,10,14,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,1,5,9,13,0,6,12,0,2,4,6,8,10,12,14,2,6,10,14,0,6,12}; // set of start times of each shipment 
int SHets[SPN]={6,8,10,12,14,16,5,9,13,17,5,11,17,7,9,11,13,15,17,6,10,14,6,12,5,7,9,11,13,15,17,5,9,13,17,6,12,4,6,8,10,12,14,16,3,7,11,15,5,11,17,5,7,9,11,13,15,17,4,8,12,16,5,11,17,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,2,8,14,2,4,6,8,10,12,14,16,2,6,10,14,3,9,15,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,3,9,15,4,6,8,10,12,14,16,4,8,12,16,2,8,14,2,4,6,8,10,12,14,16,4,8,12,16,3,9,15,1,3,5,7,9,11,13,15,17,1,5,9,13,17,2,8,14,3,5,7,9,11,13,15,17,3,7,11,15,3,9,15,1,3,5,7,9,11,13,15,17,1,5,9,13,17,3,9,15,2,4,6,8,10,12,14,16,1,5,9,13,17,1,7,13,1,3,5,7,9,11,13,15,17,1,5,9,13,17,1,7,13,3,5,7,9,11,13,15,17,2,6,10,14,2,8,14,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,4,8,12,16,4,10,16,3,5,7,9,11,13,15,17,5,9,13,17,4,10,16,5,7,9,11,13,15,17,4,8,12,16,3,9,15,3,5,7,9,11,13,15,17,5,9,13,17,3,9,15}; // set of end times of each shipment 
