int Dev = 10;// 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 = 355;//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]={{{{11144,0,0,0,0,0},{10977,0,0,0,0,0},{11077,0,0,0,0,0},{11165,0,0,0,0,0},{11079,0,0,0,0,0},{11021,0,0,0,0,0},{11098,0,0,0,0,0},{11064,0,0,0,0,0},{11135,0,0,0,0,0},{11030,0,0,0,0,0}},{{10998,0,0,0,0,0},{11052,0,0,0,0,0},{10944,0,0,0,0,0},{11036,0,0,0,0,0},{10958,0,0,0,0,0},{10976,0,0,0,0,0},{11096,0,0,0,0,0},{10980,0,0,0,0,0},{11001,0,0,0,0,0},{11112,0,0,0,0,0}},{{10937,0,0,0,0,0},{11134,0,0,0,0,0},{11024,0,0,0,0,0},{11173,0,0,0,0,0},{10992,0,0,0,0,0},{11104,0,0,0,0,0},{10911,0,0,0,0,0},{11102,0,0,0,0,0},{11006,0,0,0,0,0},{10855,0,0,0,0,0}}},{{{-242,-217,-211,-242,-208,-233},{-204,-202,-246,-202,-246,-220},{-235,-242,-222,-215,-204,-224},{-237,-240,-215,-237,-242,-224},{-242,-231,-233,-211,-242,-208},{-213,-242,-228,-208,-231,-226},{-235,-246,-222,-240,-208,-233},{-242,-213,-244,-231,-204,-235},{-226,-208,-228,-226,-204,-204},{-222,-217,-224,-240,-246,-228}},{{-211,-217,-233,-246,-215,-220},{-242,-215,-228,-226,-246,-213},{-244,-246,-202,-228,-211,-235},{-228,-206,-237,-208,-217,-220},{-213,-246,-244,-231,-224,-220},{-222,-217,-220,-204,-231,-235},{-206,-231,-240,-246,-237,-222},{-222,-211,-220,-220,-246,-215},{-208,-215,-215,-226,-204,-246},{-244,-217,-217,-211,-208,-240}},{{-213,-226,-224,-222,-202,-226},{-228,-242,-231,-217,-224,-224},{-242,-213,-206,-208,-224,-244},{-235,-240,-235,-213,-242,-242},{-237,-244,-204,-206,-222,-206},{-244,-220,-215,-211,-202,-217},{-228,-220,-224,-228,-220,-220},{-226,-231,-220,-246,-204,-242},{-233,-224,-211,-242,-204,-211},{-211,-231,-204,-202,-204,-206}}},{{{-233,-217,-214,-252,-228,-219},{-259,-226,-236,-224,-233,-255},{-248,-240,-228,-231,-252,-224},{-243,-252,-240,-236,-231,-245},{-238,-252,-214,-248,-231,-245},{-231,-226,-226,-214,-219,-248},{-243,-250,-252,-236,-236,-231},{-228,-248,-250,-224,-245,-262},{-252,-231,-238,-228,-233,-240},{-224,-262,-255,-243,-228,-255}},{{-245,-238,-255,-226,-224,-214},{-240,-245,-233,-248,-240,-224},{-262,-219,-262,-214,-217,-248},{-238,-243,-259,-259,-252,-257},{-248,-238,-248,-217,-214,-221},{-250,-236,-236,-236,-245,-226},{-217,-219,-231,-219,-221,-228},{-240,-252,-238,-238,-231,-217},{-262,-238,-248,-228,-259,-236},{-221,-245,-224,-259,-238,-252}},{{-250,-243,-214,-262,-240,-240},{-259,-217,-255,-243,-255,-250},{-255,-224,-245,-248,-228,-255},{-257,-240,-257,-252,-243,-226},{-231,-250,-248,-217,-250,-217},{-226,-245,-226,-236,-233,-217},{-240,-238,-228,-217,-214,-217},{-226,-228,-255,-219,-228,-224},{-243,-238,-214,-233,-250,-233},{-233,-219,-231,-228,-233,-238}}},{{{-300,-246,-273,-259,-270,-268},{-246,-273,-251,-298,-278,-298},{-265,-251,-284,-287,-292,-295},{-262,-254,-300,-292,-257,-251},{-278,-300,-262,-295,-284,-287},{-262,-251,-284,-284,-265,-254},{-262,-284,-289,-265,-248,-284},{-262,-284,-298,-298,-251,-278},{-287,-284,-254,-270,-251,-262},{-273,-265,-257,-270,-295,-254}},{{-278,-289,-265,-262,-246,-246},{-248,-262,-295,-268,-265,-287},{-251,-298,-281,-246,-289,-289},{-300,-270,-273,-289,-259,-273},{-270,-287,-259,-284,-257,-251},{-289,-270,-268,-281,-265,-254},{-270,-262,-257,-300,-298,-262},{-273,-251,-300,-287,-273,-265},{-281,-281,-262,-281,-248,-248},{-251,-284,-295,-278,-292,-292}},{{-259,-268,-270,-300,-287,-278},{-292,-273,-254,-284,-278,-251},{-278,-300,-298,-248,-251,-251},{-287,-287,-295,-284,-265,-246},{-292,-262,-270,-281,-295,-295},{-276,-262,-259,-246,-295,-298},{-276,-287,-278,-251,-268,-289},{-289,-289,-298,-246,-265,-262},{-265,-295,-281,-246,-295,-292},{-246,-254,-273,-292,-259,-251}}},{{{-148,-157,-166,-152,-140,-160},{-165,-159,-157,-142,-149,-143},{-146,-148,-143,-154,-152,-159},{-156,-146,-168,-142,-166,-156},{-169,-169,-148,-142,-145,-142},{-143,-166,-165,-163,-142,-159},{-146,-151,-148,-142,-139,-157},{-163,-146,-149,-140,-145,-168},{-160,-139,-139,-159,-169,-165},{-163,-148,-159,-140,-140,-151}},{{-165,-163,-142,-166,-143,-165},{-159,-157,-139,-159,-165,-157},{-139,-143,-140,-148,-160,-163},{-151,-146,-152,-151,-143,-163},{-152,-154,-143,-143,-152,-148},{-157,-165,-157,-143,-148,-165},{-169,-151,-142,-140,-156,-143},{-157,-151,-166,-148,-149,-140},{-145,-169,-169,-156,-166,-148},{-142,-168,-163,-151,-165,-160}},{{-169,-140,-146,-143,-154,-151},{-163,-166,-146,-157,-151,-152},{-165,-169,-152,-163,-143,-152},{-149,-159,-168,-160,-162,-146},{-148,-160,-168,-168,-143,-165},{-143,-165,-148,-168,-142,-162},{-162,-148,-152,-146,-169,-160},{-149,-145,-143,-169,-139,-169},{-165,-169,-163,-146,-143,-157},{-160,-139,-165,-145,-163,-148}}},{{{-187,-187,-197,-200,-195,-200},{-197,-195,-171,-198,-169,-169},{-178,-169,-169,-175,-180,-191},{-169,-198,-197,-200,-197,-200},{-182,-175,-187,-198,-193,-195},{-193,-184,-187,-182,-186,-169},{-169,-186,-191,-193,-177,-193},{-175,-195,-175,-184,-197,-180},{-198,-195,-178,-169,-200,-193},{-169,-167,-169,-200,-180,-186}},{{-191,-184,-180,-191,-186,-175},{-175,-193,-200,-182,-171,-177},{-200,-166,-171,-169,-166,-164},{-169,-180,-166,-173,-180,-200},{-167,-195,-197,-169,-189,-164},{-186,-189,-173,-178,-167,-184},{-169,-191,-169,-175,-175,-195},{-197,-175,-197,-164,-182,-171},{-166,-175,-166,-186,-186,-178},{-164,-187,-166,-169,-167,-169}},{{-169,-180,-167,-195,-184,-180},{-166,-195,-167,-186,-198,-182},{-200,-186,-175,-200,-166,-180},{-177,-169,-167,-177,-177,-197},{-173,-200,-167,-164,-166,-193},{-169,-197,-182,-200,-195,-191},{-169,-169,-186,-173,-191,-200},{-187,-195,-166,-200,-184,-184},{-195,-164,-177,-178,-173,-178},{-177,-171,-166,-177,-175,-166}}},{{{-255,-255,-267,-262,-260,-267},{-243,-243,-225,-255,-260,-228},{-235,-255,-228,-247,-238,-257},{-235,-265,-235,-245,-225,-265},{-230,-235,-225,-265,-238,-243},{-252,-252,-245,-220,-233,-230},{-250,-265,-240,-225,-228,-247},{-270,-247,-233,-223,-228,-257},{-240,-252,-255,-230,-252,-247},{-243,-267,-228,-252,-235,-245}},{{-262,-262,-228,-225,-250,-220},{-228,-243,-220,-228,-270,-225},{-245,-243,-225,-235,-255,-225},{-233,-238,-252,-252,-252,-225},{-238,-225,-252,-252,-255,-243},{-235,-233,-233,-223,-228,-220},{-257,-255,-233,-262,-245,-257},{-240,-240,-252,-247,-233,-270},{-240,-265,-247,-223,-223,-260},{-262,-230,-247,-235,-223,-243}},{{-262,-238,-228,-270,-233,-233},{-250,-260,-225,-267,-225,-230},{-235,-230,-223,-230,-225,-238},{-265,-250,-260,-233,-228,-230},{-233,-262,-265,-223,-245,-252},{-262,-257,-262,-257,-260,-265},{-267,-247,-262,-250,-230,-223},{-267,-252,-230,-267,-257,-223},{-262,-270,-223,-270,-250,-228},{-267,-250,-228,-240,-265,-267}}},{{{-247,-229,-210,-231,-219,-245},{-219,-252,-222,-226,-210,-240},{-231,-240,-233,-236,-238,-245},{-233,-249,-238,-217,-252,-215},{-219,-226,-245,-252,-210,-222},{-252,-252,-222,-254,-245,-208},{-240,-243,-226,-210,-231,-240},{-229,-233,-249,-217,-233,-215},{-215,-233,-243,-238,-236,-245},{-252,-213,-231,-252,-252,-245}},{{-247,-238,-238,-245,-243,-229},{-245,-240,-213,-243,-252,-254},{-213,-210,-226,-252,-219,-245},{-240,-229,-213,-222,-210,-229},{-240,-222,-222,-245,-240,-217},{-247,-229,-236,-224,-213,-213},{-252,-222,-254,-213,-254,-224},{-249,-213,-224,-219,-229,-219},{-215,-231,-226,-224,-245,-219},{-252,-215,-236,-236,-224,-252}},{{-210,-217,-240,-231,-229,-224},{-208,-222,-208,-233,-238,-254},{-219,-226,-238,-217,-254,-210},{-252,-245,-229,-243,-231,-210},{-236,-224,-245,-213,-231,-249},{-254,-254,-219,-224,-236,-249},{-238,-240,-226,-208,-252,-247},{-226,-231,-249,-213,-252,-249},{-215,-222,-222,-236,-254,-240},{-243,-224,-208,-224,-252,-247}}},{{{-279,-315,-288,-282,-318,-294},{-273,-276,-309,-297,-279,-309},{-320,-279,-315,-297,-315,-265},{-265,-294,-323,-265,-282,-309},{-279,-270,-318,-282,-268,-306},{-323,-312,-297,-282,-285,-306},{-309,-297,-303,-300,-291,-297},{-270,-279,-279,-309,-270,-309},{-318,-318,-318,-294,-288,-323},{-265,-282,-268,-297,-285,-288}},{{-273,-323,-285,-276,-297,-276},{-315,-294,-273,-270,-268,-312},{-276,-279,-320,-320,-279,-306},{-303,-306,-282,-300,-276,-312},{-300,-309,-297,-309,-279,-268},{-294,-315,-306,-312,-309,-309},{-297,-312,-309,-312,-300,-297},{-312,-309,-273,-276,-276,-303},{-270,-303,-320,-273,-312,-309},{-282,-318,-297,-315,-318,-288}},{{-297,-297,-265,-282,-294,-285},{-300,-320,-282,-282,-315,-309},{-282,-303,-276,-323,-306,-320},{-268,-294,-270,-320,-279,-312},{-273,-306,-265,-270,-285,-273},{-268,-323,-306,-285,-268,-265},{-265,-294,-270,-265,-265,-294},{-303,-294,-273,-288,-300,-300},{-273,-312,-268,-273,-300,-270},{-303,-318,-285,-276,-312,-279}}}}; // 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,6,3,3,6,3,2,7,4,3,8,4,3,8,4,3,8,4,3,8,4,3,8,4,3,8,4,3,8,4,3,7,4,3,9,4,3,8,5,3,9,4,3,9,5,3,9,5,3,9,5,3,8,4,3,7,4,3,8,4,3,8,4,3,8,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,353,354}}; // set of shipments in each bid 
int SHsts[SPN]={1,3,5,7,9,11,2,6,10,2,8,1,3,5,7,9,11,1,5,9,0,6,12,1,3,5,7,9,11,1,5,9,2,8,1,3,5,7,9,11,13,2,6,10,14,1,7,13,0,2,4,6,8,10,12,14,2,6,10,14,1,7,13,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,1,7,13,1,3,5,7,9,11,13,15,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,1,5,9,13,0,6,12,0,2,4,6,8,10,12,14,2,6,10,14,2,8,14,2,4,6,8,10,12,14,2,6,10,14,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,0,4,8,12,16,0,6,12,0,2,4,6,8,10,12,14,16,2,6,10,14,0,6,12,0,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,0,4,8,12,16,1,7,13,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,2,6,10,14,1,7,13,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,1,7,13,0,2,4,6,8,10,12,14,1,5,9,13,1,7,13,0,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,2,8,14}; // set of start times of each shipment 
int SHets[SPN]={6,8,10,12,14,16,7,11,15,7,13,6,8,10,12,14,16,6,10,14,5,11,17,6,8,10,12,14,16,6,10,14,7,13,4,6,8,10,12,14,16,5,9,13,17,4,10,16,3,5,7,9,11,13,15,17,5,9,13,17,4,10,16,3,5,7,9,11,13,15,17,5,9,13,17,5,11,17,3,5,7,9,11,13,15,17,3,7,11,15,3,9,15,3,5,7,9,11,13,15,17,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,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,4,8,12,16,2,8,14,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,1,3,5,7,9,11,13,15,17,3,7,11,15,1,7,13,1,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,1,5,9,13,17,2,8,14,1,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,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,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,5,9,13,17,3,9,15,3,5,7,9,11,13,15,17,5,9,13,17,5,11,17}; // set of end times of each shipment 
