int Dev = 30;// 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 = 349;//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]={{{{10866,0,0,0,0,0},{11136,0,0,0,0,0},{10962,0,0,0,0,0},{10383,0,0,0,0,0},{10927,0,0,0,0,0},{11143,0,0,0,0,0},{11079,0,0,0,0,0},{11224,0,0,0,0,0},{11363,0,0,0,0,0},{11051,0,0,0,0,0}},{{10981,0,0,0,0,0},{10959,0,0,0,0,0},{11374,0,0,0,0,0},{11299,0,0,0,0,0},{10399,0,0,0,0,0},{11135,0,0,0,0,0},{11133,0,0,0,0,0},{11334,0,0,0,0,0},{10738,0,0,0,0,0},{10968,0,0,0,0,0}},{{11063,0,0,0,0,0},{11086,0,0,0,0,0},{11680,0,0,0,0,0},{10822,0,0,0,0,0},{11372,0,0,0,0,0},{11233,0,0,0,0,0},{11468,0,0,0,0,0},{11162,0,0,0,0,0},{11416,0,0,0,0,0},{10979,0,0,0,0,0}}},{{{-222,-246,-226,-179,-220,-233},{-193,-184,-269,-184,-231,-188},{-159,-157,-220,-164,-228,-161},{-175,-179,-213,-251,-208,-267},{-213,-231,-197,-289,-161,-215},{-251,-271,-253,-289,-262,-262},{-202,-226,-181,-231,-273,-177},{-246,-244,-175,-284,-202,-240},{-260,-208,-260,-206,-217,-217},{-215,-195,-251,-280,-260,-159}},{{-157,-172,-284,-206,-213,-172},{-262,-177,-271,-177,-166,-170},{-276,-282,-276,-289,-260,-166},{-215,-166,-206,-246,-237,-228},{-246,-161,-222,-240,-195,-166},{-269,-177,-226,-269,-181,-258},{-206,-215,-289,-269,-242,-246},{-213,-264,-179,-204,-195,-253},{-170,-202,-172,-289,-204,-228},{-197,-179,-202,-242,-264,-258}},{{-269,-246,-224,-280,-190,-249},{-195,-181,-231,-175,-253,-179},{-228,-184,-289,-278,-226,-291},{-197,-170,-233,-282,-242,-282},{-240,-164,-258,-211,-273,-159},{-161,-287,-262,-170,-278,-175},{-289,-253,-262,-211,-253,-204},{-269,-271,-287,-175,-235,-284},{-267,-269,-264,-282,-164,-262},{-284,-224,-228,-228,-240,-175}}},{{{-167,-281,-257,-305,-183,-207},{-190,-302,-193,-200,-200,-238},{-298,-290,-212,-171,-264,-264},{-240,-290,-176,-198,-305,-200},{-214,-217,-224,-288,-290,-178},{-169,-259,-176,-209,-290,-181},{-309,-212,-283,-257,-226,-252},{-259,-288,-240,-248,-274,-302},{-293,-288,-262,-276,-181,-295},{-221,-309,-283,-269,-228,-245}},{{-178,-300,-169,-290,-252,-181},{-245,-309,-302,-178,-262,-171},{-190,-178,-264,-252,-269,-178},{-250,-309,-240,-171,-290,-190},{-231,-300,-286,-176,-262,-221},{-252,-233,-307,-224,-243,-264},{-236,-167,-262,-190,-169,-233},{-264,-286,-209,-293,-293,-283},{-278,-207,-233,-200,-186,-171},{-205,-178,-176,-219,-298,-238}},{{-252,-178,-167,-226,-245,-305},{-302,-286,-167,-243,-181,-295},{-298,-298,-309,-281,-295,-274},{-238,-298,-309,-281,-214,-171},{-259,-240,-271,-298,-283,-300},{-176,-209,-274,-267,-259,-307},{-212,-288,-236,-295,-176,-255},{-226,-267,-174,-205,-221,-181},{-176,-286,-188,-267,-190,-193},{-276,-250,-243,-233,-309,-214}}},{{{-317,-257,-325,-322,-333,-205},{-287,-322,-232,-306,-355,-352},{-197,-349,-287,-276,-344,-243},{-199,-221,-213,-281,-210,-191},{-243,-229,-240,-292,-216,-273},{-191,-325,-281,-268,-328,-306},{-210,-347,-240,-202,-270,-262},{-229,-262,-339,-265,-197,-262},{-328,-254,-213,-303,-300,-287},{-355,-240,-191,-191,-197,-265}},{{-347,-229,-191,-347,-311,-268},{-281,-273,-336,-265,-284,-213},{-191,-303,-325,-349,-328,-325},{-352,-227,-227,-216,-292,-352},{-306,-224,-238,-319,-344,-254},{-216,-284,-210,-262,-319,-306},{-240,-235,-344,-289,-265,-240},{-251,-322,-289,-205,-339,-322},{-278,-240,-355,-194,-262,-314},{-349,-336,-325,-227,-238,-197}},{{-259,-259,-238,-246,-191,-287},{-202,-298,-224,-197,-270,-349},{-257,-229,-314,-216,-238,-317},{-330,-243,-235,-229,-265,-248},{-216,-319,-273,-229,-347,-314},{-210,-284,-328,-216,-306,-281},{-352,-349,-349,-300,-336,-248},{-213,-259,-322,-194,-262,-339},{-317,-284,-328,-308,-328,-273},{-205,-248,-216,-300,-328,-240}}},{{{-186,-146,-129,-159,-149,-109},{-148,-162,-166,-112,-179,-183},{-109,-176,-179,-154,-192,-128},{-154,-149,-140,-136,-109,-143},{-143,-171,-114,-197,-180,-192},{-189,-151,-151,-168,-154,-168},{-159,-154,-136,-166,-129,-156},{-157,-171,-108,-119,-165,-182},{-159,-148,-179,-114,-192,-123},{-183,-163,-109,-196,-159,-174}},{{-137,-192,-200,-196,-174,-117},{-196,-134,-116,-146,-112,-174},{-159,-186,-194,-136,-162,-176},{-109,-162,-109,-123,-191,-174},{-156,-149,-177,-151,-191,-160},{-165,-172,-165,-132,-154,-168},{-160,-125,-165,-177,-146,-180},{-142,-169,-156,-120,-131,-117},{-163,-166,-122,-180,-125,-199},{-183,-188,-157,-126,-109,-180}},{{-134,-125,-156,-186,-126,-174},{-165,-168,-179,-146,-140,-116},{-196,-123,-128,-136,-157,-180},{-154,-186,-136,-183,-140,-152},{-196,-171,-112,-168,-172,-165},{-183,-168,-117,-137,-185,-177},{-131,-152,-179,-152,-122,-182},{-185,-156,-171,-182,-123,-194},{-112,-119,-199,-200,-134,-177},{-123,-137,-188,-129,-125,-165}}},{{{-149,-202,-142,-140,-146,-155},{-218,-177,-228,-195,-191,-162},{-209,-173,-202,-175,-184,-167},{-171,-180,-228,-193,-195,-191},{-153,-207,-193,-177,-151,-149},{-189,-189,-160,-213,-147,-207},{-136,-209,-144,-220,-197,-218},{-149,-177,-178,-136,-200,-218},{-209,-146,-186,-173,-202,-138},{-217,-228,-147,-129,-217,-195}},{{-155,-135,-211,-146,-175,-229},{-149,-182,-166,-233,-140,-177},{-213,-233,-155,-129,-160,-164},{-198,-218,-235,-138,-228,-169},{-173,-200,-191,-136,-157,-180},{-226,-187,-229,-129,-173,-184},{-211,-197,-220,-182,-200,-200},{-157,-155,-160,-222,-187,-157},{-222,-224,-178,-127,-131,-171},{-229,-178,-197,-207,-209,-175}},{{-217,-147,-146,-206,-157,-169},{-186,-224,-206,-153,-215,-215},{-226,-153,-222,-178,-178,-186},{-193,-169,-193,-218,-135,-131},{-222,-235,-177,-153,-146,-237},{-204,-157,-198,-164,-160,-231},{-202,-193,-136,-235,-167,-222},{-217,-138,-215,-200,-175,-180},{-197,-144,-149,-157,-178,-215},{-209,-220,-198,-233,-162,-164}}},{{{-289,-225,-311,-292,-272,-191},{-292,-206,-208,-250,-247,-213},{-292,-316,-208,-181,-270,-274},{-238,-230,-179,-314,-243,-194},{-318,-265,-223,-194,-206,-260},{-191,-267,-265,-238,-194,-277},{-181,-270,-238,-189,-186,-255},{-296,-206,-272,-191,-203,-240},{-176,-270,-189,-186,-284,-282},{-181,-284,-250,-257,-213,-233}},{{-316,-223,-238,-181,-211,-309},{-279,-282,-255,-174,-318,-311},{-189,-274,-203,-198,-233,-208},{-250,-176,-301,-250,-213,-282},{-272,-284,-238,-233,-172,-194},{-201,-284,-203,-194,-292,-296},{-233,-211,-252,-309,-296,-301},{-250,-309,-316,-296,-301,-198},{-186,-201,-218,-252,-287,-184},{-223,-311,-174,-309,-181,-220}},{{-299,-301,-318,-228,-289,-230},{-301,-267,-223,-176,-314,-211},{-189,-274,-194,-292,-211,-282},{-189,-270,-255,-247,-198,-223},{-255,-282,-318,-267,-255,-223},{-277,-191,-184,-208,-247,-257},{-223,-267,-189,-191,-252,-243},{-252,-267,-228,-272,-181,-181},{-243,-225,-252,-296,-201,-262},{-220,-174,-257,-260,-243,-201}}},{{{-171,-293,-192,-268,-187,-238},{-206,-210,-282,-270,-182,-213},{-298,-206,-194,-185,-249,-270},{-208,-249,-192,-245,-249,-208},{-284,-171,-206,-162,-196,-266},{-261,-282,-254,-171,-192,-300},{-199,-254,-284,-249,-173,-280},{-277,-219,-293,-263,-300,-284},{-189,-215,-245,-291,-194,-282},{-268,-245,-219,-171,-187,-280}},{{-222,-222,-296,-252,-263,-277},{-203,-249,-259,-215,-263,-231},{-286,-162,-286,-210,-206,-296},{-245,-192,-238,-236,-298,-293},{-185,-180,-166,-171,-166,-247},{-215,-215,-194,-249,-201,-263},{-286,-252,-206,-231,-189,-219},{-217,-215,-268,-217,-240,-243},{-201,-238,-247,-254,-254,-243},{-217,-256,-203,-210,-226,-296}},{{-192,-185,-182,-222,-240,-259},{-291,-252,-245,-298,-289,-166},{-217,-261,-261,-245,-268,-280},{-208,-217,-296,-162,-266,-284},{-217,-185,-185,-263,-164,-176},{-289,-173,-182,-243,-282,-206},{-224,-268,-226,-240,-229,-180},{-273,-224,-280,-180,-236,-222},{-289,-217,-286,-277,-256,-162},{-238,-247,-254,-240,-229,-210}}},{{{-288,-326,-206,-326,-265,-229},{-332,-329,-306,-241,-382,-220},{-291,-285,-300,-270,-232,-309},{-262,-332,-220,-235,-209,-370},{-362,-356,-318,-338,-306,-259},{-270,-350,-232,-212,-262,-268},{-226,-373,-344,-297,-341,-356},{-353,-223,-238,-300,-212,-338},{-373,-270,-265,-315,-376,-344},{-362,-253,-218,-250,-356,-353}},{{-241,-338,-294,-223,-265,-276},{-356,-235,-209,-312,-229,-312},{-382,-270,-309,-306,-359,-229},{-323,-344,-341,-250,-273,-326},{-209,-265,-235,-279,-229,-262},{-238,-332,-344,-215,-309,-306},{-268,-309,-209,-318,-306,-238},{-288,-326,-288,-270,-220,-335},{-285,-365,-253,-268,-235,-376},{-256,-229,-353,-276,-268,-294}},{{-353,-285,-373,-268,-282,-303},{-368,-215,-220,-353,-338,-218},{-353,-335,-215,-368,-306,-244},{-282,-279,-223,-276,-220,-270},{-306,-309,-359,-247,-297,-256},{-326,-297,-373,-362,-376,-229},{-220,-370,-326,-288,-253,-338},{-215,-262,-373,-332,-373,-291},{-273,-338,-379,-209,-356,-268},{-315,-206,-297,-212,-347,-335}}}}; // 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,6,3,2,6,4,3,7,4,3,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,5,3,8,4,3,8,4,3,8,4,3,9,4,3,8,4,3,8,4,3,8,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}}; // set of shipments in each bid 
int SHsts[SPN]={2,4,6,8,10,12,2,6,10,0,6,12,2,4,6,8,10,12,2,6,10,2,8,2,4,6,8,10,12,0,4,8,12,0,6,12,1,3,5,7,9,11,13,0,4,8,12,0,6,12,0,2,4,6,8,10,12,14,1,5,9,13,2,8,14,1,3,5,7,9,11,13,2,6,10,14,1,7,13,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,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,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,1,5,9,13,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,1,5,9,13,0,6,12,2,4,6,8,10,12,14,16,1,5,9,13,2,8,14,2,4,6,8,10,12,14,16,1,5,9,13,0,6,12,0,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,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,0,6,12,0,2,4,6,8,10,12,14,1,5,9,13,2,8,14,0,2,4,6,8,10,12,14,1,5,9,13,2,8,14,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,1,7,13}; // set of start times of each shipment 
int SHets[SPN]={7,9,11,13,15,17,7,11,15,5,11,17,7,9,11,13,15,17,7,11,15,7,13,7,9,11,13,15,17,5,9,13,17,5,11,17,4,6,8,10,12,14,16,3,7,11,15,3,9,15,3,5,7,9,11,13,15,17,4,8,12,16,5,11,17,4,6,8,10,12,14,16,5,9,13,17,4,10,16,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,2,8,14,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,3,7,11,15,2,8,14,2,4,6,8,10,12,14,16,3,7,11,15,4,10,16,2,4,6,8,10,12,14,16,1,5,9,13,17,1,7,13,3,5,7,9,11,13,15,17,2,6,10,14,1,7,13,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,1,7,13,1,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,3,7,11,15,3,9,15,3,5,7,9,11,13,15,17,3,7,11,15,2,8,14,2,4,6,8,10,12,14,16,3,7,11,15,4,10,16,3,5,7,9,11,13,15,17,4,8,12,16,5,11,17,4,6,8,10,12,14,16,4,8,12,16,5,11,17,3,5,7,9,11,13,15,17,4,8,12,16,4,10,16}; // set of end times of each shipment 
