int Dev = 20;// 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 = 351;//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]={{{{11233,0,0,0,0,0},{11099,0,0,0,0,0},{11236,0,0,0,0,0},{11001,0,0,0,0,0},{11167,0,0,0,0,0},{10836,0,0,0,0,0},{11005,0,0,0,0,0},{10956,0,0,0,0,0},{11222,0,0,0,0,0},{10782,0,0,0,0,0}},{{10943,0,0,0,0,0},{11228,0,0,0,0,0},{10730,0,0,0,0,0},{11209,0,0,0,0,0},{11066,0,0,0,0,0},{11486,0,0,0,0,0},{10967,0,0,0,0,0},{10814,0,0,0,0,0},{11207,0,0,0,0,0},{11271,0,0,0,0,0}},{{11016,0,0,0,0,0},{11215,0,0,0,0,0},{11348,0,0,0,0,0},{11046,0,0,0,0,0},{10951,0,0,0,0,0},{11134,0,0,0,0,0},{11317,0,0,0,0,0},{11317,0,0,0,0,0},{10744,0,0,0,0,0},{11056,0,0,0,0,0}}},{{{-193,-231,-249,-258,-199,-231},{-244,-251,-213,-228,-190,-240},{-193,-269,-195,-181,-267,-269},{-267,-231,-202,-249,-215,-199},{-251,-208,-228,-213,-204,-184},{-224,-240,-199,-197,-253,-220},{-251,-249,-246,-199,-186,-255},{-262,-224,-202,-233,-251,-186},{-251,-244,-246,-249,-186,-224},{-199,-202,-179,-253,-179,-217}},{{-264,-188,-262,-181,-242,-224},{-202,-190,-255,-228,-262,-246},{-179,-213,-188,-228,-258,-249},{-199,-269,-220,-220,-186,-246},{-195,-258,-211,-228,-249,-228},{-220,-202,-269,-211,-242,-213},{-179,-258,-255,-213,-267,-190},{-208,-197,-264,-235,-217,-186},{-222,-195,-242,-246,-244,-251},{-244,-267,-242,-246,-244,-202}},{{-190,-255,-190,-258,-224,-253},{-181,-246,-258,-224,-264,-262},{-240,-226,-220,-228,-269,-204},{-181,-222,-215,-193,-267,-193},{-242,-204,-181,-246,-228,-181},{-269,-269,-188,-262,-193,-246},{-197,-226,-179,-211,-249,-226},{-253,-269,-213,-206,-208,-264},{-188,-190,-235,-269,-204,-184},{-202,-195,-269,-269,-184,-220}}},{{{-267,-190,-205,-281,-255,-257},{-200,-221,-245,-233,-274,-202},{-217,-286,-219,-278,-231,-281},{-190,-205,-198,-190,-243,-202},{-228,-286,-255,-207,-207,-219},{-245,-207,-193,-243,-236,-228},{-212,-286,-212,-264,-231,-200},{-193,-257,-257,-286,-226,-259},{-228,-276,-283,-190,-283,-271},{-250,-207,-250,-228,-269,-252}},{{-236,-224,-195,-209,-259,-209},{-276,-214,-190,-269,-264,-205},{-236,-278,-214,-248,-221,-236},{-259,-240,-190,-286,-264,-245},{-255,-212,-200,-200,-257,-212},{-212,-214,-255,-283,-283,-286},{-264,-221,-264,-200,-259,-243},{-250,-245,-195,-233,-257,-248},{-264,-262,-278,-200,-221,-226},{-214,-276,-267,-271,-252,-198}},{{-269,-259,-264,-217,-240,-214},{-212,-271,-248,-224,-267,-255},{-269,-233,-214,-267,-238,-269},{-259,-209,-264,-257,-209,-250},{-286,-221,-274,-236,-195,-221},{-281,-209,-205,-274,-262,-214},{-200,-243,-257,-221,-221,-286},{-193,-250,-224,-207,-190,-245},{-224,-236,-255,-198,-238,-248},{-228,-257,-202,-209,-248,-228}}},{{{-308,-265,-224,-287,-273,-328},{-295,-295,-314,-292,-328,-284},{-287,-322,-221,-284,-276,-325},{-287,-270,-325,-235,-270,-238},{-317,-278,-287,-265,-284,-276},{-298,-268,-284,-317,-281,-224},{-235,-328,-281,-303,-257,-257},{-265,-265,-259,-303,-238,-292},{-311,-289,-300,-229,-229,-227},{-328,-287,-306,-308,-254,-298}},{{-240,-232,-248,-295,-268,-298},{-295,-325,-248,-243,-284,-295},{-240,-276,-235,-319,-218,-218},{-314,-254,-278,-265,-229,-235},{-224,-284,-319,-284,-270,-287},{-278,-257,-325,-232,-248,-287},{-298,-308,-221,-262,-270,-292},{-246,-276,-273,-273,-295,-229},{-284,-278,-238,-308,-229,-306},{-232,-268,-262,-328,-303,-300}},{{-221,-248,-298,-311,-240,-254},{-292,-319,-262,-308,-278,-278},{-308,-284,-287,-314,-243,-287},{-281,-232,-238,-303,-289,-270},{-243,-308,-292,-227,-240,-281},{-295,-289,-240,-238,-262,-270},{-319,-322,-273,-319,-289,-281},{-311,-270,-218,-295,-265,-300},{-229,-298,-270,-246,-265,-227},{-243,-235,-246,-298,-224,-238}}},{{{-137,-174,-172,-171,-180,-149},{-177,-149,-128,-134,-162,-157},{-177,-176,-126,-166,-148,-128},{-166,-174,-168,-128,-157,-146},{-171,-163,-154,-137,-177,-131},{-126,-145,-180,-152,-126,-149},{-146,-123,-143,-140,-162,-169},{-132,-172,-134,-129,-132,-139},{-172,-177,-152,-137,-131,-132},{-148,-162,-134,-152,-163,-146}},{{-146,-166,-156,-151,-180,-176},{-137,-166,-177,-160,-123,-145},{-146,-125,-146,-176,-166,-166},{-180,-160,-146,-125,-136,-166},{-137,-145,-140,-151,-162,-125},{-129,-168,-179,-180,-171,-139},{-163,-165,-128,-132,-176,-134},{-137,-145,-179,-129,-132,-132},{-179,-146,-177,-174,-157,-149},{-134,-176,-180,-142,-174,-171}},{{-136,-125,-152,-140,-156,-163},{-151,-148,-179,-146,-154,-123},{-132,-152,-159,-180,-174,-129},{-140,-145,-174,-143,-142,-151},{-131,-142,-162,-139,-140,-140},{-165,-177,-172,-163,-157,-165},{-172,-157,-140,-182,-165,-183},{-174,-134,-136,-183,-160,-131},{-128,-166,-129,-148,-185,-166},{-177,-179,-182,-129,-160,-177}}},{{{-209,-164,-167,-209,-218,-211},{-173,-173,-158,-146,-180,-217},{-171,-213,-206,-197,-193,-180},{-198,-206,-217,-191,-153,-193},{-211,-189,-153,-167,-182,-186},{-171,-193,-209,-151,-206,-167},{-195,-167,-160,-193,-177,-180},{-186,-164,-178,-213,-151,-198},{-187,-187,-204,-167,-191,-217},{-147,-157,-189,-147,-178,-173}},{{-162,-209,-191,-213,-213,-151},{-164,-177,-206,-217,-206,-207},{-155,-195,-169,-171,-151,-206},{-155,-171,-157,-193,-153,-171},{-187,-182,-169,-162,-197,-191},{-215,-186,-153,-197,-206,-147},{-147,-157,-167,-189,-211,-184},{-215,-167,-155,-187,-164,-157},{-202,-193,-162,-157,-206,-153},{-166,-186,-147,-162,-164,-158}},{{-162,-158,-200,-167,-209,-209},{-207,-146,-180,-218,-178,-167},{-178,-184,-180,-197,-200,-160},{-204,-153,-206,-186,-204,-217},{-207,-198,-147,-173,-151,-200},{-146,-149,-193,-175,-202,-186},{-173,-178,-213,-215,-211,-171},{-162,-197,-195,-166,-189,-213},{-218,-186,-218,-197,-207,-191},{-153,-200,-187,-184,-218,-193}}},{{{-230,-257,-233,-228,-294,-250},{-201,-196,-240,-292,-270,-260},{-267,-250,-198,-206,-289,-238},{-211,-211,-255,-267,-198,-262},{-255,-282,-260,-238,-240,-274},{-240,-243,-287,-211,-216,-203},{-198,-198,-292,-287,-243,-287},{-243,-245,-265,-279,-225,-225},{-255,-198,-245,-196,-260,-233},{-240,-213,-240,-218,-196,-201}},{{-238,-216,-284,-279,-238,-233},{-211,-257,-228,-279,-225,-289},{-265,-250,-198,-225,-198,-294},{-279,-255,-279,-284,-208,-270},{-287,-235,-223,-201,-228,-238},{-228,-282,-260,-233,-270,-238},{-218,-198,-213,-282,-243,-247},{-255,-252,-265,-240,-274,-208},{-198,-294,-247,-262,-196,-279},{-245,-262,-284,-272,-287,-225}},{{-216,-282,-294,-289,-272,-230},{-279,-220,-250,-208,-292,-211},{-238,-240,-279,-274,-235,-289},{-216,-282,-243,-284,-270,-287},{-270,-287,-267,-230,-216,-230},{-287,-294,-203,-262,-196,-274},{-284,-255,-228,-203,-247,-201},{-257,-262,-289,-289,-284,-274},{-255,-272,-213,-223,-203,-198},{-233,-257,-211,-250,-203,-289}}},{{{-210,-199,-240,-229,-222,-208},{-275,-219,-213,-196,-192,-243},{-277,-206,-222,-185,-189,-238},{-240,-275,-187,-245,-222,-219},{-238,-192,-275,-263,-194,-256},{-259,-201,-245,-192,-270,-261},{-185,-196,-206,-263,-236,-263},{-201,-219,-243,-201,-215,-215},{-206,-236,-215,-247,-270,-247},{-247,-268,-203,-256,-215,-259}},{{-254,-238,-194,-189,-252,-252},{-273,-210,-213,-273,-256,-201},{-240,-249,-185,-208,-224,-222},{-233,-268,-189,-219,-268,-266},{-270,-254,-203,-275,-261,-189},{-266,-236,-268,-268,-268,-210},{-196,-254,-210,-275,-238,-245},{-236,-194,-229,-219,-210,-189},{-229,-247,-187,-210,-240,-226},{-236,-217,-229,-208,-222,-229}},{{-222,-268,-196,-196,-215,-187},{-213,-226,-199,-277,-199,-222},{-243,-254,-215,-210,-203,-199},{-189,-270,-268,-189,-229,-247},{-189,-247,-231,-259,-240,-208},{-229,-266,-189,-236,-245,-256},{-252,-203,-199,-219,-185,-256},{-275,-247,-277,-275,-273,-231},{-277,-210,-208,-254,-213,-231},{-231,-254,-261,-201,-245,-254}}},{{{-276,-326,-335,-270,-285,-279},{-303,-312,-238,-335,-326,-285},{-276,-270,-294,-338,-273,-338},{-273,-256,-344,-332,-347,-344},{-341,-294,-265,-294,-294,-294},{-273,-318,-259,-285,-250,-291},{-344,-268,-338,-244,-300,-250},{-259,-303,-318,-335,-335,-244},{-309,-353,-253,-335,-256,-338},{-276,-250,-250,-282,-338,-268}},{{-235,-344,-318,-238,-309,-244},{-291,-247,-329,-303,-235,-332},{-268,-294,-282,-335,-297,-270},{-312,-320,-309,-353,-323,-262},{-332,-285,-303,-279,-353,-329},{-291,-350,-279,-350,-332,-270},{-303,-338,-273,-306,-276,-235},{-306,-247,-309,-297,-332,-326},{-338,-282,-347,-273,-341,-262},{-276,-268,-297,-335,-309,-294}},{{-329,-338,-247,-338,-259,-256},{-353,-273,-259,-285,-256,-347},{-250,-335,-350,-303,-297,-309},{-235,-279,-244,-350,-279,-288},{-318,-309,-253,-297,-344,-320},{-297,-238,-256,-323,-288,-279},{-353,-353,-347,-344,-250,-259},{-256,-270,-259,-282,-323,-273},{-235,-347,-250,-259,-291,-262},{-270,-338,-309,-323,-273,-320}}}}; // 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,3,7,4,3,8,4,3,7,4,3,8,4,3,8,4,3,8,4,3,8,4,3,8,4,3,7,4,3,8,5,3,8,4,3,9,4,3,9,5,3,8,5,3,9,4,3,8,4,3,8,4,3,8,4,3,7,4,3,7,4,3,8,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,350}}; // set of shipments in each bid 
int SHsts[SPN]={1,3,5,7,9,11,0,4,8,12,2,8,1,3,5,7,9,11,2,6,10,1,7,1,3,5,7,9,11,1,5,9,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,2,6,10,14,1,7,13,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,2,8,14,0,2,4,6,8,10,12,14,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,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,0,4,8,12,1,7,13,1,3,5,7,9,11,13,15,0,4,8,12,16,0,6,12,1,3,5,7,9,11,13,15,1,5,9,13,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,0,4,8,12,16,1,7,13,2,4,6,8,10,12,14,16,0,4,8,12,16,0,6,12,0,2,4,6,8,10,12,14,16,1,5,9,13,0,6,12,0,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,0,6,12,0,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,0,6,12,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}; // set of start times of each shipment 
int SHets[SPN]={6,8,10,12,14,16,5,9,13,17,7,13,6,8,10,12,14,16,7,11,15,6,12,6,8,10,12,14,16,6,10,14,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,5,9,13,17,4,10,16,5,7,9,11,13,15,17,4,8,12,16,5,11,17,3,5,7,9,11,13,15,17,3,7,11,15,4,10,16,2,4,6,8,10,12,14,16,4,8,12,16,4,10,16,3,5,7,9,11,13,15,17,4,8,12,16,2,8,14,3,5,7,9,11,13,15,17,2,6,10,14,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,2,6,10,14,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,2,6,10,14,3,9,15,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,1,5,9,13,17,2,8,14,3,5,7,9,11,13,15,17,1,5,9,13,17,1,7,13,1,3,5,7,9,11,13,15,17,2,6,10,14,1,7,13,2,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,2,8,14,2,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,3,9,15,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}; // set of end times of each shipment 
