int Dev = 40;// Deviation
extern const int CNN = 3;// 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 = 351;//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]={{{{11678,0,0,0,0,0},{12943,0,0,0,0,0},{12038,0,0,0,0,0},{12331,0,0,0,0,0},{12802,0,0,0,0,0},{12137,0,0,0,0,0},{12301,0,0,0,0,0},{12167,0,0,0,0,0},{11062,0,0,0,0,0},{12440,0,0,0,0,0}},{{12722,0,0,0,0,0},{12278,0,0,0,0,0},{12649,0,0,0,0,0},{12820,0,0,0,0,0},{12453,0,0,0,0,0},{12770,0,0,0,0,0},{11968,0,0,0,0,0},{13321,0,0,0,0,0},{11930,0,0,0,0,0},{11582,0,0,0,0,0}},{{12017,0,0,0,0,0},{10921,0,0,0,0,0},{11686,0,0,0,0,0},{11600,0,0,0,0,0},{11350,0,0,0,0,0},{11309,0,0,0,0,0},{11513,0,0,0,0,0},{10825,0,0,0,0,0},{11822,0,0,0,0,0},{11133,0,0,0,0,0}}},{{{-265,-235,-188,-300,-203,-253},{-297,-350,-376,-347,-318,-406},{-191,-368,-209,-412,-238,-194},{-391,-268,-312,-353,-353,-329},{-323,-323,-370,-326,-409,-397},{-220,-315,-318,-353,-226,-185},{-353,-332,-212,-329,-232,-256},{-379,-259,-373,-276,-250,-215},{-279,-212,-197,-265,-397,-194},{-335,-309,-303,-265,-232,-329}},{{-362,-306,-342,-310,-312,-272},{-188,-320,-291,-299,-280,-192},{-183,-320,-230,-304,-371,-207},{-386,-212,-171,-310,-198,-363},{-351,-309,-204,-288,-163,-313},{-180,-386,-232,-173,-307,-344},{-360,-206,-283,-310,-318,-269},{-290,-398,-367,-348,-219,-282},{-186,-229,-302,-384,-326,-326},{-383,-303,-193,-348,-302,-215}},{{-318,-148,-266,-242,-199,-210},{-265,-198,-226,-215,-193,-202},{-250,-172,-212,-179,-156,-220},{-285,-310,-226,-307,-263,-216},{-167,-302,-312,-197,-173,-202},{-250,-269,-221,-284,-197,-161},{-170,-206,-261,-175,-193,-220},{-152,-319,-315,-148,-150,-190},{-278,-307,-254,-284,-231,-220},{-338,-184,-182,-211,-246,-185}}},{{{-234,-216,-161,-222,-167,-233},{-208,-188,-182,-120,-156,-256},{-126,-183,-178,-229,-230,-248},{-146,-150,-206,-240,-147,-244},{-158,-161,-145,-109,-147,-199},{-123,-235,-194,-113,-182,-159},{-101,-159,-229,-158,-228,-185},{-183,-183,-158,-168,-197,-168},{-151,-145,-222,-163,-112,-160},{-225,-154,-219,-186,-173,-244}},{{-275,-201,-215,-259,-224,-274},{-160,-238,-217,-234,-305,-293},{-277,-123,-249,-228,-314,-243},{-127,-154,-241,-232,-176,-305},{-143,-125,-247,-201,-270,-252},{-210,-154,-298,-223,-256,-200},{-131,-162,-253,-186,-293,-188},{-259,-139,-209,-298,-208,-276},{-154,-256,-209,-161,-137,-240},{-135,-213,-192,-241,-192,-181}},{{-277,-349,-262,-189,-260,-374},{-316,-163,-162,-284,-183,-342},{-343,-306,-301,-332,-188,-283},{-341,-347,-236,-292,-271,-178},{-289,-191,-351,-216,-335,-317},{-193,-191,-283,-329,-332,-371},{-240,-357,-343,-292,-319,-300},{-183,-153,-246,-176,-377,-226},{-245,-273,-191,-327,-188,-221},{-173,-347,-196,-178,-197,-311}}},{{{-266,-451,-372,-224,-207,-454},{-447,-250,-438,-240,-230,-405},{-447,-388,-290,-352,-415,-260},{-375,-296,-398,-234,-306,-211},{-454,-408,-322,-385,-405,-266},{-392,-204,-217,-243,-273,-286},{-266,-211,-247,-392,-211,-418},{-207,-283,-250,-385,-411,-286},{-326,-309,-424,-217,-392,-375},{-243,-329,-392,-319,-234,-276}},{{-367,-299,-233,-327,-225,-346},{-443,-209,-191,-364,-197,-241},{-377,-325,-223,-339,-265,-352},{-456,-222,-424,-298,-299,-244},{-420,-441,-364,-399,-311,-322},{-443,-383,-405,-248,-213,-379},{-423,-287,-392,-214,-271,-316},{-397,-277,-443,-339,-407,-334},{-298,-229,-396,-289,-237,-226},{-243,-322,-373,-327,-246,-322}},{{-218,-288,-389,-316,-315,-167},{-260,-190,-314,-275,-321,-301},{-230,-291,-224,-375,-281,-350},{-333,-377,-188,-291,-188,-350},{-330,-176,-339,-245,-193,-332},{-345,-282,-305,-272,-278,-265},{-330,-204,-336,-207,-249,-326},{-224,-297,-179,-337,-236,-175},{-381,-351,-372,-190,-313,-267},{-384,-216,-367,-335,-191,-177}}},{{{-80,-146,-100,-74,-111,-166},{-116,-98,-109,-122,-105,-113},{-133,-108,-84,-129,-151,-91},{-127,-83,-76,-116,-146,-133},{-107,-145,-87,-128,-154,-116},{-91,-69,-80,-97,-167,-115},{-124,-110,-137,-78,-90,-134},{-108,-123,-81,-129,-93,-148},{-136,-73,-124,-78,-82,-120},{-88,-65,-155,-151,-74,-133}},{{-157,-85,-198,-153,-121,-139},{-123,-93,-200,-152,-184,-203},{-127,-124,-184,-141,-143,-188},{-182,-149,-98,-136,-127,-208},{-154,-178,-175,-129,-132,-225},{-89,-197,-93,-121,-201,-212},{-174,-92,-142,-155,-159,-136},{-182,-111,-121,-146,-175,-208},{-93,-140,-158,-208,-211,-186},{-111,-142,-107,-116,-150,-212}},{{-108,-173,-121,-180,-123,-265},{-105,-185,-249,-114,-123,-273},{-236,-238,-141,-226,-174,-154},{-180,-117,-145,-137,-227,-150},{-234,-140,-113,-264,-155,-248},{-233,-119,-134,-239,-161,-248},{-175,-239,-247,-209,-190,-271},{-121,-175,-257,-156,-274,-180},{-193,-196,-166,-207,-190,-246},{-217,-196,-128,-135,-274,-263}}},{{{-291,-159,-198,-226,-307,-202},{-268,-290,-164,-274,-176,-236},{-154,-217,-224,-178,-269,-224},{-263,-157,-281,-188,-162,-167},{-282,-293,-276,-259,-276,-221},{-273,-250,-193,-267,-281,-238},{-151,-228,-281,-333,-171,-231},{-289,-186,-171,-174,-243,-174},{-156,-200,-143,-174,-190,-212},{-189,-312,-324,-314,-193,-143}},{{-174,-240,-209,-252,-145,-157},{-205,-331,-172,-280,-289,-243},{-302,-245,-202,-178,-292,-199},{-288,-195,-261,-201,-282,-214},{-267,-259,-277,-159,-235,-135},{-202,-164,-327,-303,-244,-139},{-198,-226,-324,-280,-192,-296},{-186,-245,-294,-173,-314,-197},{-236,-176,-266,-245,-310,-254},{-290,-174,-327,-210,-212,-137}},{{-232,-192,-218,-216,-200,-113},{-153,-232,-228,-209,-120,-139},{-260,-167,-184,-215,-159,-211},{-168,-236,-137,-261,-165,-112},{-249,-171,-180,-119,-193,-131},{-284,-155,-232,-250,-142,-166},{-131,-217,-164,-146,-151,-238},{-219,-219,-123,-164,-219,-194},{-239,-249,-190,-189,-209,-184},{-254,-163,-236,-135,-251,-149}}},{{{-261,-165,-194,-186,-340,-303},{-277,-277,-340,-210,-340,-279},{-226,-309,-247,-290,-237,-205},{-250,-322,-266,-359,-234,-210},{-367,-173,-327,-215,-263,-221},{-330,-322,-237,-351,-231,-162},{-245,-285,-322,-290,-231,-287},{-269,-213,-346,-364,-200,-162},{-173,-338,-202,-327,-253,-269},{-173,-269,-160,-218,-340,-197}},{{-319,-285,-247,-372,-165,-342},{-362,-277,-205,-338,-168,-225},{-343,-301,-335,-290,-309,-277},{-338,-255,-354,-322,-225,-350},{-266,-223,-202,-263,-362,-251},{-207,-221,-303,-303,-312,-246},{-293,-184,-210,-234,-257,-238},{-364,-343,-277,-338,-325,-161},{-285,-301,-255,-237,-288,-290},{-298,-215,-250,-274,-301,-166}},{{-298,-296,-292,-308,-262,-176},{-326,-329,-242,-198,-174,-253},{-313,-296,-267,-164,-252,-284},{-298,-223,-212,-317,-262,-164},{-163,-349,-265,-317,-159,-198},{-264,-177,-287,-246,-174,-176},{-324,-200,-199,-293,-247,-243},{-220,-296,-265,-320,-225,-198},{-192,-205,-214,-203,-262,-270},{-176,-218,-151,-233,-341,-161}}},{{{-409,-256,-187,-280,-364,-219},{-376,-301,-217,-349,-310,-352},{-409,-331,-214,-343,-229,-370},{-361,-391,-244,-328,-244,-258},{-301,-313,-226,-229,-208,-408},{-367,-280,-322,-346,-238,-243},{-397,-193,-415,-349,-322,-408},{-367,-277,-181,-334,-385,-231},{-358,-199,-184,-214,-292,-296},{-256,-418,-349,-394,-376,-299}},{{-355,-399,-176,-284,-207,-185},{-343,-301,-342,-371,-231,-159},{-185,-192,-333,-292,-360,-182},{-404,-390,-269,-379,-313,-185},{-396,-250,-171,-235,-299,-332},{-404,-264,-330,-207,-331,-206},{-387,-201,-277,-251,-162,-175},{-179,-339,-179,-227,-358,-226},{-217,-321,-182,-210,-352,-188},{-188,-339,-241,-254,-183,-203}},{{-218,-334,-273,-298,-271,-228},{-171,-144,-243,-197,-280,-267},{-179,-317,-295,-206,-180,-133},{-300,-242,-211,-252,-155,-216},{-184,-154,-156,-265,-286,-224},{-233,-194,-202,-186,-172,-145},{-171,-259,-314,-141,-201,-273},{-275,-305,-188,-228,-159,-135},{-236,-334,-206,-290,-136,-242},{-166,-202,-165,-152,-233,-218}}},{{{-284,-273,-231,-416,-273,-326},{-378,-416,-245,-354,-378,-259},{-368,-245,-294,-280,-220,-301},{-312,-280,-241,-284,-473,-416},{-360,-259,-476,-326,-217,-262},{-441,-346,-364,-455,-270,-473},{-210,-455,-262,-343,-252,-448},{-332,-210,-462,-469,-374,-441},{-332,-329,-217,-252,-312,-287},{-438,-378,-434,-234,-284,-315}},{{-411,-391,-281,-421,-272,-431},{-271,-350,-417,-261,-230,-290},{-351,-278,-363,-297,-387,-319},{-278,-381,-339,-271,-341,-267},{-348,-350,-302,-281,-239,-235},{-320,-401,-414,-314,-426,-235},{-275,-298,-339,-387,-358,-206},{-480,-377,-414,-220,-430,-242},{-251,-340,-315,-414,-210,-206},{-258,-398,-434,-204,-203,-254}},{{-413,-206,-354,-284,-217,-361},{-265,-308,-186,-305,-282,-211},{-227,-397,-306,-231,-239,-342},{-268,-407,-303,-284,-202,-250},{-268,-385,-231,-369,-202,-311},{-438,-370,-210,-199,-234,-211},{-243,-394,-273,-182,-180,-270},{-337,-302,-201,-205,-265,-317},{-243,-290,-372,-322,-265,-189},{-324,-265,-327,-381,-373,-228}}}}; // supply (positive for supply and negative for demand) under different scenarios 
int iniv[I]={1052,192,238,253,176,234,280,264,252}; // initial inventory 
int ubiv[I]={2104,384,476,507,352,468,350,495,504}; // 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.35,8.59,5.57,4.52,2.83,1.94,4.81,7.57}; // 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.14,7.81,5.06,4.11,2.57,1.76,4.37,6.88}}; // 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.71,9.71,9.71,8.5,8.5,8.5,7.28,7.28,7.28,6.25,6.25,6.25,5.47,5.47,5.47,4.69,4.69,4.69,4.05,4.05,4.05,3.54,3.54,3.54,3.04,3.04,3.04,3.29,3.29,3.29,2.88,2.88,2.88,2.47,2.47,2.47,2.06,2.06,2.06,1.8,1.8,1.8,1.54,1.54,1.54,1.41,1.41,1.41,1.23,1.23,1.23,1.06,1.06,1.06,3.5,3.5,3.5,3.06,3.06,3.06,2.62,2.62,2.62,5.5,5.5,5.5,4.82,4.82,4.82,4.13,4.13,4.13}; // 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,4,2,6,3,2,7,3,3,7,4,3,8,4,3,8,4,3,7,4,3,7,4,3,8,4,3,8,4,3,8,4,3,7,4,3,8,4,3,8,4,3,9,5,3,9,4,3,9,5,3,8,5,3,8,4,3,8,4,3,8,4,3,8,4,3,7,4,3,7,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}}; // set of shipments in each bid 
int SHsts[SPN]={2,4,6,8,10,12,0,4,8,12,2,8,1,3,5,7,9,11,1,5,9,1,7,0,2,4,6,8,10,12,1,5,9,0,6,12,1,3,5,7,9,11,13,1,5,9,13,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,1,5,9,13,0,6,12,2,4,6,8,10,12,14,2,6,10,14,1,7,13,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,2,6,10,14,0,6,12,1,3,5,7,9,11,13,15,0,4,8,12,2,8,14,2,4,6,8,10,12,14,1,5,9,13,0,6,12,2,4,6,8,10,12,14,16,1,5,9,13,0,6,12,1,3,5,7,9,11,13,15,1,5,9,13,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,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,0,4,8,12,16,2,8,14,0,2,4,6,8,10,12,14,0,4,8,12,0,6,12,0,2,4,6,8,10,12,14,0,4,8,12,0,6,12,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,2,8,14,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}; // set of start times of each shipment 
int SHets[SPN]={7,9,11,13,15,17,5,9,13,17,7,13,6,8,10,12,14,16,6,10,14,6,12,5,7,9,11,13,15,17,6,10,14,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,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,4,8,12,16,3,9,15,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,3,9,15,3,5,7,9,11,13,15,17,4,8,12,16,2,8,14,3,5,7,9,11,13,15,17,2,6,10,14,4,10,16,4,6,8,10,12,14,16,3,7,11,15,2,8,14,3,5,7,9,11,13,15,17,2,6,10,14,1,7,13,2,4,6,8,10,12,14,16,2,6,10,14,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,3,7,11,15,1,7,13,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,1,5,9,13,17,3,9,15,2,4,6,8,10,12,14,16,2,6,10,14,2,8,14,2,4,6,8,10,12,14,16,2,6,10,14,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,4,8,12,16,5,11,17,5,7,9,11,13,15,17,3,7,11,15,4,10,16,5,7,9,11,13,15,17,5,9,13,17,5,11,17}; // set of end times of each shipment 
