int Dev = 40;// 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 = 353;//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]={{{{10419,0,0,0,0,0},{11004,0,0,0,0,0},{11504,0,0,0,0,0},{11568,0,0,0,0,0},{10601,0,0,0,0,0},{11462,0,0,0,0,0},{10248,0,0,0,0,0},{11612,0,0,0,0,0},{11071,0,0,0,0,0},{11021,0,0,0,0,0}},{{11055,0,0,0,0,0},{10809,0,0,0,0,0},{11046,0,0,0,0,0},{10509,0,0,0,0,0},{11610,0,0,0,0,0},{10906,0,0,0,0,0},{10794,0,0,0,0,0},{11032,0,0,0,0,0},{10916,0,0,0,0,0},{10765,0,0,0,0,0}},{{10726,0,0,0,0,0},{11223,0,0,0,0,0},{11269,0,0,0,0,0},{11581,0,0,0,0,0},{11079,0,0,0,0,0},{12093,0,0,0,0,0},{11515,0,0,0,0,0},{10730,0,0,0,0,0},{11405,0,0,0,0,0},{10362,0,0,0,0,0}}},{{{-166,-305,-157,-226,-289,-159},{-137,-195,-166,-262,-235,-293},{-217,-170,-311,-311,-204,-152},{-255,-273,-273,-235,-155,-267},{-224,-273,-246,-164,-311,-170},{-300,-235,-204,-240,-137,-253},{-242,-148,-172,-199,-204,-215},{-280,-276,-222,-311,-289,-262},{-224,-179,-237,-240,-141,-168},{-273,-222,-155,-267,-269,-134}},{{-258,-278,-298,-215,-264,-276},{-231,-161,-175,-237,-157,-251},{-226,-166,-188,-184,-282,-262},{-181,-164,-282,-152,-291,-211},{-269,-202,-215,-253,-300,-211},{-249,-143,-280,-141,-228,-190},{-289,-228,-249,-220,-139,-302},{-179,-302,-244,-255,-240,-242},{-293,-139,-190,-224,-150,-284},{-155,-291,-150,-188,-300,-244}},{{-307,-181,-289,-159,-211,-311},{-280,-307,-251,-170,-202,-298},{-222,-235,-253,-249,-206,-237},{-166,-231,-284,-269,-293,-240},{-300,-276,-267,-168,-302,-213},{-262,-271,-197,-226,-276,-157},{-242,-314,-220,-168,-231,-193},{-298,-311,-235,-240,-204,-224},{-311,-134,-235,-181,-231,-237},{-204,-139,-300,-237,-164,-307}}},{{{-171,-150,-319,-240,-255,-305},{-278,-152,-262,-298,-238,-159},{-183,-145,-326,-317,-257,-328},{-302,-333,-190,-274,-228,-276},{-219,-205,-286,-143,-200,-271},{-309,-219,-243,-319,-224,-236},{-207,-259,-190,-183,-236,-207},{-290,-333,-181,-333,-250,-157},{-319,-243,-143,-305,-159,-193},{-333,-176,-219,-231,-200,-200}},{{-264,-264,-288,-226,-321,-321},{-324,-331,-309,-328,-259,-178},{-214,-221,-250,-217,-167,-231},{-195,-171,-159,-221,-157,-198},{-226,-331,-252,-286,-259,-190},{-283,-314,-176,-152,-214,-236},{-262,-274,-171,-195,-293,-207},{-169,-226,-195,-281,-181,-312},{-195,-250,-257,-195,-171,-148},{-212,-305,-233,-143,-257,-286}},{{-269,-255,-195,-171,-224,-167},{-328,-286,-195,-240,-290,-176},{-312,-259,-167,-200,-176,-176},{-305,-195,-298,-333,-302,-202},{-278,-245,-262,-181,-212,-198},{-250,-295,-245,-321,-271,-300},{-228,-243,-271,-207,-276,-317},{-176,-162,-290,-214,-331,-264},{-288,-302,-324,-231,-188,-307},{-278,-207,-169,-245,-333,-171}}},{{{-303,-213,-259,-207,-325,-232},{-199,-292,-298,-344,-358,-281},{-328,-336,-259,-322,-295,-341},{-352,-363,-379,-349,-314,-268},{-254,-333,-164,-303,-284,-289},{-336,-306,-336,-319,-213,-284},{-216,-287,-180,-172,-259,-246},{-287,-349,-172,-358,-232,-213},{-254,-183,-224,-319,-227,-276},{-202,-314,-172,-276,-292,-240}},{{-382,-199,-339,-238,-333,-186},{-197,-213,-169,-164,-235,-292},{-167,-268,-371,-240,-319,-186},{-240,-349,-339,-183,-207,-164},{-341,-358,-377,-303,-265,-221},{-254,-276,-317,-333,-246,-328},{-191,-276,-352,-202,-344,-221},{-207,-257,-199,-216,-333,-336},{-218,-284,-213,-371,-317,-281},{-262,-265,-355,-205,-317,-164}},{{-246,-216,-352,-213,-246,-177},{-199,-246,-303,-227,-224,-238},{-303,-183,-227,-369,-317,-202},{-308,-355,-341,-210,-363,-254},{-268,-273,-169,-169,-319,-355},{-317,-251,-235,-188,-311,-363},{-278,-235,-366,-363,-371,-347},{-199,-227,-325,-246,-259,-194},{-191,-240,-254,-183,-232,-238},{-175,-238,-164,-328,-186,-308}}},{{{-132,-172,-132,-109,-151,-137},{-156,-171,-177,-128,-196,-205},{-163,-196,-186,-205,-99,-99},{-116,-174,-95,-191,-112,-214},{-140,-134,-146,-214,-165,-151},{-128,-132,-111,-117,-99,-132},{-152,-203,-162,-168,-99,-192},{-194,-146,-131,-108,-103,-179},{-146,-126,-157,-117,-177,-140},{-95,-137,-183,-188,-97,-134}},{{-176,-137,-129,-100,-176,-134},{-191,-123,-106,-140,-157,-122},{-157,-213,-200,-92,-214,-149},{-148,-99,-191,-149,-112,-151},{-137,-196,-180,-123,-126,-189},{-123,-186,-134,-177,-163,-109},{-163,-160,-177,-122,-122,-117},{-200,-114,-183,-108,-95,-143},{-162,-136,-95,-206,-95,-194},{-94,-159,-128,-114,-169,-116}},{{-109,-112,-145,-208,-177,-126},{-211,-154,-102,-183,-134,-137},{-97,-94,-142,-148,-214,-202},{-192,-129,-109,-191,-103,-171},{-100,-105,-208,-132,-151,-108},{-131,-209,-117,-179,-199,-112},{-102,-148,-197,-205,-139,-185},{-146,-100,-100,-179,-186,-202},{-116,-206,-100,-206,-179,-206},{-168,-191,-180,-137,-171,-197}}},{{{-160,-111,-136,-144,-200,-158},{-129,-231,-144,-218,-187,-140},{-186,-198,-237,-147,-229,-118},{-155,-253,-220,-166,-140,-189},{-166,-193,-191,-116,-124,-246},{-244,-224,-224,-220,-228,-235},{-144,-169,-147,-211,-133,-147},{-195,-173,-113,-184,-160,-233},{-131,-207,-193,-171,-224,-131},{-155,-151,-167,-248,-135,-253}},{{-200,-186,-109,-233,-120,-222},{-146,-215,-249,-180,-129,-189},{-164,-217,-186,-195,-226,-147},{-120,-153,-162,-115,-133,-189},{-231,-209,-167,-207,-204,-136},{-218,-231,-157,-220,-160,-158},{-191,-153,-131,-218,-149,-153},{-186,-182,-204,-122,-242,-171},{-169,-249,-138,-118,-129,-164},{-202,-109,-218,-116,-124,-197}},{{-207,-215,-140,-184,-118,-215},{-111,-127,-242,-218,-157,-211},{-129,-231,-184,-224,-248,-182},{-129,-144,-126,-193,-242,-248},{-158,-135,-178,-226,-246,-213},{-140,-135,-253,-206,-222,-109},{-235,-242,-115,-157,-111,-178},{-173,-133,-220,-142,-189,-220},{-233,-211,-193,-131,-217,-222},{-142,-228,-144,-173,-220,-164}}},{{{-299,-147,-176,-211,-169,-162},{-157,-191,-294,-343,-174,-255},{-257,-235,-220,-176,-179,-338},{-189,-338,-154,-154,-270,-289},{-154,-270,-257,-267,-167,-250},{-255,-233,-164,-245,-213,-154},{-316,-233,-284,-331,-255,-164},{-164,-314,-198,-318,-225,-176},{-336,-316,-220,-294,-316,-321},{-336,-216,-172,-294,-154,-326}},{{-184,-235,-243,-321,-265,-206},{-240,-289,-309,-225,-243,-196},{-220,-333,-172,-255,-316,-301},{-223,-152,-270,-216,-277,-282},{-314,-172,-326,-191,-162,-228},{-152,-336,-270,-154,-336,-201},{-230,-243,-216,-238,-260,-306},{-252,-213,-194,-240,-299,-228},{-296,-267,-296,-216,-235,-309},{-274,-294,-294,-189,-238,-314}},{{-154,-240,-277,-162,-328,-331},{-203,-331,-318,-169,-147,-196},{-304,-252,-196,-306,-181,-211},{-233,-277,-181,-321,-176,-245},{-338,-240,-223,-186,-296,-299},{-341,-184,-296,-341,-309,-341},{-194,-343,-314,-296,-272,-250},{-247,-279,-270,-169,-186,-233},{-262,-306,-267,-164,-149,-172},{-162,-172,-265,-225,-198,-218}}},{{{-176,-189,-286,-247,-266,-247},{-141,-210,-254,-256,-226,-150},{-307,-243,-282,-261,-277,-217},{-162,-215,-247,-243,-240,-266},{-171,-173,-286,-222,-148,-171},{-159,-268,-314,-245,-261,-203},{-201,-187,-266,-139,-310,-213},{-259,-319,-256,-141,-148,-319},{-303,-305,-245,-201,-182,-259},{-266,-155,-275,-305,-215,-277}},{{-143,-189,-314,-189,-148,-150},{-286,-182,-213,-277,-319,-182},{-275,-245,-159,-305,-173,-321},{-303,-224,-286,-312,-152,-277},{-143,-261,-236,-139,-139,-224},{-148,-199,-166,-261,-268,-215},{-164,-196,-291,-155,-254,-215},{-233,-236,-263,-277,-148,-159},{-213,-296,-314,-219,-231,-187},{-162,-146,-210,-259,-189,-222}},{{-173,-213,-217,-176,-185,-282},{-312,-261,-293,-166,-284,-189},{-314,-185,-300,-176,-210,-155},{-291,-166,-143,-243,-245,-178},{-240,-243,-293,-245,-192,-323},{-310,-162,-291,-226,-226,-293},{-261,-150,-238,-217,-192,-178},{-319,-312,-143,-215,-146,-143},{-273,-280,-217,-146,-307,-208},{-215,-249,-282,-263,-176,-157}}},{{{-403,-256,-218,-368,-223,-353},{-226,-259,-312,-365,-365,-297},{-215,-241,-279,-347,-318,-247},{-176,-309,-220,-353,-226,-406},{-297,-329,-300,-223,-409,-182},{-265,-179,-412,-323,-403,-359},{-250,-185,-206,-309,-350,-300},{-341,-244,-285,-385,-397,-409},{-270,-326,-276,-253,-406,-288},{-306,-362,-400,-226,-259,-359}},{{-185,-253,-323,-215,-335,-285},{-320,-191,-341,-200,-303,-335},{-273,-300,-238,-356,-276,-209},{-291,-338,-282,-347,-300,-391},{-400,-362,-359,-370,-229,-391},{-200,-368,-359,-215,-318,-344},{-309,-244,-318,-179,-373,-332},{-223,-332,-379,-385,-359,-288},{-185,-320,-409,-200,-353,-335},{-332,-406,-320,-373,-253,-212}},{{-247,-373,-297,-203,-376,-347},{-373,-194,-376,-344,-238,-382},{-406,-379,-359,-215,-356,-376},{-373,-332,-359,-215,-368,-309},{-191,-270,-365,-241,-241,-238},{-176,-376,-297,-391,-406,-379},{-212,-297,-388,-197,-232,-400},{-253,-262,-235,-356,-385,-188},{-403,-235,-368,-359,-362,-400},{-309,-182,-206,-218,-215,-382}}}}; // 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,3,7,4,3,6,3,2,7,4,3,8,4,3,8,4,3,8,4,3,8,4,3,8,4,3,7,4,3,8,4,3,8,4,3,9,5,3,8,4,3,9,4,3,8,5,3,8,4,3,8,5,3,8,4,3,7,4,3,8,4,3,8,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,351,352}}; // set of shipments in each bid 
int SHsts[SPN]={1,3,5,7,9,11,1,5,9,0,6,12,0,2,4,6,8,10,12,0,4,8,12,0,6,12,2,4,6,8,10,12,2,6,10,2,8,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,0,2,4,6,8,10,12,14,1,5,9,13,0,6,12,0,2,4,6,8,10,12,14,1,5,9,13,0,6,12,0,2,4,6,8,10,12,14,0,4,8,12,1,7,13,1,3,5,7,9,11,13,15,1,5,9,13,1,7,13,2,4,6,8,10,12,14,0,4,8,12,2,8,14,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,0,2,4,6,8,10,12,14,16,0,4,8,12,16,0,6,12,2,4,6,8,10,12,14,16,1,5,9,13,1,7,13,0,2,4,6,8,10,12,14,16,2,6,10,14,0,6,12,1,3,5,7,9,11,13,15,0,4,8,12,16,2,8,14,1,3,5,7,9,11,13,15,1,5,9,13,0,6,12,2,4,6,8,10,12,14,16,0,4,8,12,16,2,8,14,1,3,5,7,9,11,13,15,2,6,10,14,0,6,12,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,0,6,12,0,2,4,6,8,10,12,14,2,6,10,14,0,6,12,1,3,5,7,9,11,13,2,6,10,14,1,7,13,0,2,4,6,8,10,12,14,1,5,9,13,2,8,14}; // set of start times of each shipment 
int SHets[SPN]={6,8,10,12,14,16,6,10,14,5,11,17,5,7,9,11,13,15,17,5,9,13,17,5,11,17,7,9,11,13,15,17,7,11,15,7,13,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,3,5,7,9,11,13,15,17,4,8,12,16,3,9,15,2,4,6,8,10,12,14,16,3,7,11,15,2,8,14,2,4,6,8,10,12,14,16,2,6,10,14,3,9,15,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,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,1,3,5,7,9,11,13,15,17,1,5,9,13,17,1,7,13,3,5,7,9,11,13,15,17,2,6,10,14,2,8,14,1,3,5,7,9,11,13,15,17,3,7,11,15,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,1,7,13,3,5,7,9,11,13,15,17,1,5,9,13,17,3,9,15,3,5,7,9,11,13,15,17,4,8,12,16,2,8,14,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,2,8,14,3,5,7,9,11,13,15,17,5,9,13,17,3,9,15,4,6,8,10,12,14,16,5,9,13,17,4,10,16,3,5,7,9,11,13,15,17,4,8,12,16,5,11,17}; // set of end times of each shipment 
