int Dev = 40;// Deviation
extern const int CNN = 1;// 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 = 343;//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]={{{{11912,0,0,0,0,0},{10895,0,0,0,0,0},{11782,0,0,0,0,0},{11642,0,0,0,0,0},{11537,0,0,0,0,0},{12008,0,0,0,0,0},{11916,0,0,0,0,0},{11953,0,0,0,0,0},{11667,0,0,0,0,0},{11622,0,0,0,0,0}},{{11499,0,0,0,0,0},{11120,0,0,0,0,0},{11425,0,0,0,0,0},{12512,0,0,0,0,0},{11237,0,0,0,0,0},{11544,0,0,0,0,0},{11179,0,0,0,0,0},{11309,0,0,0,0,0},{11220,0,0,0,0,0},{11499,0,0,0,0,0}},{{11825,0,0,0,0,0},{11719,0,0,0,0,0},{12470,0,0,0,0,0},{11419,0,0,0,0,0},{11434,0,0,0,0,0},{10679,0,0,0,0,0},{11710,0,0,0,0,0},{11354,0,0,0,0,0},{11739,0,0,0,0,0},{11642,0,0,0,0,0}}},{{{-160,-205,-229,-203,-171,-166},{-252,-205,-227,-166,-254,-240},{-274,-217,-152,-213,-128,-215},{-136,-179,-223,-262,-264,-175},{-213,-179,-158,-282,-173,-268},{-140,-130,-258,-231,-191,-256},{-221,-278,-177,-199,-177,-270},{-144,-272,-201,-162,-160,-175},{-264,-199,-282,-270,-244,-175},{-215,-185,-160,-248,-148,-258}},{{-185,-231,-274,-122,-146,-181},{-213,-134,-160,-250,-162,-136},{-242,-201,-189,-260,-278,-199},{-238,-231,-203,-144,-248,-215},{-217,-270,-177,-242,-274,-173},{-189,-272,-187,-122,-138,-221},{-146,-215,-254,-140,-238,-154},{-235,-122,-219,-209,-138,-274},{-246,-142,-250,-173,-158,-278},{-246,-126,-175,-144,-152,-134}},{{-185,-134,-211,-122,-282,-168},{-225,-231,-215,-252,-156,-193},{-280,-168,-138,-193,-252,-189},{-164,-252,-221,-191,-240,-280},{-280,-136,-152,-168,-138,-199},{-185,-154,-156,-205,-138,-268},{-142,-146,-126,-134,-185,-270},{-207,-223,-197,-148,-197,-136},{-227,-284,-122,-160,-136,-264},{-268,-148,-152,-244,-154,-152}}},{{{-204,-192,-214,-179,-198,-184},{-217,-206,-177,-121,-203,-164},{-164,-130,-105,-134,-153,-193},{-190,-213,-109,-188,-166,-97},{-130,-129,-201,-153,-195,-166},{-216,-111,-130,-108,-161,-185},{-206,-217,-158,-159,-217,-188},{-98,-153,-111,-211,-172,-221},{-169,-193,-147,-166,-151,-221},{-172,-190,-124,-193,-119,-108}},{{-203,-203,-203,-126,-214,-118},{-101,-221,-184,-180,-187,-118},{-163,-180,-101,-97,-203,-98},{-159,-113,-179,-225,-142,-208},{-184,-137,-138,-208,-185,-175},{-174,-182,-138,-172,-203,-204},{-193,-185,-206,-171,-190,-126},{-130,-98,-203,-103,-195,-185},{-148,-101,-187,-121,-129,-130},{-198,-221,-195,-127,-148,-174}},{{-209,-184,-145,-172,-118,-132},{-193,-98,-184,-198,-158,-119},{-137,-122,-217,-192,-203,-166},{-147,-195,-151,-135,-129,-222},{-158,-177,-142,-172,-140,-213},{-106,-175,-190,-101,-167,-195},{-163,-163,-184,-150,-142,-171},{-177,-213,-135,-203,-167,-177},{-140,-98,-158,-211,-150,-161},{-122,-171,-198,-216,-116,-203}}},{{{-240,-187,-291,-231,-303,-282},{-155,-273,-141,-245,-176,-206},{-243,-159,-321,-182,-316,-159},{-169,-323,-312,-321,-199,-217},{-178,-208,-261,-312,-222,-215},{-273,-152,-303,-249,-293,-159},{-173,-155,-316,-293,-305,-252},{-289,-305,-291,-213,-219,-268},{-263,-286,-263,-243,-226,-316},{-169,-224,-155,-201,-282,-236}},{{-249,-256,-270,-231,-224,-291},{-157,-176,-192,-150,-196,-300},{-280,-312,-219,-291,-213,-266},{-298,-261,-312,-148,-152,-233},{-238,-261,-152,-268,-201,-201},{-196,-291,-164,-286,-316,-180},{-206,-162,-206,-176,-146,-164},{-293,-291,-238,-222,-208,-252},{-203,-305,-293,-166,-210,-247},{-187,-229,-321,-277,-178,-226}},{{-146,-263,-303,-284,-243,-284},{-194,-187,-321,-148,-291,-215},{-282,-266,-224,-305,-222,-266},{-164,-213,-187,-159,-226,-305},{-173,-217,-243,-303,-152,-273},{-148,-210,-226,-143,-213,-229},{-164,-203,-187,-243,-182,-312},{-217,-148,-256,-222,-159,-321},{-296,-152,-171,-243,-319,-196},{-305,-240,-226,-203,-245,-319}}},{{{-178,-141,-215,-247,-267,-210},{-304,-269,-302,-135,-163,-195},{-174,-187,-269,-284,-132,-256},{-258,-215,-289,-221,-232,-265},{-210,-132,-169,-171,-182,-256},{-178,-267,-278,-180,-224,-247},{-271,-302,-267,-260,-228,-208},{-156,-265,-297,-193,-224,-191},{-178,-182,-239,-276,-230,-245},{-202,-271,-156,-265,-260,-141}},{{-139,-191,-226,-213,-156,-189},{-286,-148,-197,-269,-154,-297},{-148,-200,-152,-256,-232,-208},{-232,-304,-278,-243,-247,-258},{-213,-269,-150,-217,-167,-282},{-130,-304,-163,-187,-304,-215},{-217,-187,-156,-295,-256,-130},{-289,-210,-228,-295,-206,-291},{-263,-180,-304,-291,-295,-213},{-234,-226,-182,-150,-295,-187}},{{-263,-250,-293,-180,-250,-178},{-152,-141,-187,-271,-245,-208},{-171,-291,-152,-258,-258,-282},{-256,-184,-193,-267,-156,-197},{-271,-297,-230,-189,-189,-293},{-165,-263,-226,-256,-250,-245},{-278,-273,-273,-273,-299,-267},{-252,-132,-174,-289,-141,-191},{-161,-210,-282,-169,-156,-247},{-291,-161,-265,-260,-269,-200}}},{{{-239,-319,-271,-364,-370,-226},{-303,-213,-370,-194,-168,-287},{-160,-226,-309,-356,-250,-346},{-215,-346,-319,-165,-165,-234},{-200,-303,-298,-314,-354,-314},{-258,-226,-263,-354,-325,-362},{-322,-162,-239,-218,-261,-354},{-298,-332,-194,-277,-325,-325},{-293,-239,-245,-287,-218,-351},{-226,-367,-186,-298,-215,-277}},{{-343,-311,-282,-160,-325,-176},{-200,-162,-266,-178,-287,-330},{-178,-192,-245,-274,-200,-192},{-356,-309,-194,-285,-285,-250},{-205,-186,-306,-293,-189,-261},{-332,-207,-319,-348,-348,-221},{-173,-351,-303,-356,-200,-192},{-237,-314,-359,-181,-261,-192},{-314,-271,-176,-255,-226,-279},{-356,-290,-258,-269,-168,-327}},{{-269,-250,-287,-287,-370,-367},{-285,-340,-325,-266,-277,-301},{-311,-250,-319,-226,-221,-176},{-290,-160,-258,-258,-231,-186},{-298,-290,-245,-226,-266,-309},{-189,-317,-309,-189,-186,-261},{-311,-269,-223,-364,-234,-330},{-367,-221,-181,-184,-213,-165},{-277,-362,-309,-287,-332,-327},{-306,-370,-184,-207,-234,-343}}},{{{-364,-235,-384,-375,-190,-258},{-185,-356,-288,-171,-196,-188},{-339,-333,-367,-328,-213,-314},{-230,-353,-297,-193,-185,-283},{-356,-272,-238,-291,-328,-199},{-207,-333,-277,-300,-263,-300},{-263,-277,-188,-311,-255,-176},{-347,-378,-252,-370,-370,-300},{-246,-199,-328,-185,-384,-174},{-316,-221,-316,-302,-241,-372}},{{-260,-168,-347,-241,-176,-342},{-333,-344,-302,-190,-196,-342},{-252,-249,-297,-283,-210,-283},{-372,-216,-230,-244,-353,-372},{-277,-238,-300,-218,-202,-193},{-288,-342,-210,-218,-190,-213},{-207,-353,-291,-302,-260,-277},{-235,-384,-230,-235,-255,-190},{-213,-308,-232,-199,-238,-269},{-224,-227,-322,-384,-244,-339}},{{-280,-176,-367,-263,-300,-235},{-218,-218,-386,-372,-252,-235},{-336,-347,-372,-252,-221,-378},{-305,-302,-210,-288,-375,-328},{-386,-202,-339,-375,-168,-274},{-325,-381,-207,-221,-188,-291},{-381,-330,-244,-266,-389,-297},{-381,-364,-246,-216,-305,-193},{-344,-311,-235,-286,-249,-344},{-260,-241,-367,-286,-241,-353}}},{{{-266,-333,-218,-322,-314,-350},{-196,-224,-319,-356,-202,-174},{-227,-255,-232,-322,-372,-269},{-347,-342,-176,-204,-370,-199},{-378,-302,-330,-342,-221,-305},{-314,-210,-325,-291,-364,-364},{-381,-333,-260,-213,-246,-235},{-221,-372,-316,-210,-204,-342},{-260,-252,-196,-221,-227,-305},{-344,-389,-308,-344,-227,-193}},{{-367,-182,-274,-358,-283,-182},{-199,-375,-204,-322,-350,-370},{-263,-389,-232,-218,-280,-364},{-342,-381,-392,-280,-227,-232},{-252,-193,-297,-246,-252,-277},{-207,-314,-258,-288,-230,-300},{-277,-389,-274,-381,-238,-246},{-286,-302,-280,-342,-168,-179},{-174,-300,-199,-199,-339,-249},{-230,-258,-272,-188,-325,-176}},{{-300,-358,-277,-274,-274,-347},{-328,-277,-207,-381,-238,-372},{-316,-364,-353,-291,-314,-361},{-252,-294,-202,-375,-297,-322},{-196,-322,-179,-168,-232,-344},{-241,-235,-190,-381,-213,-367},{-224,-213,-361,-280,-370,-288},{-230,-364,-370,-258,-333,-322},{-305,-202,-308,-235,-182,-339},{-277,-168,-266,-238,-325,-305}}},{{{-328,-241,-176,-255,-227,-190},{-176,-308,-308,-168,-224,-325},{-188,-372,-308,-182,-370,-384},{-311,-244,-370,-300,-232,-339},{-196,-174,-238,-216,-297,-308},{-344,-333,-224,-375,-218,-258},{-384,-168,-260,-238,-286,-389},{-294,-168,-294,-207,-311,-255},{-252,-260,-384,-288,-199,-246},{-238,-350,-308,-367,-171,-364}},{{-311,-378,-221,-350,-358,-263},{-274,-356,-210,-252,-322,-188},{-294,-232,-300,-302,-378,-330},{-370,-333,-283,-372,-244,-319},{-333,-367,-207,-238,-386,-322},{-269,-325,-196,-381,-302,-300},{-322,-232,-249,-227,-260,-300},{-244,-190,-372,-176,-297,-266},{-258,-347,-277,-336,-193,-336},{-316,-232,-314,-378,-370,-300}},{{-232,-288,-174,-232,-297,-322},{-207,-274,-288,-297,-246,-347},{-358,-286,-255,-291,-246,-392},{-358,-333,-216,-176,-356,-213},{-244,-333,-277,-389,-274,-193},{-235,-204,-213,-218,-202,-302},{-286,-305,-204,-255,-182,-174},{-386,-224,-322,-297,-314,-216},{-283,-311,-330,-213,-316,-339},{-218,-235,-286,-286,-300,-218}}}}; // supply (positive for supply and negative for demand) under different scenarios 
int iniv[I]={2070,261,23,150,170,304,400,300,160}; // initial inventory 
int ubiv[I]={2740,522,414,300,341,608,800,600,320}; // the upper bounds of inventory 
int len[I1][I2]={{3,6,2,2,3,3,2,1}}; // 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,7.19,13.32,4.32,2.64,5.16,6.85,4.63,1.82}; // 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]={{6.54,12.11,3.93,2.4,4.69,6.23,4.21,1.65}}; // 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]={5.23,5.23,5.23,4.58,4.58,4.58,3.92,3.92,3.92,9.69,9.69,9.69,8.48,8.48,8.48,7.27,7.27,7.27,3.14,3.14,3.14,2.75,2.75,2.75,2.36,2.36,2.36,1.92,1.92,1.92,1.68,1.68,1.68,1.44,1.44,1.44,3.75,3.75,3.75,3.28,3.28,3.28,2.81,2.81,2.81,4.98,4.98,4.98,4.36,4.36,4.36,3.74,3.74,3.74,3.37,3.37,3.37,2.95,2.95,2.95,2.53,2.53,2.53,1.32,1.32,1.32,1.16,1.16,1.16,0.99,0.99,0.99}; // 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]={8,4,3,8,4,3,8,4,3,6,3,2,6,3,2,6,3,2,7,4,3,8,4,3,8,4,3,7,4,3,8,4,3,7,4,3,7,4,3,7,4,3,8,4,3,7,4,3,7,4,3,7,4,3,7,4,3,8,4,3,8,4,3,9,5,3,8,5,3,9,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}}; // set of shipments in each bid 
int SHsts[SPN]={0,2,4,6,8,10,12,14,1,5,9,13,2,8,14,0,2,4,6,8,10,12,14,2,6,10,14,2,8,14,0,2,4,6,8,10,12,14,0,4,8,12,2,8,14,1,3,5,7,9,11,1,5,9,1,7,1,3,5,7,9,11,1,5,9,2,8,1,3,5,7,9,11,0,4,8,2,8,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,0,4,8,12,1,7,13,2,4,6,8,10,12,14,0,4,8,12,0,6,12,0,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,2,8,14,1,3,5,7,9,11,13,2,6,10,14,2,8,14,2,4,6,8,10,12,14,0,4,8,12,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,2,6,10,14,1,7,13,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,2,4,6,8,10,12,14,2,6,10,14,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,15,0,4,8,12,1,7,13,0,2,4,6,8,10,12,14,16,0,4,8,12,16,2,8,14,2,4,6,8,10,12,14,16,0,4,8,12,16,2,8,14,0,2,4,6,8,10,12,14,16,1,5,9,13,1,7,13}; // set of start times of each shipment 
int SHets[SPN]={3,5,7,9,11,13,15,17,4,8,12,16,5,11,17,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,5,11,17,7,9,11,13,15,17,7,11,15,7,13,7,9,11,13,15,17,7,11,15,8,14,7,9,11,13,15,17,6,10,14,8,14,4,6,8,10,12,14,16,2,6,10,14,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,2,6,10,14,3,9,15,4,6,8,10,12,14,16,2,6,10,14,2,8,14,2,4,6,8,10,12,14,16,3,7,11,15,3,9,15,4,6,8,10,12,14,16,4,8,12,16,4,10,16,4,6,8,10,12,14,16,5,9,13,17,5,11,17,5,7,9,11,13,15,17,3,7,11,15,5,11,17,3,5,7,9,11,13,15,17,5,9,13,17,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,3,9,15,5,7,9,11,13,15,17,3,7,11,15,4,10,16,4,6,8,10,12,14,16,4,8,12,16,4,10,16,2,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,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,1,5,9,13,17,3,9,15,1,3,5,7,9,11,13,15,17,2,6,10,14,2,8,14}; // set of end times of each shipment 
