int Dev = 30;// 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 = 344;//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]={{{{12636,0,0,0,0,0},{12294,0,0,0,0,0},{12454,0,0,0,0,0},{12296,0,0,0,0,0},{12301,0,0,0,0,0},{12226,0,0,0,0,0},{11643,0,0,0,0,0},{12635,0,0,0,0,0},{12570,0,0,0,0,0},{12368,0,0,0,0,0}},{{12248,0,0,0,0,0},{12290,0,0,0,0,0},{12434,0,0,0,0,0},{12507,0,0,0,0,0},{12172,0,0,0,0,0},{12594,0,0,0,0,0},{11870,0,0,0,0,0},{12513,0,0,0,0,0},{12619,0,0,0,0,0},{12565,0,0,0,0,0}},{{11274,0,0,0,0,0},{11782,0,0,0,0,0},{11567,0,0,0,0,0},{11657,0,0,0,0,0},{11660,0,0,0,0,0},{11600,0,0,0,0,0},{11349,0,0,0,0,0},{11924,0,0,0,0,0},{11962,0,0,0,0,0},{11206,0,0,0,0,0}}},{{{-279,-312,-356,-347,-209,-368},{-382,-273,-370,-226,-382,-270},{-315,-244,-356,-262,-253,-215},{-279,-359,-300,-220,-306,-353},{-206,-303,-288,-315,-320,-359},{-215,-209,-326,-326,-347,-376},{-370,-320,-223,-288,-209,-218},{-256,-262,-306,-312,-273,-312},{-229,-238,-326,-241,-370,-368},{-276,-323,-291,-318,-297,-268}},{{-302,-200,-361,-312,-336,-249},{-374,-312,-291,-230,-344,-303},{-252,-369,-227,-271,-211,-269},{-290,-212,-358,-353,-315,-313},{-273,-352,-277,-334,-318,-186},{-351,-252,-241,-241,-200,-212},{-255,-337,-288,-222,-275,-212},{-267,-300,-207,-304,-238,-329},{-296,-317,-241,-203,-243,-332},{-220,-263,-230,-211,-283,-225}},{{-265,-194,-193,-175,-212,-183},{-308,-223,-261,-202,-268,-183},{-175,-257,-219,-206,-242,-235},{-308,-271,-263,-164,-214,-210},{-242,-293,-207,-249,-212,-159},{-210,-305,-282,-237,-263,-190},{-318,-305,-172,-177,-165,-222},{-248,-276,-287,-240,-246,-192},{-242,-244,-231,-204,-216,-179},{-258,-261,-203,-291,-272,-177}}},{{{-198,-191,-135,-226,-224,-181},{-119,-216,-168,-152,-219,-239},{-212,-171,-177,-177,-223,-233},{-205,-162,-208,-195,-217,-147},{-155,-188,-212,-141,-184,-216},{-129,-189,-210,-166,-167,-153},{-192,-127,-145,-134,-173,-172},{-166,-220,-163,-127,-219,-191},{-215,-216,-178,-174,-237,-204},{-150,-166,-187,-159,-177,-178}},{{-214,-189,-162,-172,-238,-250},{-184,-156,-160,-219,-266,-209},{-154,-160,-262,-201,-234,-286},{-218,-182,-179,-225,-227,-257},{-170,-172,-232,-236,-279,-240},{-182,-162,-215,-194,-295,-295},{-182,-240,-226,-250,-247,-214},{-184,-152,-166,-199,-190,-186},{-145,-176,-222,-287,-277,-186},{-152,-226,-207,-252,-204,-259}},{{-301,-245,-259,-251,-258,-283},{-200,-230,-244,-292,-277,-218},{-212,-275,-189,-324,-249,-272},{-301,-329,-202,-310,-299,-306},{-284,-303,-286,-251,-199,-348},{-217,-329,-341,-256,-208,-365},{-311,-283,-314,-254,-213,-215},{-267,-314,-217,-324,-294,-334},{-259,-268,-328,-300,-360,-331},{-230,-212,-191,-302,-349,-289}}},{{{-378,-415,-415,-247,-293,-378},{-230,-293,-378,-375,-372,-270},{-368,-428,-276,-299,-385,-392},{-392,-253,-332,-306,-253,-260},{-234,-243,-237,-286,-303,-355},{-326,-322,-336,-355,-257,-290},{-280,-299,-368,-309,-378,-286},{-365,-257,-372,-411,-322,-398},{-263,-250,-243,-286,-362,-362},{-290,-368,-405,-309,-322,-385}},{{-246,-309,-236,-279,-373,-280},{-384,-377,-249,-236,-323,-346},{-410,-406,-345,-361,-370,-268},{-374,-345,-335,-270,-231,-301},{-272,-267,-246,-399,-259,-376},{-325,-345,-357,-267,-400,-337},{-289,-345,-249,-292,-317,-349},{-423,-232,-268,-408,-379,-364},{-282,-251,-389,-339,-363,-364},{-269,-396,-367,-405,-379,-274}},{{-304,-219,-286,-275,-297,-208},{-212,-213,-330,-267,-246,-229},{-348,-302,-286,-302,-318,-242},{-268,-245,-336,-348,-186,-257},{-322,-297,-274,-196,-231,-311},{-209,-305,-314,-193,-191,-272},{-263,-279,-286,-272,-265,-234},{-268,-334,-339,-231,-193,-252},{-248,-282,-339,-239,-273,-314},{-310,-337,-328,-261,-188,-236}}},{{{-81,-78,-137,-136,-96,-110},{-105,-123,-127,-103,-87,-145},{-104,-106,-83,-139,-85,-113},{-134,-120,-130,-139,-100,-145},{-110,-88,-127,-143,-85,-97},{-102,-113,-121,-88,-117,-155},{-102,-117,-102,-143,-111,-159},{-101,-112,-125,-137,-132,-93},{-98,-122,-125,-97,-137,-110},{-77,-80,-132,-144,-135,-148}},{{-144,-168,-170,-149,-119,-153},{-154,-116,-130,-163,-148,-175},{-136,-107,-105,-140,-208,-217},{-127,-148,-184,-113,-159,-186},{-119,-142,-107,-198,-195,-185},{-150,-165,-135,-133,-143,-155},{-167,-172,-133,-133,-200,-165},{-176,-110,-166,-163,-190,-208},{-146,-158,-176,-180,-172,-205},{-134,-114,-154,-138,-147,-186}},{{-150,-157,-177,-215,-139,-222},{-226,-178,-151,-243,-188,-170},{-224,-171,-173,-196,-184,-216},{-170,-173,-205,-215,-153,-196},{-168,-182,-179,-137,-221,-244},{-226,-214,-154,-215,-190,-220},{-130,-182,-201,-186,-149,-253},{-198,-160,-229,-220,-245,-206},{-177,-131,-156,-139,-251,-251},{-164,-200,-186,-175,-157,-200}}},{{{-263,-243,-214,-181,-171,-183},{-179,-183,-269,-283,-224,-257},{-179,-259,-200,-262,-267,-169},{-275,-264,-248,-214,-298,-171},{-214,-195,-178,-193,-248,-171},{-289,-167,-293,-243,-295,-224},{-282,-219,-217,-207,-190,-207},{-291,-217,-190,-200,-255,-217},{-207,-171,-286,-188,-238,-212},{-261,-212,-219,-250,-233,-274}},{{-186,-217,-237,-270,-276,-221},{-198,-193,-247,-280,-183,-179},{-221,-278,-204,-171,-194,-221},{-240,-269,-195,-178,-246,-228},{-171,-248,-263,-210,-237,-212},{-240,-298,-306,-231,-221,-223},{-207,-278,-202,-182,-158,-172},{-252,-255,-266,-199,-179,-155},{-171,-300,-186,-208,-294,-214},{-178,-307,-306,-249,-255,-219}},{{-189,-178,-196,-207,-213,-153},{-185,-182,-196,-170,-206,-209},{-275,-270,-174,-238,-133,-151},{-230,-167,-238,-248,-181,-162},{-245,-186,-162,-144,-243,-211},{-262,-163,-210,-209,-191,-140},{-191,-236,-180,-179,-208,-133},{-273,-226,-188,-168,-196,-160},{-159,-205,-244,-142,-232,-225},{-187,-228,-147,-250,-140,-146}}},{{{-202,-223,-301,-271,-229,-245},{-247,-271,-239,-325,-194,-314},{-207,-322,-247,-295,-327,-325},{-242,-197,-298,-325,-192,-279},{-293,-338,-231,-338,-245,-200},{-309,-239,-322,-218,-255,-295},{-194,-274,-189,-210,-192,-261},{-322,-186,-231,-231,-295,-261},{-327,-205,-327,-271,-311,-237},{-218,-234,-189,-245,-194,-205}},{{-239,-237,-231,-298,-312,-269},{-221,-207,-210,-261,-259,-275},{-223,-239,-269,-309,-267,-295},{-303,-250,-234,-293,-288,-223},{-298,-207,-223,-234,-288,-186},{-306,-319,-335,-282,-254,-285},{-186,-247,-279,-197,-299,-199},{-239,-205,-247,-255,-301,-189},{-255,-314,-346,-271,-191,-277},{-301,-229,-218,-245,-183,-267}},{{-254,-278,-280,-203,-318,-193},{-303,-268,-315,-320,-243,-280},{-269,-228,-207,-288,-194,-255},{-223,-309,-179,-236,-189,-229},{-231,-220,-202,-186,-223,-214},{-326,-291,-320,-238,-257,-301},{-280,-192,-325,-228,-267,-265},{-267,-238,-224,-174,-289,-253},{-236,-258,-305,-258,-174,-251},{-332,-202,-209,-206,-181,-171}}},{{{-268,-367,-235,-385,-337,-352},{-247,-271,-337,-256,-265,-367},{-355,-349,-259,-376,-388,-240},{-277,-310,-319,-214,-346,-358},{-367,-235,-211,-340,-301,-382},{-277,-247,-328,-262,-370,-302},{-298,-295,-322,-388,-211,-231},{-292,-289,-319,-376,-301,-364},{-226,-331,-388,-262,-298,-305},{-316,-259,-250,-361,-370,-323}},{{-229,-204,-277,-262,-212,-275},{-311,-278,-328,-254,-186,-296},{-246,-210,-314,-270,-193,-316},{-366,-221,-333,-298,-233,-203},{-381,-321,-230,-216,-246,-221},{-305,-342,-227,-276,-310,-190},{-281,-373,-221,-308,-270,-221},{-223,-330,-227,-319,-294,-211},{-220,-296,-263,-248,-310,-252},{-237,-353,-241,-341,-246,-332}},{{-186,-300,-250,-164,-204,-238},{-268,-245,-206,-281,-231,-230},{-260,-283,-176,-252,-197,-248},{-176,-252,-185,-177,-254,-220},{-290,-266,-229,-225,-267,-214},{-184,-173,-185,-256,-191,-143},{-231,-271,-195,-188,-237,-192},{-233,-175,-181,-241,-214,-143},{-265,-293,-259,-276,-276,-255},{-248,-266,-250,-217,-237,-222}}},{{{-312,-368,-382,-410,-312,-392},{-336,-259,-329,-416,-301,-301},{-343,-406,-287,-276,-248,-252},{-266,-427,-371,-256,-298,-336},{-452,-350,-389,-444,-434,-357},{-406,-301,-290,-273,-262,-364},{-287,-357,-298,-287,-350,-452},{-455,-340,-448,-402,-245,-276},{-385,-399,-441,-452,-312,-340},{-392,-455,-280,-308,-406,-329}},{{-421,-388,-414,-354,-338,-270},{-386,-254,-302,-431,-377,-325},{-244,-305,-278,-418,-361,-419},{-358,-292,-329,-311,-318,-396},{-407,-319,-288,-281,-358,-293},{-386,-329,-247,-381,-246,-303},{-331,-394,-342,-271,-239,-254},{-452,-394,-359,-424,-384,-345},{-303,-405,-427,-237,-279,-402},{-435,-418,-403,-281,-259,-367}},{{-277,-280,-330,-319,-282,-314},{-255,-394,-231,-346,-353,-306},{-252,-216,-333,-246,-294,-311},{-362,-240,-387,-337,-222,-325},{-387,-357,-369,-355,-219,-220},{-406,-305,-264,-226,-200,-253},{-287,-228,-285,-226,-362,-314},{-312,-397,-291,-305,-331,-331},{-227,-219,-270,-284,-339,-348},{-258,-222,-264,-231,-362,-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]={6,4,3,6,3,3,6,4,2,7,4,3,7,4,3,8,4,3,7,4,3,8,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,8,4,3,8,4,3,8,4,3,8,4,3,8,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}}; // set of shipments in each bid 
int SHsts[SPN]={2,4,6,8,10,12,0,4,8,12,0,6,12,2,4,6,8,10,12,1,5,9,0,6,12,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,2,6,10,14,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,2,6,10,14,2,8,14,1,3,5,7,9,11,13,15,1,5,9,13,1,7,13,1,3,5,7,9,11,13,15,1,5,9,13,1,7,13,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,2,4,6,8,10,12,14,0,4,8,12,2,8,14,1,3,5,7,9,11,13,15,2,6,10,14,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,1,5,9,13,0,6,12,1,3,5,7,9,11,13,15,1,5,9,13,0,6,12,2,4,6,8,10,12,14,16,1,5,9,13,0,6,12,1,3,5,7,9,11,13,15,2,6,10,14,0,6,12,0,2,4,6,8,10,12,14,1,5,9,13,2,8,14,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,0,6,12,0,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,0,6,12,1,3,5,7,9,11,13,0,4,8,12,1,7,13}; // set of start times of each shipment 
int SHets[SPN]={7,9,11,13,15,17,5,9,13,17,5,11,17,7,9,11,13,15,17,6,10,14,5,11,17,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,5,9,13,17,4,10,16,3,5,7,9,11,13,15,17,5,9,13,17,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,3,7,11,15,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,4,8,12,16,3,9,15,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,4,10,16,2,4,6,8,10,12,14,16,3,7,11,15,1,7,13,2,4,6,8,10,12,14,16,2,6,10,14,1,7,13,2,4,6,8,10,12,14,16,2,6,10,14,1,7,13,2,4,6,8,10,12,14,16,2,6,10,14,1,7,13,3,5,7,9,11,13,15,17,2,6,10,14,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,4,10,16,2,4,6,8,10,12,14,16,2,6,10,14,4,10,16,3,5,7,9,11,13,15,17,2,6,10,14,2,8,14,3,5,7,9,11,13,15,17,3,7,11,15,5,11,17,5,7,9,11,13,15,17,4,8,12,16,3,9,15,4,6,8,10,12,14,16,3,7,11,15,4,10,16}; // set of end times of each shipment 
