int Dev = 30;// 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 = 342;//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]={{{{11284,0,0,0,0,0},{11287,0,0,0,0,0},{11287,0,0,0,0,0},{10975,0,0,0,0,0},{10569,0,0,0,0,0},{11073,0,0,0,0,0},{11066,0,0,0,0,0},{11529,0,0,0,0,0},{10999,0,0,0,0,0},{11180,0,0,0,0,0}},{{11293,0,0,0,0,0},{11159,0,0,0,0,0},{11320,0,0,0,0,0},{10969,0,0,0,0,0},{10985,0,0,0,0,0},{10831,0,0,0,0,0},{10974,0,0,0,0,0},{11101,0,0,0,0,0},{11145,0,0,0,0,0},{10633,0,0,0,0,0}},{{11130,0,0,0,0,0},{10701,0,0,0,0,0},{11083,0,0,0,0,0},{11206,0,0,0,0,0},{11330,0,0,0,0,0},{11491,0,0,0,0,0},{11321,0,0,0,0,0},{11121,0,0,0,0,0},{10767,0,0,0,0,0},{10863,0,0,0,0,0}}},{{{-278,-231,-202,-233,-267,-246},{-157,-249,-166,-280,-202,-164},{-177,-276,-166,-177,-199,-264},{-170,-177,-220,-287,-258,-287},{-271,-215,-249,-164,-217,-262},{-166,-242,-273,-246,-282,-251},{-258,-204,-206,-249,-262,-168},{-278,-211,-242,-289,-199,-224},{-184,-177,-253,-157,-289,-184},{-222,-237,-273,-179,-175,-179}},{{-233,-269,-220,-235,-188,-168},{-235,-197,-287,-202,-278,-253},{-287,-242,-278,-195,-179,-260},{-159,-190,-262,-208,-269,-190},{-159,-166,-240,-231,-199,-195},{-197,-240,-240,-166,-228,-253},{-237,-260,-251,-166,-255,-179},{-271,-186,-242,-222,-168,-262},{-289,-235,-168,-224,-172,-211},{-168,-184,-291,-161,-213,-159}},{{-246,-269,-269,-168,-269,-249},{-282,-206,-255,-284,-184,-177},{-190,-170,-166,-190,-213,-197},{-197,-184,-161,-240,-269,-202},{-159,-242,-269,-240,-181,-267},{-190,-206,-264,-195,-282,-267},{-197,-267,-202,-193,-224,-255},{-175,-215,-222,-206,-280,-193},{-220,-166,-159,-276,-235,-197},{-289,-202,-287,-181,-159,-179}}},{{{-307,-255,-283,-195,-167,-302},{-309,-271,-300,-226,-178,-264},{-202,-228,-305,-169,-271,-274},{-281,-217,-295,-305,-219,-214},{-255,-167,-174,-169,-271,-198},{-276,-250,-288,-178,-238,-212},{-226,-267,-309,-252,-195,-286},{-252,-257,-200,-259,-269,-305},{-283,-248,-195,-195,-271,-250},{-174,-252,-214,-271,-290,-236}},{{-212,-271,-231,-257,-238,-290},{-186,-245,-202,-309,-293,-205},{-257,-195,-224,-240,-274,-245},{-202,-167,-212,-186,-226,-233},{-271,-200,-288,-181,-228,-226},{-267,-200,-300,-233,-262,-281},{-224,-200,-188,-264,-188,-271},{-171,-257,-269,-300,-271,-288},{-174,-171,-298,-250,-257,-245},{-221,-290,-183,-169,-305,-307}},{{-240,-300,-190,-202,-298,-293},{-190,-178,-181,-198,-224,-298},{-226,-236,-174,-178,-238,-278},{-255,-212,-271,-190,-224,-267},{-257,-228,-188,-276,-169,-295},{-214,-190,-231,-271,-278,-190},{-231,-298,-276,-181,-224,-255},{-298,-176,-231,-188,-167,-221},{-207,-214,-174,-278,-300,-205},{-207,-257,-217,-176,-231,-233}}},{{{-232,-270,-322,-325,-284,-227},{-355,-341,-276,-314,-218,-352},{-289,-229,-306,-328,-298,-194},{-229,-278,-276,-265,-207,-311},{-257,-248,-270,-352,-306,-251},{-197,-336,-240,-232,-194,-213},{-339,-243,-300,-349,-289,-262},{-207,-229,-347,-325,-289,-218},{-213,-235,-278,-216,-262,-270},{-344,-257,-221,-240,-207,-319}},{{-333,-270,-205,-306,-303,-341},{-317,-298,-292,-308,-197,-336},{-207,-213,-229,-273,-262,-317},{-254,-224,-355,-347,-347,-300},{-197,-265,-355,-216,-254,-224},{-213,-216,-238,-306,-246,-341},{-278,-202,-322,-339,-325,-341},{-306,-317,-341,-218,-251,-287},{-336,-197,-355,-246,-325,-322},{-284,-254,-278,-229,-325,-202}},{{-298,-262,-227,-207,-355,-339},{-238,-257,-295,-257,-246,-330},{-273,-224,-349,-243,-248,-352},{-257,-303,-295,-328,-259,-325},{-202,-221,-355,-341,-221,-328},{-319,-322,-295,-205,-232,-218},{-229,-262,-273,-278,-341,-300},{-262,-238,-308,-243,-355,-325},{-322,-284,-319,-298,-300,-213},{-205,-317,-349,-317,-251,-240}}},{{{-132,-122,-152,-177,-152,-149},{-168,-112,-142,-162,-119,-177},{-134,-186,-189,-149,-168,-143},{-128,-168,-188,-160,-126,-157},{-120,-139,-146,-114,-123,-146},{-132,-196,-192,-194,-123,-137},{-189,-148,-196,-200,-117,-148},{-157,-137,-169,-162,-114,-134},{-120,-194,-171,-192,-109,-156},{-132,-172,-116,-169,-171,-148}},{{-122,-196,-171,-128,-145,-197},{-152,-117,-112,-117,-151,-143},{-194,-145,-123,-179,-109,-172},{-191,-168,-111,-136,-142,-182},{-134,-148,-146,-189,-154,-189},{-109,-168,-114,-142,-197,-122},{-189,-117,-119,-176,-128,-119},{-185,-194,-120,-108,-149,-182},{-108,-189,-148,-114,-152,-154},{-117,-197,-136,-108,-168,-108}},{{-185,-197,-108,-120,-185,-196},{-125,-131,-154,-111,-149,-125},{-168,-194,-165,-137,-157,-149},{-117,-114,-189,-196,-156,-194},{-191,-168,-145,-186,-151,-191},{-116,-134,-129,-134,-200,-145},{-200,-119,-177,-192,-182,-117},{-126,-152,-182,-169,-174,-137},{-143,-196,-192,-166,-188,-159},{-143,-165,-180,-131,-172,-176}}},{{{-237,-182,-138,-147,-133,-135},{-224,-138,-207,-193,-136,-169},{-164,-167,-217,-228,-153,-180},{-160,-228,-135,-142,-178,-173},{-180,-127,-127,-215,-218,-171},{-127,-204,-155,-138,-158,-207},{-218,-200,-151,-147,-211,-129},{-184,-155,-160,-224,-200,-202},{-206,-177,-178,-224,-226,-153},{-235,-193,-218,-213,-211,-187}},{{-189,-184,-146,-218,-193,-177},{-233,-186,-175,-209,-197,-146},{-155,-140,-140,-167,-235,-153},{-195,-187,-213,-177,-173,-224},{-224,-158,-226,-140,-144,-162},{-155,-169,-149,-157,-147,-235},{-151,-171,-195,-131,-131,-207},{-193,-162,-191,-191,-202,-138},{-144,-186,-167,-237,-149,-127},{-162,-209,-166,-220,-129,-182}},{{-180,-136,-162,-147,-175,-157},{-157,-207,-166,-222,-171,-136},{-206,-191,-226,-233,-158,-129},{-213,-211,-160,-195,-177,-231},{-229,-171,-160,-215,-229,-157},{-169,-180,-157,-209,-229,-226},{-175,-195,-206,-231,-158,-231},{-237,-224,-235,-173,-164,-146},{-142,-166,-131,-224,-209,-229},{-146,-153,-182,-191,-228,-153}}},{{{-306,-272,-294,-294,-284,-184},{-194,-213,-230,-189,-203,-243},{-220,-213,-301,-240,-196,-292},{-223,-265,-292,-311,-172,-194},{-252,-194,-262,-191,-238,-240},{-294,-218,-225,-282,-318,-304},{-260,-174,-284,-189,-196,-296},{-191,-294,-233,-284,-211,-274},{-294,-318,-304,-292,-316,-277},{-238,-262,-220,-225,-284,-228}},{{-225,-250,-203,-314,-272,-292},{-213,-316,-228,-282,-292,-176},{-262,-284,-296,-318,-223,-274},{-311,-238,-294,-262,-194,-203},{-299,-220,-265,-267,-277,-282},{-230,-260,-196,-284,-213,-189},{-172,-220,-176,-316,-238,-216},{-247,-218,-208,-245,-208,-284},{-216,-301,-267,-218,-184,-267},{-296,-240,-208,-243,-198,-306}},{{-181,-301,-194,-279,-245,-243},{-203,-292,-287,-316,-243,-179},{-318,-225,-311,-279,-211,-279},{-272,-172,-179,-262,-238,-306},{-289,-186,-194,-186,-250,-186},{-304,-289,-194,-211,-233,-267},{-228,-247,-218,-233,-255,-296},{-250,-211,-272,-274,-213,-181},{-267,-218,-272,-262,-223,-240},{-223,-203,-247,-274,-220,-235}}},{{{-289,-298,-256,-192,-180,-240},{-293,-217,-199,-185,-247,-171},{-291,-280,-166,-243,-215,-247},{-286,-243,-298,-189,-226,-266},{-261,-182,-270,-256,-210,-240},{-222,-256,-208,-187,-254,-213},{-203,-164,-189,-300,-187,-286},{-236,-273,-231,-286,-289,-169},{-229,-213,-169,-192,-245,-182},{-196,-169,-259,-291,-296,-284}},{{-206,-249,-229,-293,-266,-249},{-289,-162,-240,-256,-275,-282},{-249,-185,-231,-206,-293,-196},{-284,-280,-166,-180,-231,-187},{-192,-219,-213,-238,-284,-296},{-252,-224,-263,-180,-293,-245},{-296,-208,-196,-199,-185,-282},{-201,-277,-171,-192,-266,-275},{-284,-249,-296,-173,-203,-256},{-201,-199,-206,-164,-249,-268}},{{-280,-289,-203,-222,-208,-166},{-289,-196,-213,-289,-208,-226},{-300,-180,-261,-254,-263,-291},{-173,-173,-240,-291,-268,-282},{-286,-201,-194,-280,-291,-215},{-286,-164,-280,-263,-206,-300},{-173,-236,-203,-291,-256,-169},{-275,-213,-199,-206,-282,-291},{-224,-178,-166,-254,-231,-171},{-268,-178,-280,-215,-245,-196}}},{{{-341,-229,-332,-373,-218,-220},{-370,-376,-353,-332,-338,-365},{-347,-323,-362,-368,-341,-212},{-300,-244,-362,-229,-218,-218},{-232,-315,-229,-320,-232,-323},{-303,-297,-365,-253,-215,-382},{-318,-250,-212,-285,-332,-223},{-370,-320,-329,-341,-297,-303},{-256,-244,-270,-326,-312,-294},{-320,-347,-368,-265,-229,-244}},{{-209,-306,-362,-244,-226,-262},{-250,-303,-215,-326,-226,-250},{-297,-244,-382,-368,-379,-344},{-279,-382,-265,-212,-212,-359},{-256,-353,-268,-209,-368,-370},{-282,-373,-294,-209,-206,-347},{-362,-376,-250,-323,-273,-362},{-215,-323,-223,-353,-309,-244},{-323,-365,-282,-238,-376,-297},{-379,-220,-235,-273,-332,-291}},{{-276,-259,-347,-229,-359,-220},{-297,-262,-259,-232,-229,-347},{-250,-365,-235,-265,-209,-329},{-306,-273,-382,-244,-306,-247},{-206,-276,-382,-365,-370,-341},{-353,-356,-370,-365,-335,-318},{-309,-297,-256,-270,-362,-353},{-215,-341,-350,-303,-297,-326},{-279,-238,-229,-276,-259,-268},{-209,-294,-268,-300,-338,-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]={6,4,2,6,3,2,6,3,2,7,4,3,8,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,5,3,8,4,3,8,4,3,8,5,3,8,4,3,8,4,3,8,4,3,7,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}}; // set of shipments in each bid 
int SHsts[SPN]={2,4,6,8,10,12,0,4,8,12,1,7,2,4,6,8,10,12,1,5,9,1,7,2,4,6,8,10,12,2,6,10,1,7,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,0,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,0,6,12,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,2,4,6,8,10,12,14,0,4,8,12,2,8,14,2,4,6,8,10,12,14,0,4,8,12,1,7,13,2,4,6,8,10,12,14,2,6,10,14,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,16,0,4,8,12,16,0,6,12,2,4,6,8,10,12,14,16,2,6,10,14,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,0,4,8,12,16,1,7,13,1,3,5,7,9,11,13,15,1,5,9,13,0,6,12,1,3,5,7,9,11,13,15,0,4,8,12,0,6,12,1,3,5,7,9,11,13,15,0,4,8,12,0,6,12,2,4,6,8,10,12,14,2,6,10,14,2,8,14,1,3,5,7,9,11,13,0,4,8,12,1,7,13,1,3,5,7,9,11,13,2,6,10,14,2,8,14,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,6,12,7,9,11,13,15,17,6,10,14,6,12,7,9,11,13,15,17,7,11,15,6,12,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,3,5,7,9,11,13,15,17,3,7,11,15,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,3,7,11,15,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,2,6,10,14,4,10,16,4,6,8,10,12,14,16,2,6,10,14,3,9,15,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,1,7,13,3,5,7,9,11,13,15,17,1,5,9,13,17,1,7,13,3,5,7,9,11,13,15,17,3,7,11,15,3,9,15,2,4,6,8,10,12,14,16,3,7,11,15,1,7,13,2,4,6,8,10,12,14,16,1,5,9,13,17,2,8,14,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,2,8,14,3,5,7,9,11,13,15,17,2,6,10,14,2,8,14,4,6,8,10,12,14,16,4,8,12,16,4,10,16,4,6,8,10,12,14,16,3,7,11,15,4,10,16,4,6,8,10,12,14,16,5,9,13,17,5,11,17,4,6,8,10,12,14,16,3,7,11,15,4,10,16}; // set of end times of each shipment 
