int Dev = 50;// 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]={{{{11519,0,0,0,0,0},{11497,0,0,0,0,0},{11283,0,0,0,0,0},{10206,0,0,0,0,0},{11083,0,0,0,0,0},{11324,0,0,0,0,0},{11185,0,0,0,0,0},{10473,0,0,0,0,0},{11463,0,0,0,0,0},{11485,0,0,0,0,0}},{{11003,0,0,0,0,0},{10141,0,0,0,0,0},{10955,0,0,0,0,0},{10456,0,0,0,0,0},{11189,0,0,0,0,0},{11143,0,0,0,0,0},{11138,0,0,0,0,0},{11031,0,0,0,0,0},{11093,0,0,0,0,0},{10145,0,0,0,0,0}},{{10831,0,0,0,0,0},{11006,0,0,0,0,0},{11250,0,0,0,0,0},{11104,0,0,0,0,0},{11257,0,0,0,0,0},{9993,0,0,0,0,0},{10350,0,0,0,0,0},{11523,0,0,0,0,0},{10569,0,0,0,0,0},{10265,0,0,0,0,0}}},{{{-137,-231,-329,-231,-220,-242},{-166,-217,-222,-302,-293,-244},{-137,-302,-155,-242,-289,-204},{-116,-188,-157,-190,-184,-316},{-231,-278,-249,-143,-195,-235},{-228,-255,-302,-298,-244,-300},{-130,-249,-314,-161,-305,-278},{-172,-132,-166,-177,-264,-166},{-228,-217,-155,-258,-170,-298},{-334,-132,-280,-224,-289,-166}},{{-157,-148,-179,-269,-244,-190},{-217,-141,-186,-220,-170,-193},{-251,-237,-152,-139,-336,-264},{-181,-116,-177,-325,-184,-260},{-253,-311,-146,-179,-258,-226},{-291,-287,-309,-204,-179,-141},{-276,-311,-188,-114,-249,-114},{-298,-161,-334,-166,-318,-217},{-168,-134,-202,-314,-329,-233},{-152,-226,-240,-291,-222,-271}},{{-141,-222,-329,-226,-123,-186},{-146,-161,-264,-132,-181,-320},{-244,-152,-276,-128,-323,-128},{-155,-318,-293,-251,-271,-329},{-172,-233,-188,-190,-327,-255},{-125,-141,-233,-179,-282,-164},{-121,-267,-123,-217,-177,-336},{-271,-186,-291,-116,-132,-170},{-130,-193,-253,-128,-224,-325},{-148,-170,-314,-282,-228,-220}}},{{{-243,-243,-276,-138,-271,-129},{-312,-167,-181,-281,-250,-345},{-195,-319,-312,-333,-314,-138},{-281,-176,-271,-228,-143,-119},{-207,-283,-298,-202,-345,-148},{-136,-155,-283,-321,-250,-167},{-276,-129,-174,-324,-140,-312},{-138,-343,-286,-262,-162,-274},{-257,-350,-293,-293,-131,-152},{-238,-328,-176,-195,-176,-205}},{{-162,-207,-121,-231,-183,-269},{-214,-278,-169,-250,-121,-274},{-212,-121,-290,-140,-219,-352},{-357,-126,-133,-274,-326,-200},{-355,-286,-226,-138,-262,-121},{-205,-345,-264,-129,-219,-209},{-143,-157,-307,-331,-333,-331},{-190,-121,-305,-252,-324,-259},{-188,-257,-195,-171,-267,-340},{-328,-119,-343,-209,-257,-307}},{{-333,-314,-209,-190,-238,-198},{-140,-228,-355,-190,-207,-233},{-183,-357,-350,-283,-302,-326},{-152,-145,-129,-236,-129,-167},{-355,-145,-143,-338,-255,-340},{-190,-200,-286,-269,-138,-126},{-219,-298,-190,-350,-298,-138},{-255,-321,-319,-171,-317,-317},{-124,-164,-295,-302,-288,-321},{-150,-152,-152,-238,-345,-190}}},{{{-167,-167,-186,-289,-382,-358},{-385,-257,-401,-158,-254,-284},{-374,-303,-399,-410,-407,-197},{-191,-298,-281,-180,-191,-227},{-246,-156,-251,-218,-404,-232},{-248,-399,-218,-289,-251,-268},{-306,-197,-349,-336,-382,-139},{-352,-355,-175,-360,-246,-341},{-377,-363,-177,-158,-238,-306},{-401,-156,-369,-221,-235,-336}},{{-385,-199,-349,-339,-374,-227},{-377,-218,-251,-216,-186,-169},{-314,-254,-240,-388,-401,-221},{-336,-328,-169,-243,-379,-379},{-268,-202,-328,-207,-238,-227},{-240,-257,-388,-341,-379,-164},{-240,-136,-371,-396,-240,-358},{-210,-216,-393,-355,-355,-317},{-328,-235,-317,-322,-180,-319},{-278,-377,-156,-232,-352,-145}},{{-281,-216,-355,-300,-262,-341},{-374,-355,-382,-139,-257,-407},{-352,-390,-167,-251,-232,-177},{-366,-257,-278,-298,-314,-224},{-287,-303,-287,-292,-388,-191},{-390,-188,-175,-374,-183,-257},{-330,-251,-218,-325,-322,-183},{-194,-333,-333,-161,-153,-352},{-355,-238,-289,-191,-341,-317},{-268,-194,-145,-240,-270,-317}}},{{{-219,-82,-171,-199,-123,-140},{-86,-125,-106,-183,-142,-142},{-112,-211,-209,-200,-97,-142},{-228,-194,-186,-129,-134,-159},{-152,-169,-229,-229,-102,-86},{-172,-186,-97,-122,-189,-199},{-182,-100,-89,-134,-223,-102},{-109,-136,-192,-136,-229,-188},{-191,-177,-189,-125,-163,-219},{-202,-148,-211,-152,-185,-83}},{{-157,-108,-206,-136,-191,-194},{-77,-188,-99,-166,-125,-100},{-142,-228,-132,-129,-166,-100},{-154,-219,-120,-126,-145,-151},{-231,-219,-189,-148,-92,-123},{-103,-99,-123,-213,-143,-159},{-189,-86,-216,-148,-174,-92},{-156,-126,-105,-80,-117,-128},{-159,-128,-177,-120,-99,-206},{-106,-97,-94,-186,-85,-160}},{{-188,-82,-202,-116,-185,-216},{-123,-182,-194,-220,-94,-222},{-89,-82,-105,-217,-226,-99},{-89,-176,-111,-182,-146,-199},{-106,-159,-205,-177,-88,-119},{-116,-105,-206,-102,-216,-136},{-223,-140,-134,-165,-140,-86},{-180,-92,-166,-220,-136,-214},{-131,-172,-94,-105,-213,-159},{-109,-132,-128,-209,-83,-108}}},{{{-262,-251,-262,-264,-169,-193},{-186,-169,-186,-218,-100,-235},{-255,-126,-266,-146,-257,-133},{-195,-195,-235,-147,-209,-146},{-248,-238,-96,-138,-224,-166},{-224,-107,-226,-217,-269,-268},{-171,-149,-229,-118,-207,-187},{-209,-91,-207,-100,-153,-155},{-180,-257,-136,-95,-151,-151},{-129,-266,-228,-240,-204,-166}},{{-257,-157,-271,-136,-158,-157},{-233,-255,-242,-240,-140,-249},{-258,-233,-180,-262,-198,-104},{-102,-273,-124,-240,-200,-189},{-215,-93,-257,-217,-257,-202},{-229,-126,-235,-240,-197,-217},{-235,-116,-218,-104,-127,-198},{-204,-93,-244,-258,-140,-144},{-158,-235,-186,-140,-182,-135},{-115,-248,-135,-195,-93,-107}},{{-167,-238,-173,-171,-186,-138},{-255,-106,-102,-173,-193,-142},{-177,-238,-211,-257,-100,-175},{-260,-166,-111,-264,-129,-111},{-135,-166,-184,-207,-257,-215},{-116,-167,-244,-197,-116,-158},{-184,-217,-113,-149,-138,-113},{-189,-187,-262,-269,-147,-151},{-202,-106,-136,-248,-195,-126},{-222,-209,-217,-226,-175,-258}}},{{{-245,-216,-181,-213,-316,-301},{-304,-172,-292,-201,-358,-294},{-154,-135,-328,-230,-218,-184},{-230,-235,-243,-198,-132,-318},{-306,-350,-169,-333,-211,-181},{-233,-127,-353,-328,-203,-333},{-272,-240,-294,-157,-262,-289},{-164,-350,-225,-122,-137,-211},{-260,-257,-174,-252,-355,-213},{-252,-218,-282,-331,-296,-213}},{{-206,-201,-233,-179,-355,-267},{-142,-196,-223,-331,-240,-154},{-142,-272,-145,-191,-287,-206},{-230,-316,-184,-345,-203,-218},{-279,-292,-326,-279,-336,-240},{-299,-122,-140,-341,-125,-274},{-355,-142,-140,-294,-225,-238},{-282,-140,-213,-245,-331,-316},{-162,-326,-240,-277,-176,-345},{-201,-201,-235,-186,-289,-235}},{{-191,-223,-368,-206,-338,-169},{-189,-203,-270,-240,-196,-368},{-196,-243,-338,-341,-247,-292},{-316,-186,-152,-321,-274,-345},{-343,-142,-360,-157,-140,-213},{-201,-336,-321,-255,-314,-176},{-174,-309,-252,-164,-350,-181},{-243,-228,-235,-323,-267,-353},{-181,-137,-167,-164,-301,-179},{-304,-218,-191,-137,-225,-189}}},{{{-323,-201,-328,-243,-321,-300},{-208,-303,-231,-185,-120,-189},{-256,-243,-192,-226,-196,-208},{-219,-321,-196,-270,-152,-346},{-270,-192,-300,-259,-120,-210},{-164,-240,-194,-129,-217,-219},{-217,-199,-247,-141,-307,-162},{-254,-263,-166,-243,-303,-298},{-219,-266,-192,-139,-337,-280},{-261,-254,-259,-222,-314,-229}},{{-333,-166,-222,-233,-245,-273},{-219,-171,-173,-194,-182,-150},{-240,-289,-238,-122,-333,-312},{-199,-141,-176,-139,-152,-321},{-141,-314,-310,-256,-146,-226},{-284,-189,-263,-245,-210,-125},{-169,-208,-280,-291,-203,-226},{-314,-125,-245,-215,-275,-127},{-139,-171,-222,-335,-337,-240},{-201,-141,-249,-254,-125,-171}},{{-187,-187,-249,-210,-323,-189},{-293,-208,-323,-268,-259,-275},{-157,-189,-143,-233,-319,-217},{-185,-252,-268,-199,-182,-180},{-249,-319,-192,-120,-259,-141},{-120,-178,-176,-173,-185,-180},{-222,-148,-203,-277,-129,-116},{-337,-116,-270,-337,-275,-266},{-303,-263,-277,-312,-217,-245},{-252,-249,-127,-282,-270,-266}}},{{{-185,-423,-188,-206,-385,-370},{-409,-403,-423,-323,-206,-279},{-171,-153,-223,-388,-350,-244},{-153,-335,-159,-270,-370,-165},{-409,-344,-323,-162,-270,-276},{-162,-338,-229,-291,-400,-276},{-312,-303,-338,-353,-400,-300},{-206,-147,-173,-220,-309,-406},{-215,-294,-353,-417,-373,-412},{-226,-341,-297,-306,-318,-191}},{{-285,-315,-203,-270,-400,-256},{-373,-226,-412,-409,-173,-209},{-262,-256,-259,-312,-206,-220},{-297,-223,-173,-212,-220,-171},{-238,-223,-409,-215,-182,-303},{-397,-215,-294,-273,-368,-344},{-356,-382,-438,-200,-270,-223},{-309,-194,-223,-350,-176,-365},{-415,-153,-297,-385,-276,-173},{-356,-182,-153,-232,-279,-329}},{{-256,-382,-182,-171,-262,-212},{-350,-182,-294,-282,-150,-179},{-423,-171,-194,-326,-359,-265},{-412,-423,-376,-218,-347,-212},{-312,-353,-403,-171,-335,-341},{-162,-429,-173,-241,-300,-294},{-420,-176,-173,-200,-256,-435},{-303,-388,-256,-191,-362,-168},{-306,-297,-220,-162,-270,-203},{-356,-173,-412,-197,-153,-165}}}}; // 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,3,2,6,3,2,8,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,9,4,3,8,5,3,8,4,3,8,5,3,8,5,3,8,5,3,8,4,3,8,4,3,8,4,3,7,4,3,8,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,1,5,9,1,7,1,3,5,7,9,11,2,6,10,1,7,0,2,4,6,8,10,12,14,1,5,9,13,2,8,14,1,3,5,7,9,11,13,0,4,8,12,1,7,13,1,3,5,7,9,11,13,1,5,9,13,2,8,14,0,2,4,6,8,10,12,14,1,5,9,13,2,8,14,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,2,8,14,0,2,4,6,8,10,12,14,0,4,8,12,1,7,13,1,3,5,7,9,11,13,15,2,6,10,14,2,8,14,1,3,5,7,9,11,13,15,1,5,9,13,2,8,14,0,2,4,6,8,10,12,14,16,2,6,10,14,2,8,14,1,3,5,7,9,11,13,15,0,4,8,12,16,0,6,12,2,4,6,8,10,12,14,16,2,6,10,14,1,7,13,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,1,3,5,7,9,11,13,15,0,4,8,12,16,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,1,5,9,13,2,8,14,1,3,5,7,9,11,13,15,1,5,9,13,2,8,14,1,3,5,7,9,11,13,2,6,10,14,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,2,8,14}; // 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,6,10,14,6,12,6,8,10,12,14,16,7,11,15,6,12,3,5,7,9,11,13,15,17,4,8,12,16,5,11,17,4,6,8,10,12,14,16,3,7,11,15,4,10,16,4,6,8,10,12,14,16,4,8,12,16,5,11,17,2,4,6,8,10,12,14,16,3,7,11,15,4,10,16,2,4,6,8,10,12,14,16,4,8,12,16,3,9,15,2,4,6,8,10,12,14,16,2,6,10,14,4,10,16,2,4,6,8,10,12,14,16,2,6,10,14,3,9,15,3,5,7,9,11,13,15,17,4,8,12,16,4,10,16,3,5,7,9,11,13,15,17,3,7,11,15,4,10,16,1,3,5,7,9,11,13,15,17,3,7,11,15,3,9,15,2,4,6,8,10,12,14,16,1,5,9,13,17,1,7,13,3,5,7,9,11,13,15,17,3,7,11,15,2,8,14,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,2,4,6,8,10,12,14,16,1,5,9,13,17,3,9,15,2,4,6,8,10,12,14,16,2,6,10,14,4,10,16,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,4,10,16,4,6,8,10,12,14,16,5,9,13,17,3,9,15,3,5,7,9,11,13,15,17,5,9,13,17,4,10,16,5,7,9,11,13,15,17,5,9,13,17,5,11,17}; // set of end times of each shipment 
