int Dev = 10;// 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]={{{{11022,0,0,0,0,0},{10982,0,0,0,0,0},{11241,0,0,0,0,0},{11004,0,0,0,0,0},{11037,0,0,0,0,0},{11108,0,0,0,0,0},{11023,0,0,0,0,0},{11121,0,0,0,0,0},{10981,0,0,0,0,0},{10900,0,0,0,0,0}},{{11094,0,0,0,0,0},{10964,0,0,0,0,0},{11278,0,0,0,0,0},{11045,0,0,0,0,0},{10847,0,0,0,0,0},{11034,0,0,0,0,0},{10957,0,0,0,0,0},{10882,0,0,0,0,0},{11064,0,0,0,0,0},{11128,0,0,0,0,0}},{{11132,0,0,0,0,0},{11023,0,0,0,0,0},{10955,0,0,0,0,0},{11064,0,0,0,0,0},{10993,0,0,0,0,0},{11086,0,0,0,0,0},{11153,0,0,0,0,0},{11033,0,0,0,0,0},{10912,0,0,0,0,0},{11042,0,0,0,0,0}}},{{{-213,-222,-246,-222,-240,-211},{-204,-217,-244,-222,-226,-211},{-211,-217,-231,-233,-246,-211},{-202,-206,-213,-217,-240,-228},{-208,-228,-242,-228,-215,-213},{-244,-240,-240,-211,-233,-228},{-244,-226,-224,-202,-226,-235},{-220,-211,-233,-231,-204,-244},{-240,-202,-217,-208,-244,-215},{-242,-211,-226,-224,-208,-217}},{{-233,-217,-244,-246,-246,-237},{-220,-237,-228,-242,-220,-231},{-231,-246,-244,-244,-228,-246},{-235,-224,-211,-224,-226,-217},{-213,-235,-213,-240,-246,-208},{-228,-226,-213,-244,-226,-242},{-231,-220,-228,-206,-235,-220},{-202,-237,-204,-206,-215,-204},{-242,-237,-246,-220,-226,-211},{-204,-206,-233,-208,-246,-213}},{{-237,-222,-246,-220,-237,-224},{-240,-211,-222,-215,-206,-242},{-204,-244,-242,-224,-202,-242},{-228,-220,-204,-242,-211,-222},{-235,-222,-211,-233,-233,-235},{-215,-204,-233,-217,-235,-233},{-240,-237,-206,-220,-220,-237},{-215,-244,-215,-208,-211,-220},{-202,-226,-204,-222,-215,-242},{-244,-220,-204,-220,-224,-231}}},{{{-233,-214,-255,-238,-250,-231},{-245,-250,-248,-240,-257,-238},{-231,-248,-250,-228,-257,-221},{-252,-243,-238,-250,-228,-252},{-252,-259,-214,-226,-228,-214},{-257,-243,-248,-262,-231,-231},{-231,-243,-255,-226,-238,-233},{-257,-224,-248,-240,-255,-262},{-231,-228,-217,-217,-214,-243},{-224,-214,-240,-226,-214,-262}},{{-224,-219,-248,-255,-259,-240},{-226,-217,-224,-259,-248,-236},{-262,-240,-259,-259,-226,-226},{-262,-233,-257,-214,-252,-221},{-224,-248,-226,-257,-219,-233},{-231,-217,-262,-248,-214,-243},{-240,-245,-240,-214,-224,-231},{-233,-245,-228,-224,-226,-238},{-224,-226,-240,-257,-217,-228},{-238,-245,-250,-217,-214,-224}},{{-255,-255,-231,-231,-248,-217},{-248,-248,-238,-219,-219,-243},{-236,-233,-238,-217,-219,-217},{-236,-224,-219,-219,-252,-259},{-217,-252,-245,-257,-240,-259},{-262,-214,-243,-236,-250,-238},{-262,-228,-255,-236,-259,-257},{-255,-255,-231,-240,-226,-217},{-252,-257,-240,-224,-217,-238},{-217,-221,-231,-250,-236,-250}}},{{{-284,-251,-257,-292,-298,-292},{-292,-265,-259,-287,-270,-254},{-289,-270,-273,-284,-295,-259},{-265,-262,-287,-284,-257,-276},{-292,-246,-289,-289,-251,-251},{-295,-248,-254,-287,-292,-289},{-278,-300,-278,-265,-284,-278},{-254,-268,-298,-273,-254,-295},{-278,-278,-262,-300,-300,-257},{-289,-265,-257,-248,-289,-259}},{{-270,-265,-287,-273,-246,-273},{-257,-257,-276,-254,-265,-292},{-251,-265,-259,-287,-281,-298},{-251,-248,-254,-295,-254,-295},{-278,-300,-259,-278,-289,-292},{-268,-248,-298,-276,-251,-298},{-265,-278,-265,-278,-259,-278},{-300,-262,-268,-300,-300,-259},{-284,-254,-273,-295,-259,-259},{-262,-300,-292,-287,-284,-289}},{{-246,-278,-259,-276,-254,-295},{-300,-248,-300,-270,-278,-246},{-246,-262,-251,-281,-257,-270},{-281,-278,-248,-273,-262,-276},{-254,-278,-254,-276,-248,-276},{-257,-276,-270,-300,-257,-265},{-281,-265,-281,-289,-287,-281},{-265,-287,-257,-257,-300,-276},{-276,-270,-289,-287,-259,-259},{-278,-281,-257,-295,-298,-278}}},{{{-148,-159,-140,-160,-156,-140},{-166,-162,-152,-139,-149,-140},{-154,-143,-139,-157,-148,-156},{-157,-169,-140,-146,-162,-140},{-142,-165,-143,-149,-166,-140},{-140,-157,-156,-156,-168,-139},{-168,-146,-165,-142,-151,-163},{-160,-168,-149,-159,-154,-151},{-159,-145,-142,-166,-145,-148},{-154,-146,-140,-152,-156,-156}},{{-151,-148,-143,-145,-165,-145},{-169,-148,-163,-163,-154,-145},{-154,-160,-156,-168,-139,-151},{-166,-145,-156,-140,-162,-168},{-140,-146,-165,-148,-152,-143},{-139,-165,-165,-169,-160,-160},{-166,-140,-169,-163,-157,-159},{-157,-148,-151,-139,-145,-145},{-157,-157,-148,-160,-156,-168},{-166,-142,-162,-168,-169,-142}},{{-169,-169,-152,-168,-148,-163},{-145,-157,-145,-160,-154,-159},{-146,-142,-159,-148,-149,-142},{-151,-154,-145,-146,-165,-159},{-166,-142,-157,-165,-143,-152},{-159,-152,-159,-157,-152,-168},{-162,-160,-162,-166,-148,-151},{-156,-140,-151,-163,-140,-140},{-152,-148,-149,-162,-149,-156},{-139,-166,-162,-157,-149,-162}}},{{{-177,-184,-197,-164,-187,-200},{-189,-193,-197,-189,-167,-191},{-198,-197,-184,-193,-180,-167},{-177,-169,-182,-175,-198,-173},{-198,-187,-182,-169,-191,-193},{-193,-175,-180,-189,-198,-198},{-175,-184,-173,-171,-195,-187},{-186,-193,-171,-164,-187,-197},{-178,-184,-195,-193,-178,-200},{-197,-173,-169,-164,-182,-167}},{{-200,-169,-200,-191,-164,-164},{-178,-186,-169,-167,-178,-193},{-193,-186,-195,-193,-198,-195},{-184,-189,-164,-164,-186,-167},{-164,-175,-171,-200,-184,-187},{-164,-193,-169,-177,-186,-186},{-186,-178,-200,-171,-175,-189},{-186,-178,-198,-173,-173,-193},{-195,-195,-167,-189,-187,-195},{-169,-166,-195,-167,-197,-195}},{{-180,-173,-184,-171,-180,-189},{-182,-175,-187,-191,-184,-169},{-180,-193,-167,-167,-182,-169},{-180,-166,-182,-191,-198,-167},{-169,-195,-166,-198,-180,-173},{-173,-198,-187,-178,-184,-198},{-177,-191,-200,-191,-171,-166},{-182,-187,-177,-169,-182,-177},{-195,-167,-173,-169,-197,-187},{-177,-178,-197,-173,-175,-173}}},{{{-255,-255,-262,-233,-223,-267},{-247,-238,-230,-245,-223,-255},{-223,-265,-255,-262,-250,-265},{-235,-223,-262,-270,-250,-250},{-252,-265,-255,-267,-228,-260},{-235,-220,-220,-238,-230,-260},{-243,-238,-257,-255,-228,-262},{-225,-245,-260,-270,-238,-228},{-255,-235,-247,-238,-255,-220},{-255,-265,-243,-220,-265,-223}},{{-233,-270,-265,-260,-238,-233},{-228,-238,-243,-235,-250,-240},{-235,-260,-245,-233,-220,-255},{-243,-267,-270,-220,-240,-235},{-220,-223,-225,-238,-233,-238},{-245,-223,-223,-250,-252,-238},{-255,-228,-255,-220,-243,-252},{-245,-220,-267,-247,-245,-223},{-225,-255,-270,-233,-250,-225},{-265,-250,-255,-243,-240,-233}},{{-228,-257,-233,-240,-243,-260},{-247,-247,-228,-262,-235,-238},{-252,-225,-238,-235,-233,-255},{-223,-257,-247,-247,-245,-238},{-260,-233,-262,-223,-233,-220},{-240,-255,-243,-230,-233,-260},{-233,-260,-228,-235,-223,-243},{-240,-233,-252,-252,-252,-220},{-243,-262,-262,-220,-255,-220},{-247,-228,-233,-220,-240,-267}}},{{{-213,-252,-208,-252,-222,-208},{-208,-236,-226,-219,-252,-215},{-222,-247,-245,-245,-224,-219},{-222,-213,-222,-226,-252,-210},{-240,-252,-222,-210,-210,-236},{-231,-217,-229,-231,-208,-222},{-240,-210,-226,-219,-247,-226},{-243,-231,-215,-233,-233,-210},{-245,-254,-213,-229,-249,-233},{-224,-210,-243,-213,-247,-233}},{{-254,-231,-217,-213,-229,-208},{-229,-236,-231,-233,-208,-222},{-247,-233,-224,-222,-252,-243},{-231,-226,-243,-245,-226,-254},{-249,-208,-231,-219,-229,-226},{-208,-249,-217,-249,-229,-224},{-217,-247,-238,-208,-231,-238},{-213,-249,-224,-208,-217,-215},{-226,-240,-252,-226,-213,-213},{-233,-231,-224,-222,-229,-217}},{{-240,-245,-240,-222,-243,-252},{-231,-233,-224,-231,-247,-226},{-215,-226,-249,-224,-236,-252},{-224,-233,-222,-252,-226,-243},{-243,-238,-238,-224,-236,-247},{-229,-229,-224,-243,-243,-226},{-231,-238,-219,-229,-236,-219},{-254,-236,-249,-240,-252,-249},{-217,-238,-222,-208,-222,-231},{-240,-217,-226,-208,-215,-240}}},{{{-273,-291,-320,-294,-268,-265},{-270,-315,-297,-279,-285,-279},{-285,-320,-315,-320,-309,-300},{-291,-273,-323,-303,-309,-282},{-265,-320,-312,-285,-306,-282},{-294,-285,-288,-300,-315,-303},{-276,-288,-306,-270,-273,-273},{-265,-268,-309,-309,-320,-309},{-312,-291,-282,-265,-265,-309},{-285,-297,-318,-291,-288,-309}},{{-279,-282,-297,-318,-282,-318},{-318,-323,-270,-273,-282,-303},{-291,-265,-276,-320,-323,-294},{-303,-270,-315,-294,-279,-320},{-276,-279,-273,-288,-294,-265},{-318,-285,-291,-279,-315,-273},{-297,-309,-279,-268,-297,-265},{-294,-276,-268,-320,-323,-291},{-297,-276,-318,-288,-303,-282},{-306,-306,-312,-303,-306,-303}},{{-273,-309,-294,-312,-270,-294},{-282,-291,-273,-306,-312,-309},{-323,-320,-306,-323,-320,-294},{-320,-320,-318,-303,-315,-273},{-291,-265,-320,-265,-285,-279},{-306,-309,-276,-318,-279,-273},{-294,-318,-294,-276,-276,-315},{-303,-279,-285,-306,-268,-320},{-265,-285,-309,-303,-285,-282},{-315,-318,-297,-268,-320,-300}}}}; // 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,3,2,6,3,3,7,4,3,7,4,3,7,4,3,7,4,3,8,4,3,7,4,3,8,4,3,8,4,3,8,4,3,9,4,3,8,4,3,9,4,3,9,5,3,8,4,3,9,5,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}}; // set of shipments in each bid 
int SHsts[SPN]={1,3,5,7,9,11,2,6,10,0,6,12,0,2,4,6,8,10,12,1,5,9,2,8,2,4,6,8,10,12,1,5,9,0,6,12,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,2,4,6,8,10,12,14,1,5,9,13,1,7,13,2,4,6,8,10,12,14,2,6,10,14,0,6,12,1,3,5,7,9,11,13,15,1,5,9,13,0,6,12,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,1,7,13,1,3,5,7,9,11,13,15,2,6,10,14,2,8,14,0,2,4,6,8,10,12,14,0,4,8,12,1,7,13,0,2,4,6,8,10,12,14,16,1,5,9,13,1,7,13,2,4,6,8,10,12,14,16,2,6,10,14,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,2,8,14,1,3,5,7,9,11,13,15,1,5,9,13,1,7,13,0,2,4,6,8,10,12,14,16,0,4,8,12,16,1,7,13,0,2,4,6,8,10,12,14,2,6,10,14,1,7,13,1,3,5,7,9,11,13,15,2,6,10,14,1,7,13,0,2,4,6,8,10,12,14,1,5,9,13,0,6,12,1,3,5,7,9,11,13,0,4,8,12,1,7,13,1,3,5,7,9,11,13,0,4,8,12,2,8,14,0,2,4,6,8,10,12,14,1,5,9,13,0,6,12}; // set of start times of each shipment 
int SHets[SPN]={6,8,10,12,14,16,7,11,15,5,11,17,5,7,9,11,13,15,17,6,10,14,7,13,7,9,11,13,15,17,6,10,14,5,11,17,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,5,7,9,11,13,15,17,4,8,12,16,4,10,16,4,6,8,10,12,14,16,4,8,12,16,2,8,14,3,5,7,9,11,13,15,17,3,7,11,15,2,8,14,4,6,8,10,12,14,16,3,7,11,15,4,10,16,3,5,7,9,11,13,15,17,2,6,10,14,3,9,15,3,5,7,9,11,13,15,17,4,8,12,16,4,10,16,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,2,8,14,3,5,7,9,11,13,15,17,3,7,11,15,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,3,9,15,2,4,6,8,10,12,14,16,2,6,10,14,2,8,14,1,3,5,7,9,11,13,15,17,1,5,9,13,17,2,8,14,2,4,6,8,10,12,14,16,4,8,12,16,3,9,15,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,4,6,8,10,12,14,16,3,7,11,15,4,10,16,4,6,8,10,12,14,16,3,7,11,15,5,11,17,3,5,7,9,11,13,15,17,4,8,12,16,3,9,15}; // set of end times of each shipment 
