int Dev = 40;// Deviation
extern const int CNN = 2;// 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]={{{{10957,0,0,0,0,0},{11627,0,0,0,0,0},{10799,0,0,0,0,0},{11132,0,0,0,0,0},{10805,0,0,0,0,0},{12068,0,0,0,0,0},{10577,0,0,0,0,0},{10659,0,0,0,0,0},{10743,0,0,0,0,0},{11252,0,0,0,0,0}},{{10984,0,0,0,0,0},{10341,0,0,0,0,0},{10892,0,0,0,0,0},{10377,0,0,0,0,0},{11296,0,0,0,0,0},{10747,0,0,0,0,0},{11015,0,0,0,0,0},{10662,0,0,0,0,0},{10646,0,0,0,0,0},{11645,0,0,0,0,0}},{{10838,0,0,0,0,0},{10659,0,0,0,0,0},{11019,0,0,0,0,0},{11013,0,0,0,0,0},{11507,0,0,0,0,0},{10795,0,0,0,0,0},{11076,0,0,0,0,0},{10684,0,0,0,0,0},{11165,0,0,0,0,0},{11203,0,0,0,0,0}}},{{{-146,-188,-278,-161,-228,-240},{-186,-240,-284,-249,-228,-291},{-134,-204,-188,-143,-289,-217},{-161,-273,-233,-148,-293,-287},{-222,-175,-150,-184,-197,-282},{-143,-269,-267,-249,-224,-293},{-159,-181,-206,-157,-161,-179},{-296,-269,-305,-217,-244,-258},{-235,-251,-220,-150,-146,-222},{-175,-166,-228,-258,-168,-273}},{{-197,-177,-231,-199,-305,-228},{-172,-141,-184,-267,-226,-166},{-302,-181,-260,-311,-253,-309},{-166,-141,-255,-305,-264,-309},{-157,-291,-235,-305,-204,-179},{-307,-159,-215,-231,-260,-206},{-150,-302,-188,-190,-199,-143},{-293,-137,-211,-186,-211,-291},{-177,-291,-228,-249,-242,-137},{-155,-134,-314,-195,-146,-166}},{{-255,-231,-244,-278,-305,-307},{-235,-197,-305,-152,-204,-152},{-177,-199,-296,-291,-309,-179},{-152,-186,-134,-172,-302,-150},{-217,-264,-177,-296,-298,-282},{-251,-280,-184,-309,-226,-150},{-175,-211,-226,-157,-164,-273},{-197,-242,-289,-287,-159,-152},{-255,-233,-258,-141,-237,-141},{-208,-172,-177,-217,-253,-253}}},{{{-331,-214,-169,-300,-259,-226},{-219,-145,-305,-307,-290,-278},{-326,-186,-155,-300,-257,-278},{-224,-207,-164,-145,-167,-233},{-224,-331,-167,-290,-255,-157},{-278,-274,-221,-162,-324,-176},{-293,-178,-243,-240,-305,-321},{-283,-188,-312,-202,-288,-150},{-231,-302,-226,-212,-176,-305},{-302,-148,-259,-312,-155,-233}},{{-212,-276,-248,-257,-267,-171},{-167,-183,-333,-333,-221,-321},{-295,-309,-214,-221,-226,-207},{-195,-252,-209,-255,-162,-224},{-302,-321,-155,-319,-286,-259},{-262,-262,-319,-214,-186,-269},{-333,-231,-164,-305,-228,-171},{-195,-312,-202,-259,-312,-271},{-181,-157,-207,-236,-288,-219},{-224,-305,-333,-307,-240,-236}},{{-164,-226,-274,-231,-212,-228},{-205,-240,-255,-198,-183,-252},{-274,-278,-169,-155,-319,-190},{-276,-317,-148,-264,-331,-190},{-221,-278,-145,-167,-162,-171},{-188,-240,-281,-286,-148,-228},{-281,-248,-298,-145,-183,-167},{-209,-319,-331,-162,-217,-264},{-262,-233,-193,-224,-217,-248},{-159,-305,-319,-250,-245,-255}}},{{{-355,-379,-238,-172,-333,-205},{-289,-317,-180,-347,-224,-183},{-273,-319,-248,-205,-325,-352},{-303,-374,-207,-298,-246,-221},{-243,-341,-164,-284,-251,-347},{-194,-172,-363,-268,-188,-344},{-349,-205,-355,-281,-306,-347},{-164,-284,-238,-197,-205,-232},{-336,-306,-295,-330,-317,-284},{-183,-199,-374,-224,-303,-251}},{{-330,-199,-314,-265,-273,-339},{-251,-221,-322,-205,-303,-270},{-229,-273,-199,-229,-175,-262},{-254,-298,-360,-363,-265,-177},{-341,-180,-298,-202,-265,-172},{-213,-194,-186,-382,-191,-169},{-167,-177,-352,-281,-254,-248},{-259,-265,-197,-325,-369,-333},{-229,-224,-248,-360,-349,-213},{-330,-317,-374,-262,-371,-169}},{{-221,-259,-213,-336,-227,-273},{-344,-349,-303,-284,-289,-210},{-328,-270,-311,-265,-207,-273},{-278,-221,-262,-167,-344,-281},{-262,-325,-325,-363,-382,-349},{-292,-172,-276,-278,-300,-289},{-199,-311,-221,-336,-330,-210},{-300,-164,-169,-169,-197,-319},{-369,-284,-358,-382,-202,-259},{-270,-257,-243,-295,-369,-303}}},{{{-102,-143,-146,-123,-114,-199},{-131,-211,-206,-165,-128,-152},{-108,-154,-213,-202,-136,-186},{-165,-125,-111,-205,-156,-126},{-206,-157,-139,-213,-200,-145},{-208,-132,-206,-208,-163,-209},{-209,-142,-119,-132,-176,-139},{-176,-202,-112,-172,-191,-117},{-151,-185,-117,-213,-102,-99},{-128,-186,-163,-99,-163,-177}},{{-174,-169,-143,-146,-157,-169},{-119,-169,-92,-214,-211,-131},{-106,-132,-165,-188,-174,-168},{-209,-100,-112,-122,-176,-108},{-202,-125,-180,-95,-196,-213},{-163,-132,-196,-216,-160,-176},{-206,-117,-119,-156,-191,-163},{-142,-119,-128,-94,-145,-119},{-191,-197,-137,-166,-128,-176},{-160,-106,-152,-108,-146,-182}},{{-186,-122,-94,-171,-143,-125},{-214,-105,-162,-163,-165,-126},{-191,-206,-185,-214,-194,-176},{-202,-203,-128,-176,-142,-94},{-194,-159,-194,-214,-95,-137},{-151,-111,-163,-156,-117,-213},{-97,-211,-128,-142,-126,-105},{-159,-94,-171,-197,-191,-162},{-149,-97,-174,-172,-145,-132},{-202,-100,-139,-152,-188,-123}}},{{{-155,-118,-122,-197,-206,-197},{-189,-184,-157,-231,-228,-248},{-157,-246,-124,-177,-242,-178},{-255,-217,-198,-224,-189,-116},{-215,-193,-131,-184,-135,-157},{-200,-206,-113,-229,-222,-144},{-167,-122,-151,-155,-240,-142},{-151,-142,-238,-209,-149,-133},{-120,-246,-164,-177,-213,-146},{-251,-146,-198,-160,-246,-171}},{{-242,-124,-233,-116,-224,-184},{-131,-189,-129,-146,-116,-136},{-146,-166,-146,-157,-248,-240},{-155,-124,-178,-127,-175,-140},{-178,-255,-118,-187,-198,-131},{-160,-191,-136,-136,-129,-255},{-195,-248,-184,-133,-178,-133},{-109,-246,-244,-133,-195,-116},{-191,-147,-164,-124,-157,-131},{-197,-197,-189,-233,-249,-164}},{{-167,-178,-184,-122,-209,-136},{-129,-120,-129,-187,-169,-142},{-242,-228,-180,-173,-111,-251},{-235,-242,-177,-182,-115,-160},{-113,-111,-228,-248,-191,-248},{-136,-162,-233,-180,-129,-218},{-186,-127,-235,-180,-213,-248},{-244,-177,-135,-173,-124,-149},{-175,-246,-136,-251,-200,-124},{-220,-178,-169,-144,-244,-242}}},{{{-186,-252,-225,-162,-265,-186},{-157,-252,-301,-343,-250,-274},{-225,-206,-233,-292,-154,-252},{-255,-238,-333,-201,-184,-208},{-169,-292,-176,-257,-206,-301},{-336,-331,-220,-179,-341,-316},{-294,-240,-157,-198,-238,-169},{-338,-174,-223,-270,-245,-267},{-149,-152,-338,-225,-152,-167},{-331,-228,-270,-250,-343,-306}},{{-279,-309,-203,-238,-267,-252},{-220,-260,-152,-203,-198,-147},{-176,-220,-196,-228,-213,-220},{-152,-255,-267,-201,-203,-228},{-328,-191,-198,-174,-201,-292},{-321,-240,-206,-289,-189,-331},{-311,-245,-223,-274,-272,-338},{-176,-292,-206,-179,-230,-245},{-149,-216,-270,-247,-292,-176},{-172,-250,-270,-265,-299,-304}},{{-338,-216,-147,-176,-206,-255},{-274,-184,-257,-279,-277,-220},{-147,-235,-277,-206,-265,-267},{-304,-299,-152,-309,-331,-179},{-289,-208,-343,-250,-277,-208},{-162,-255,-318,-277,-341,-216},{-336,-314,-216,-220,-228,-270},{-274,-203,-238,-287,-206,-270},{-172,-272,-333,-274,-289,-284},{-318,-250,-316,-328,-282,-191}}},{{{-282,-321,-240,-231,-268,-206},{-252,-289,-185,-263,-213,-277},{-319,-275,-155,-206,-180,-243},{-286,-217,-284,-173,-312,-286},{-176,-252,-194,-143,-185,-192},{-314,-157,-291,-282,-291,-194},{-155,-159,-171,-240,-319,-213},{-194,-171,-226,-210,-143,-275},{-219,-150,-312,-286,-152,-192},{-316,-141,-238,-162,-236,-159}},{{-143,-152,-321,-305,-208,-236},{-185,-284,-259,-226,-293,-152},{-224,-275,-194,-247,-176,-314},{-215,-222,-166,-169,-245,-139},{-259,-273,-222,-219,-233,-155},{-240,-236,-180,-176,-150,-233},{-178,-222,-219,-316,-196,-224},{-270,-171,-270,-277,-162,-203},{-226,-164,-289,-305,-249,-217},{-169,-303,-215,-245,-323,-252}},{{-293,-300,-171,-263,-282,-187},{-187,-194,-178,-268,-249,-148},{-263,-164,-261,-143,-233,-291},{-217,-224,-176,-240,-305,-321},{-164,-171,-268,-291,-192,-162},{-206,-182,-157,-206,-275,-173},{-206,-164,-261,-314,-226,-277},{-155,-152,-261,-152,-201,-217},{-219,-323,-210,-199,-185,-291},{-268,-159,-166,-263,-203,-171}}},{{{-344,-229,-379,-285,-370,-282},{-256,-412,-232,-382,-203,-294},{-176,-306,-250,-244,-288,-273},{-391,-388,-320,-288,-218,-279},{-388,-223,-412,-350,-235,-315},{-400,-326,-368,-397,-394,-282},{-276,-235,-250,-262,-412,-229},{-279,-226,-303,-306,-232,-253},{-270,-259,-370,-226,-368,-279},{-412,-300,-368,-273,-341,-279}},{{-182,-282,-268,-282,-200,-288},{-406,-265,-229,-203,-370,-220},{-409,-200,-253,-344,-318,-194},{-379,-338,-309,-218,-250,-241},{-282,-350,-373,-391,-259,-347},{-332,-320,-288,-212,-309,-220},{-232,-388,-341,-262,-409,-259},{-235,-273,-191,-288,-238,-338},{-338,-335,-350,-291,-194,-194},{-256,-385,-391,-232,-362,-291}},{{-179,-297,-279,-329,-379,-220},{-300,-379,-362,-341,-200,-194},{-320,-247,-259,-188,-206,-206},{-179,-353,-370,-338,-229,-256},{-353,-353,-256,-359,-232,-315},{-388,-320,-273,-335,-182,-182},{-238,-400,-353,-332,-388,-200},{-332,-341,-356,-282,-294,-341},{-368,-197,-200,-376,-226,-250},{-356,-297,-226,-206,-370,-182}}}}; // supply (positive for supply and negative for demand) under different scenarios 
int iniv[I]={1841,192,221,150,198,208,315,198,294}; // initial inventory 
int ubiv[I]={2104,384,442,300,396,416,630,396,588}; // 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.32,8.46,5.6,4.24,2.89,1.51,4.53,7.74}; // 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.11,7.69,5.09,3.85,2.63,1.37,4.12,7.04}}; // 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.69,9.69,9.69,8.48,8.48,8.48,7.27,7.27,7.27,6.15,6.15,6.15,5.38,5.38,5.38,4.61,4.61,4.61,4.07,4.07,4.07,3.56,3.56,3.56,3.05,3.05,3.05,3.08,3.08,3.08,2.7,2.7,2.7,2.31,2.31,2.31,2.1,2.1,2.1,1.84,1.84,1.84,1.58,1.58,1.58,1.1,1.1,1.1,0.96,0.96,0.96,0.82,0.82,0.82,3.3,3.3,3.3,2.88,2.88,2.88,2.47,2.47,2.47,5.63,5.63,5.63,4.93,4.93,4.93,4.22,4.22,4.22}; // 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,3,2,7,4,3,7,4,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,8,4,3,9,4,3,9,4,3,8,4,3,8,4,3,8,4,3,9,4,3,7,4,3,8,4,3,8,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},{347,348,349}}; // set of shipments in each bid 
int SHsts[SPN]={1,3,5,7,9,11,2,6,10,2,8,0,2,4,6,8,10,12,0,4,8,12,0,6,12,0,2,4,6,8,10,12,0,4,8,12,2,8,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,2,6,10,14,1,7,13,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,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,1,7,13,1,3,5,7,9,11,13,15,0,4,8,12,1,7,13,0,2,4,6,8,10,12,14,2,6,10,14,2,8,14,0,2,4,6,8,10,12,14,16,1,5,9,13,0,6,12,0,2,4,6,8,10,12,14,16,2,6,10,14,1,7,13,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,2,8,14,2,4,6,8,10,12,14,16,2,6,10,14,2,8,14,0,2,4,6,8,10,12,14,16,1,5,9,13,0,6,12,2,4,6,8,10,12,14,2,6,10,14,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,1,5,9,13,0,6,12,1,3,5,7,9,11,13,0,4,8,12,1,7,13,1,3,5,7,9,11,13,0,4,8,12,0,6,12,1,3,5,7,9,11,13,2,6,10,14,0,6,12}; // set of start times of each shipment 
int SHets[SPN]={6,8,10,12,14,16,7,11,15,7,13,5,7,9,11,13,15,17,5,9,13,17,5,11,17,5,7,9,11,13,15,17,5,9,13,17,7,13,5,7,9,11,13,15,17,4,8,12,16,4,10,16,3,5,7,9,11,13,15,17,5,9,13,17,5,11,17,5,7,9,11,13,15,17,5,9,13,17,4,10,16,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,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,3,9,15,3,5,7,9,11,13,15,17,2,6,10,14,3,9,15,2,4,6,8,10,12,14,16,4,8,12,16,4,10,16,1,3,5,7,9,11,13,15,17,2,6,10,14,1,7,13,1,3,5,7,9,11,13,15,17,3,7,11,15,2,8,14,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,3,9,15,3,5,7,9,11,13,15,17,3,7,11,15,3,9,15,1,3,5,7,9,11,13,15,17,2,6,10,14,1,7,13,4,6,8,10,12,14,16,4,8,12,16,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,3,7,11,15,2,8,14,4,6,8,10,12,14,16,3,7,11,15,4,10,16,4,6,8,10,12,14,16,3,7,11,15,3,9,15,4,6,8,10,12,14,16,5,9,13,17,3,9,15}; // set of end times of each shipment 
