int Dev = 20;// Deviation
extern const int CNN = 4;// 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]={{{{11364,0,0,0,0,0},{11061,0,0,0,0,0},{11145,0,0,0,0,0},{11294,0,0,0,0,0},{11207,0,0,0,0,0},{11186,0,0,0,0,0},{11060,0,0,0,0,0},{10895,0,0,0,0,0},{11074,0,0,0,0,0},{11003,0,0,0,0,0}},{{10903,0,0,0,0,0},{10796,0,0,0,0,0},{11012,0,0,0,0,0},{11144,0,0,0,0,0},{11195,0,0,0,0,0},{10947,0,0,0,0,0},{11192,0,0,0,0,0},{11164,0,0,0,0,0},{10980,0,0,0,0,0},{10854,0,0,0,0,0}},{{11549,0,0,0,0,0},{11035,0,0,0,0,0},{10946,0,0,0,0,0},{10948,0,0,0,0,0},{11363,0,0,0,0,0},{10729,0,0,0,0,0},{11117,0,0,0,0,0},{11163,0,0,0,0,0},{11036,0,0,0,0,0},{11053,0,0,0,0,0}}},{{{-251,-217,-193,-208,-269,-199},{-262,-269,-237,-206,-222,-235},{-233,-237,-249,-228,-228,-179},{-188,-226,-267,-228,-235,-251},{-251,-197,-262,-249,-190,-244},{-246,-184,-244,-264,-244,-222},{-226,-267,-244,-240,-208,-251},{-208,-264,-228,-190,-202,-228},{-235,-224,-231,-215,-204,-228},{-251,-193,-264,-255,-186,-224}},{{-197,-195,-179,-184,-193,-220},{-235,-244,-211,-213,-208,-222},{-213,-199,-251,-215,-240,-224},{-231,-235,-267,-208,-199,-184},{-186,-251,-258,-251,-262,-217},{-211,-211,-258,-208,-237,-197},{-249,-249,-222,-224,-199,-255},{-190,-235,-202,-190,-228,-233},{-224,-217,-184,-242,-222,-258},{-264,-246,-231,-199,-267,-186}},{{-235,-233,-258,-186,-202,-255},{-240,-188,-260,-224,-179,-215},{-253,-222,-228,-235,-242,-242},{-235,-242,-208,-258,-215,-215},{-262,-211,-264,-237,-235,-267},{-244,-222,-228,-190,-193,-195},{-226,-184,-242,-267,-199,-228},{-208,-233,-213,-215,-262,-181},{-215,-206,-267,-184,-244,-258},{-202,-262,-217,-269,-224,-204}}},{{{-267,-226,-255,-255,-283,-224},{-286,-195,-217,-219,-286,-281},{-243,-190,-243,-278,-221,-228},{-212,-240,-243,-264,-245,-250},{-205,-269,-286,-283,-262,-212},{-221,-274,-226,-259,-281,-252},{-226,-245,-271,-276,-202,-226},{-190,-252,-238,-228,-200,-212},{-240,-281,-271,-219,-283,-274},{-212,-226,-245,-236,-219,-278}},{{-233,-198,-214,-286,-207,-202},{-224,-209,-243,-205,-233,-281},{-245,-236,-252,-202,-205,-278},{-269,-264,-231,-226,-255,-200},{-190,-278,-264,-245,-195,-278},{-231,-283,-238,-262,-228,-233},{-226,-271,-190,-274,-224,-245},{-286,-209,-250,-255,-283,-217},{-193,-200,-271,-226,-212,-257},{-219,-200,-259,-190,-236,-221}},{{-224,-267,-255,-269,-269,-276},{-224,-276,-269,-198,-209,-281},{-219,-214,-205,-264,-198,-228},{-212,-224,-193,-219,-226,-233},{-257,-217,-200,-248,-252,-245},{-243,-217,-238,-195,-248,-217},{-205,-271,-281,-228,-226,-243},{-278,-207,-259,-193,-252,-209},{-233,-257,-195,-271,-276,-276},{-219,-212,-224,-252,-205,-243}}},{{{-221,-270,-273,-298,-278,-262},{-317,-314,-243,-281,-319,-298},{-248,-303,-314,-300,-314,-246},{-284,-281,-314,-308,-319,-257},{-287,-273,-229,-232,-300,-314},{-238,-218,-268,-243,-284,-284},{-278,-273,-328,-257,-325,-251},{-254,-262,-235,-298,-224,-292},{-322,-300,-273,-289,-292,-232},{-287,-300,-238,-218,-265,-254}},{{-306,-308,-232,-224,-300,-248},{-259,-224,-325,-224,-229,-248},{-243,-292,-306,-284,-232,-273},{-240,-262,-243,-243,-276,-308},{-303,-276,-240,-298,-248,-262},{-287,-292,-227,-227,-292,-278},{-276,-251,-314,-325,-328,-232},{-276,-232,-232,-224,-251,-322},{-224,-257,-224,-251,-319,-284},{-235,-246,-292,-227,-229,-292}},{{-273,-243,-254,-248,-246,-325},{-265,-240,-287,-303,-319,-322},{-306,-221,-259,-278,-311,-287},{-243,-278,-319,-306,-289,-276},{-298,-257,-306,-287,-298,-317},{-257,-229,-232,-284,-254,-248},{-246,-251,-314,-300,-295,-284},{-292,-314,-235,-259,-238,-278},{-300,-306,-229,-325,-314,-319},{-240,-278,-311,-311,-251,-235}}},{{{-177,-180,-159,-174,-182,-148},{-129,-139,-176,-156,-165,-142},{-143,-177,-163,-156,-148,-140},{-165,-160,-126,-172,-185,-139},{-126,-180,-159,-185,-148,-132},{-126,-149,-145,-183,-136,-183},{-179,-142,-151,-139,-174,-134},{-160,-140,-166,-126,-126,-180},{-132,-182,-165,-154,-137,-160},{-179,-163,-177,-134,-132,-139}},{{-159,-143,-172,-165,-146,-125},{-126,-126,-185,-132,-166,-166},{-140,-151,-157,-182,-145,-176},{-185,-169,-162,-169,-185,-174},{-142,-182,-174,-162,-177,-139},{-123,-179,-166,-177,-169,-145},{-162,-139,-149,-163,-177,-136},{-145,-168,-134,-123,-160,-139},{-172,-183,-126,-125,-132,-142},{-137,-157,-128,-132,-137,-148}},{{-163,-174,-136,-132,-129,-137},{-123,-182,-139,-159,-137,-132},{-182,-143,-123,-132,-183,-125},{-123,-137,-168,-157,-149,-143},{-159,-129,-152,-165,-136,-177},{-128,-140,-149,-145,-146,-142},{-183,-160,-126,-129,-156,-159},{-176,-139,-171,-149,-156,-179},{-123,-185,-177,-126,-151,-146},{-172,-183,-140,-137,-160,-123}}},{{{-218,-204,-157,-182,-173,-180},{-147,-211,-175,-189,-167,-211},{-177,-207,-218,-160,-178,-157},{-186,-200,-213,-175,-218,-178},{-178,-171,-184,-169,-166,-171},{-200,-171,-166,-202,-155,-173},{-189,-167,-167,-184,-213,-164},{-171,-187,-187,-193,-146,-197},{-155,-171,-157,-200,-197,-171},{-202,-186,-162,-184,-157,-207}},{{-149,-171,-169,-215,-157,-217},{-198,-193,-169,-184,-149,-211},{-198,-218,-167,-182,-155,-193},{-178,-193,-189,-187,-180,-182},{-193,-198,-173,-155,-182,-149},{-202,-153,-211,-202,-186,-184},{-147,-207,-193,-211,-204,-155},{-211,-211,-200,-198,-206,-164},{-164,-213,-151,-202,-147,-149},{-195,-186,-182,-175,-155,-195}},{{-215,-157,-149,-200,-215,-215},{-157,-166,-206,-200,-177,-171},{-173,-162,-193,-195,-162,-155},{-202,-167,-149,-164,-169,-180},{-151,-209,-153,-160,-166,-147},{-193,-217,-164,-184,-177,-158},{-182,-184,-178,-217,-151,-155},{-149,-211,-177,-195,-218,-178},{-213,-173,-158,-167,-180,-193},{-215,-147,-204,-204,-195,-173}}},{{{-294,-287,-294,-294,-240,-235},{-228,-206,-218,-211,-233,-238},{-292,-220,-270,-265,-289,-235},{-279,-265,-294,-243,-196,-196},{-198,-230,-213,-255,-294,-213},{-238,-218,-292,-277,-216,-279},{-228,-252,-294,-220,-218,-230},{-265,-294,-272,-260,-270,-220},{-270,-240,-196,-247,-257,-282},{-274,-247,-250,-274,-279,-203}},{{-262,-289,-243,-233,-289,-220},{-196,-220,-233,-228,-238,-245},{-255,-196,-277,-220,-272,-196},{-255,-203,-289,-282,-213,-270},{-218,-272,-201,-203,-262,-211},{-265,-230,-252,-235,-220,-206},{-272,-208,-228,-213,-230,-220},{-287,-252,-289,-284,-213,-292},{-240,-277,-196,-260,-218,-274},{-287,-279,-203,-257,-213,-245}},{{-218,-282,-250,-267,-277,-265},{-270,-292,-255,-220,-294,-292},{-228,-218,-225,-213,-284,-243},{-220,-198,-211,-279,-247,-262},{-233,-272,-216,-284,-235,-267},{-260,-216,-265,-235,-216,-208},{-294,-230,-289,-247,-250,-206},{-272,-238,-238,-294,-267,-223},{-218,-225,-255,-228,-223,-218},{-213,-213,-238,-272,-277,-235}}},{{{-210,-229,-199,-206,-270,-229},{-201,-231,-215,-187,-233,-231},{-256,-213,-277,-196,-199,-254},{-217,-196,-238,-273,-273,-213},{-261,-185,-229,-273,-261,-217},{-233,-261,-263,-196,-259,-229},{-192,-210,-277,-192,-208,-254},{-277,-210,-238,-213,-196,-261},{-199,-275,-203,-233,-189,-213},{-213,-194,-226,-185,-240,-275}},{{-249,-236,-254,-196,-229,-243},{-247,-268,-189,-263,-208,-261},{-256,-192,-215,-254,-206,-185},{-203,-210,-252,-231,-224,-187},{-201,-268,-203,-270,-215,-270},{-222,-196,-252,-263,-203,-213},{-266,-252,-187,-273,-256,-256},{-263,-213,-224,-231,-270,-261},{-213,-261,-226,-222,-268,-249},{-254,-187,-231,-252,-261,-217}},{{-256,-254,-277,-277,-261,-199},{-189,-240,-268,-215,-196,-247},{-192,-273,-238,-194,-263,-245},{-189,-231,-261,-240,-238,-270},{-196,-273,-247,-277,-226,-273},{-259,-229,-243,-270,-215,-252},{-203,-254,-194,-224,-240,-208},{-245,-231,-275,-189,-261,-208},{-243,-206,-210,-185,-247,-194},{-217,-243,-247,-231,-226,-273}}},{{{-323,-288,-315,-265,-291,-312},{-276,-256,-312,-300,-306,-285},{-265,-332,-253,-329,-241,-253},{-315,-262,-279,-253,-279,-294},{-297,-300,-326,-350,-244,-347},{-282,-353,-341,-326,-241,-241},{-309,-256,-276,-250,-344,-253},{-323,-247,-253,-350,-309,-253},{-294,-244,-253,-326,-300,-259},{-268,-338,-282,-241,-353,-288}},{{-285,-341,-341,-282,-332,-265},{-235,-306,-326,-303,-262,-326},{-350,-273,-276,-247,-344,-344},{-320,-259,-276,-347,-320,-309},{-268,-309,-323,-350,-285,-338},{-247,-312,-288,-282,-270,-294},{-303,-309,-235,-332,-270,-285},{-279,-300,-338,-259,-279,-256},{-294,-353,-279,-338,-329,-312},{-335,-297,-285,-285,-312,-288}},{{-335,-291,-353,-329,-315,-303},{-276,-265,-268,-250,-297,-253},{-309,-270,-270,-309,-294,-338},{-309,-315,-288,-270,-309,-312},{-294,-253,-347,-329,-303,-276},{-291,-297,-315,-338,-270,-273},{-350,-270,-250,-353,-273,-312},{-276,-270,-244,-326,-335,-347},{-241,-341,-259,-262,-294,-320},{-244,-253,-318,-294,-294,-353}}}}; // 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]={7,3,3,6,3,2,7,4,2,8,4,3,8,4,3,7,4,3,8,4,3,8,4,3,8,4,3,7,4,3,8,4,3,7,4,3,8,5,3,8,4,3,9,4,3,9,4,3,9,5,3,8,4,3,7,4,3,7,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,344,345,346},{347,348,349}}; // set of shipments in each bid 
int SHsts[SPN]={0,2,4,6,8,10,12,2,6,10,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,2,8,0,2,4,6,8,10,12,14,0,4,8,12,1,7,13,0,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,0,6,12,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,0,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,1,7,13,1,3,5,7,9,11,13,15,0,4,8,12,1,7,13,2,4,6,8,10,12,14,2,6,10,14,1,7,13,1,3,5,7,9,11,13,15,0,4,8,12,16,2,8,14,2,4,6,8,10,12,14,16,2,6,10,14,1,7,13,0,2,4,6,8,10,12,14,16,2,6,10,14,2,8,14,0,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,2,4,6,8,10,12,14,16,2,6,10,14,0,6,12,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,1,7,13,0,2,4,6,8,10,12,14,2,6,10,14,1,7,13,0,2,4,6,8,10,12,14,0,4,8,12,1,7,13,1,3,5,7,9,11,13,2,6,10,14,2,8,14,2,4,6,8,10,12,14,0,4,8,12,0,6,12}; // set of start times of each shipment 
int SHets[SPN]={5,7,9,11,13,15,17,7,11,15,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,7,13,3,5,7,9,11,13,15,17,3,7,11,15,4,10,16,3,5,7,9,11,13,15,17,3,7,11,15,5,11,17,5,7,9,11,13,15,17,5,9,13,17,3,9,15,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,2,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,3,9,15,3,5,7,9,11,13,15,17,2,6,10,14,3,9,15,4,6,8,10,12,14,16,4,8,12,16,3,9,15,2,4,6,8,10,12,14,16,1,5,9,13,17,3,9,15,3,5,7,9,11,13,15,17,3,7,11,15,2,8,14,1,3,5,7,9,11,13,15,17,3,7,11,15,3,9,15,1,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,3,5,7,9,11,13,15,17,3,7,11,15,1,7,13,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,3,9,15,2,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,4,10,16,4,6,8,10,12,14,16,5,9,13,17,5,11,17,5,7,9,11,13,15,17,3,7,11,15,3,9,15}; // set of end times of each shipment 
