Only in glpk-4.39.p4: config.h Only in glpk-4.39.p4: config.log Only in glpk-4.39.p4: config.status Only in glpk-4.39.p4/examples: .deps Only in glpk-4.39.p4/examples: glpsol diff -crB glpk-4.39/examples/glpsol.c glpk-4.39.p4/examples/glpsol.c *** glpk-4.39/examples/glpsol.c 2009-07-26 11:00:00.000000000 +0200 --- glpk-4.39.p4/examples/glpsol.c 2011-04-21 11:04:48.000000000 +0200 *************** *** 1,10 **** ! /* glpsol.c */ ! ! #include ! ! int main(int argc, const char *argv[]) ! { /* stand-alone LP/MIP solver */ ! return glp_main(argc, argv); ! } ! ! /* eof */ --- 1,1086 ---- ! /* glpsol.c */ ! ! #include ! ! int main(int argc, const char *argv[]) ! { /* stand-alone LP/MIP solver */ ! ! ! ! // ------------------ Gianluigi, 27-10-2009 ! ! ! ! ! // ! // input values ! // ! // ROWS (for read_rows function) ! // ! int nRows = 82; ! char *CharRow[]={ ! "N", ! "L","L","L","L","L","L","L","L","G", ! "L","L","L","L","L","L","L","L","G", ! "L","L","L","L","L","L","L","L","G", ! "L","L","L","L","L","L","L","L","G", ! "L","L","L","L","L","L","L","L","G", ! "L","L","L","L","L","L","L","L","G", ! "L","L","L","L","L","L","L","L","G", ! "L","L","L","L","L","L","L","L","G", ! "L","L","L","L","L","L","L","L","G" ! }; ! ! int typeRows[nRows]; ! ! char * nameRows[] = { ! "OBJECT" ! ,"Ap0" ! ,"Bp0" ! ,"Cp0" ! ,"Dp0" ! ,"Am0" ! ,"Bm0" ! ,"Cm0" ! ,"Dm0" ! ,"LAMBDA0" ! ,"Ap1" ! ,"Bp1" ! ,"Cp1" ! ,"Dp1" ! ,"Am1" ! ,"Bm1" ! ,"Cm1" ! ,"Dm1" ! ,"LAMBDA1" ! ,"Ap2" ! ,"Bp2" ! ,"Cp2" ! ,"Dp2" ! ,"Am2" ! ,"Bm2" ! ,"Cm2" ! ,"Dm2" ! ,"LAMBDA2" ! ,"Ap3" ! ,"Bp3" ! ,"Cp3" ! ,"Dp3" ! ,"Am3" ! ,"Bm3" ! ,"Cm3" ! ,"Dm3" ! ,"LAMBDA3" ! ,"Ap4" ! ,"Bp4" ! ,"Cp4" ! ,"Dp4" ! ,"Am4" ! ,"Bm4" ! ,"Cm4" ! ,"Dm4" ! ,"LAMBDA4" ! ,"Ap5" ! ,"Bp5" ! ,"Cp5" ! ,"Dp5" ! ,"Am5" ! ,"Bm5" ! ,"Cm5" ! ,"Dm5" ! ,"LAMBDA5" ! ,"Ap6" ! ,"Bp6" ! ,"Cp6" ! ,"Dp6" ! ,"Am6" ! ,"Bm6" ! ,"Cm6" ! ,"Dm6" ! ,"LAMBDA6" ! ,"Ap7" ! ,"Bp7" ! ,"Cp7" ! ,"Dp7" ! ,"Am7" ! ,"Bm7" ! ,"Cm7" ! ,"Dm7" ! ,"LAMBDA7" ! ,"Ap8" ! ,"Bp8" ! ,"Cp8" ! ,"Dp8" ! ,"Am8" ! ,"Bm8" ! ,"Cm8" ! ,"Dm8" ! ,"LAMBDA8" ! }; ! ! //------- end ROWS information ! ! ! //--------begin COLUMNS information ! ! ! int const NStructVar=41, // number of structural variables ! NStructRows=72; // maximum number of ROWS in which a structural variable can be found ! ! double final_values[NStructVar]; ! ! ! int NRowsInWhichStructVarArePresent[]={ ! 36, ! 36, ! 36, ! 36, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 5, ! 72 ! }; ! ! char *StructVarName[] = { ! "m1", ! "m2", ! "q1", ! "q2", ! "lamp0", ! "lamp1", ! "lamp2", ! "lamp3", ! "lamp4", ! "lamp5", ! "lamp6", ! "lamp7", ! "lamp8", ! "lamm0", ! "lamm1", ! "lamm2", ! "lamm3", ! "lamm4", ! "lamm5", ! "lamm6", ! "lamm7", ! "lamm8", ! "sigmap0", ! "sigmap1", ! "sigmap2", ! "sigmap3", ! "sigmap4", ! "sigmap5", ! "sigmap6", ! "sigmap7", ! "sigmap8", ! "sigmam0", ! "sigmam1", ! "sigmam2", ! "sigmam3", ! "sigmam4", ! "sigmam5", ! "sigmam6", ! "sigmam7", ! "sigmam8", ! "DUMMY" ! }; ! ! ! char *AuxNameRowsInWhichStructVarArePresent[41][72]={ ! // structural variable m1 ! "Ap0","Am0","Bp0","Bm0" ! ,"Ap1","Am1","Bp1","Bm1" ! ,"Ap2","Am2","Bp2","Bm2" ! ,"Ap3","Am3","Bp3","Bm3" ! ,"Ap4","Am4","Bp4","Bm4" ! ,"Ap5","Am5","Bp5","Bm5" ! ,"Ap6","Am6","Bp6","Bm6" ! ,"Ap7","Am7","Bp7","Bm7" ! ,"Ap8","Am8","Bp8","Bm8" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","" ! // m2 ! ,"Ap0","Am0","Bp0","Bm0" ! ,"Ap1","Am1","Bp1","Bm1" ! ,"Ap2","Am2","Bp2","Bm2" ! ,"Ap3","Am3","Bp3","Bm3" ! ,"Ap4","Am4","Bp4","Bm4" ! ,"Ap5","Am5","Bp5","Bm5" ! ,"Ap6","Am6","Bp6","Bm6" ! ,"Ap7","Am7","Bp7","Bm7" ! ,"Ap8","Am8","Bp8","Bm8" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","" ! // q1 ! ,"Ap0","Am0","Bp0","Bm0" ! ,"Ap1","Am1","Bp1","Bm1" ! ,"Ap2","Am2","Bp2","Bm2" ! ,"Ap3","Am3","Bp3","Bm3" ! ,"Ap4","Am4","Bp4","Bm4" ! ,"Ap5","Am5","Bp5","Bm5" ! ,"Ap6","Am6","Bp6","Bm6" ! ,"Ap7","Am7","Bp7","Bm7" ! ,"Ap8","Am8","Bp8","Bm8" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","" ! // q2 ! ,"Ap0","Am0","Bp0","Bm0" ! ,"Ap1","Am1","Bp1","Bm1" ! ,"Ap2","Am2","Bp2","Bm2" ! ,"Ap3","Am3","Bp3","Bm3" ! ,"Ap4","Am4","Bp4","Bm4" ! ,"Ap5","Am5","Bp5","Bm5" ! ,"Ap6","Am6","Bp6","Bm6" ! ,"Ap7","Am7","Bp7","Bm7" ! ,"Ap8","Am8","Bp8","Bm8" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","" ! // lamp0 ! ,"Ap0","Bp0","Cp0","Dp0","LAMBDA0","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamp1 ! ,"Ap1","Bp1","Cp1","Dp1","LAMBDA1","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamp2 ! ,"Ap2","Bp2","Cp2","Dp2","LAMBDA2","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamp3 ! ,"Ap3","Bp3","Cp3","Dp3","LAMBDA3","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamp4 ! ,"Ap4","Bp4","Cp4","Dp4","LAMBDA4","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamp5 ! ,"Ap5","Bp5","Cp5","Dp5","LAMBDA5","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamp6 ! ,"Ap6","Bp6","Cp6","Dp6","LAMBDA6","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamp7 ! ,"Ap7","Bp7","Cp7","Dp7","LAMBDA7","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamp8 ! ,"Ap8","Bp8","Cp8","Dp8","LAMBDA8","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamm0 ! ,"Am0","Bm0","Cm0","Dm0","LAMBDA0","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamm1 ! ,"Am1","Bm1","Cm1","Dm1","LAMBDA1","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamm2 ! ,"Am2","Bm2","Cm2","Dm2","LAMBDA2","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamm3 ! , "Am3","Bm3","Cm3","Dm3","LAMBDA3","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamm4 ! ,"Am4","Bm4","Cm4","Dm4","LAMBDA4","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamm5 ! ,"Am5","Bm5","Cm5","Dm5","LAMBDA5","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamm6 ! ,"Am6","Bm6","Cm6","Dm6","LAMBDA6","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamm7 ! ,"Am7","Bm7","Cm7","Dm7","LAMBDA7","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // lamm8 ! ,"Am8","Bm8","Cm8","Dm8","LAMBDA8","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmap0 ! ,"OBJECT","Ap0","Bp0","Cp0","Dp0","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmap1 ! ,"OBJECT","Ap1","Bp1","Cp1","Dp1","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmap2 ! ,"OBJECT","Ap2","Bp2","Cp2","Dp2","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmap3 ! ,"OBJECT","Ap3","Bp3","Cp3","Dp3","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmap4 ! ,"OBJECT","Ap4","Bp4","Cp4","Dp4","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmap5 ! ,"OBJECT","Ap5","Bp5","Cp5","Dp5","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmap6 ! ,"OBJECT","Ap6","Bp6","Cp6","Dp6","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmap7 ! ,"OBJECT","Ap7","Bp7","Cp7","Dp7","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmap8 ! ,"OBJECT","Ap8","Bp8","Cp8","Dp8","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmam0 ! ,"OBJECT","Am0","Bm0","Cm0","Dm0","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmam1 ! ,"OBJECT","Am1","Bm1","Cm1","Dm1","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmam2 ! ,"OBJECT","Am2","Bm2","Cm2","Dm2","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmam3 ! ,"OBJECT","Am3","Bm3","Cm3","Dm3","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmam4 ! ,"OBJECT","Am4","Bm4","Cm4","Dm4","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmam5 ! ,"OBJECT","Am5","Bm5","Cm5","Dm5","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmam6 ! ,"OBJECT","Am6","Bm6","Cm6","Dm6","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmam7 ! ,"OBJECT","Am7","Bm7","Cm7","Dm7","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // sigmam8 ! ,"OBJECT","Am8","Bm8","Cm8","Dm8","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","","","","","","","","","" ! ,"","" ! // DUMMY ! ,"Ap0","Am0","Bp0","Bm0","Cp0","Cm0","Dp0","Dm0" ! ,"Ap1","Am1","Bp1","Bm1","Cp1","Cm1","Dp1","Dm1" ! ,"Ap2","Am2","Bp2","Bm2","Cp2","Cm2","Dp2","Dm2" ! ,"Ap3","Am3","Bp3","Bm3","Cp3","Cm3","Dp3","Dm3" ! ,"Ap4","Am4","Bp4","Bm4","Cp4","Cm4","Dp4","Dm4" ! ,"Ap5","Am5","Bp5","Bm5","Cp5","Cm5","Dp5","Dm5" ! ,"Ap6","Am6","Bp6","Bm6","Cp6","Cm6","Dp6","Dm6" ! ,"Ap7","Am7","Bp7","Bm7","Cp7","Cm7","Dp7","Dm7" ! ,"Ap8","Am8","Bp8","Bm8","Cp8","Cm8","Dp8","Dm8" ! ! }; ! ! char *NameRowsInWhichStructVarArePresent[41*72]; ! int n1,n2; ! for(n1=0;n1<41;n1++){ ! for(n2=0;n2<72;n2++){ ! NameRowsInWhichStructVarArePresent[n1*72+n2] = AuxNameRowsInWhichStructVarArePresent[n1][n2]; ! } ! } ! ! double AuxCoefficients[41][72]={ ! // m1 ! 0.0247869,0.0247869 ! ,-0.0247869,-0.0247869 ! ,0.0259459,0.0259459 ! ,-0.0259459,-0.0259459 ! ,0.0265537,0.0265537 ! ,-0.0265537,-0.0265537 ! ,0.0253408,0.0253408 ! ,-0.0253408,-0.0253408 ! ,0.0278883,0.0278883 ! ,-0.0278883,-0.0278883 ! ,0.0293638,0.0293638 ! ,-0.0293638,-0.0293638 ! ,0.0271906,0.0271906 ! ,-0.0271906,-0.0271906 ! ,0.0285919,0.0285919 ! ,-0.0285919,-0.0285919 ! ,0.0301453,0.0301453 ! ,-0.0301453,-0.0301453 ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0. ! // m2 ! ,-0.0247869,-0.0247869 ! ,0.0247869,0.0247869 ! ,-0.0259459,-0.0259459 ! ,0.0259459,0.0259459 ! ,-0.0265537,-0.0265537 ! ,0.0265537,0.0265537 ! ,-0.0253408,-0.0253408 ! ,0.0253408,0.0253408 ! ,-0.0278883,-0.0278883 ! ,0.0278883,0.0278883 ! ,-0.0293638,-0.0293638 ! ,0.0293638,0.0293638 ! ,-0.0271906,-0.0271906 ! ,0.0271906,0.0271906 ! ,-0.0285919,-0.0285919 ! ,0.0285919,0.0285919 ! ,-0.0301453,-0.0301453 ! ,0.0301453,0.0301453 ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0. ! // ora q1 ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0. ! // ora q2 ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,-1.,-1. ! ,1.,1. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0. ! // ora lamp0 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // lamp1 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // lamp2 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // lamp3 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // ora lamp4 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // ora lamp5 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // ora lamp6 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // ora lamp7 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // ora lamp8 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // ora lamm0 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // lamm1 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // lamm2 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // lamm3 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // ora lamm4 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // ora lamm5 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // ora lamm6 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // ora lamm7 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // ora lamm8 ! ,-1.,-1.,-1.,1.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmap0 ! ,4146.03,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmap1 ! ,1414.54,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmap2 ! ,10307.8,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmap3 ! ,1801.24,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmap4 ! ,2268.59,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmap5 ! ,898.79,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmap6 ! ,1018.71,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmap7 ! ,2141.62,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmap8 ! ,11750.2,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmam0 ! ,4146.03,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmam1 ! ,1414.54,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmam2 ! ,10307.8,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmam3 ! ,1801.24,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmam4 ! ,2268.59,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmam5 ! ,898.79,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmam6 ! ,1018.71,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmam7 ! ,2141.62,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // sigmam8 ! ,11750.2,-1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! ,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0. ! // DUMMY ! ,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. ! ,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. ! ,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. ! ,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. ! }; ! ! double *Coefficients; ! Coefficients=&AuxCoefficients[0][0]; ! ! /* ! int i1,i2; ! for(i1=0;i1<41;i1++){ ! for(i2=0;i2<72;i2++){ ! *( *(Coefficients+i1) +i2) = AuxCoefficients[i1][i2]; ! } ! }; ! */ ! ! ! //--------end COLUMNS information ! ! ! //--------begin RHS information ! ! double ValueB[81]={ ! 2.00438,1.99562 ! ,2.00024,2.99976 ! ,2.00422,1.99578 ! ,2.00024,2.99976 ! ,1. ! ,2.00456,1.99544 ! ,2.00071,2.99929 ! ,2.00409,1.99591 ! ,2.00071,2.99929 ! ,1. ! ,2.00474,1.99526 ! ,2.0001,2.9999 ! ,2.00467,1.99533 ! ,2.0001,2.9999 ! ,1. ! ,2.00483,1.99517 ! ,2.00056,2.99944 ! ,2.00446,1.99554 ! ,2.00056,2.99944 ! ,1. ! ,2.00489,1.99511 ! ,2.00044,2.99956 ! ,2.0046,1.9954 ! ,2.00044,2.99956 ! ,1. ! ,2.00514,1.99486 ! ,2.00111,2.99889 ! ,2.0044,1.9956 ! ,2.00111,2.99889 ! ,1. ! ,2.00544,1.99456 ! ,2.00098,2.99902 ! ,2.00479,1.99521 ! ,2.00098,2.99902 ! ,1. ! ,2.00534,1.99466 ! ,2.00047,2.99953 ! ,2.00503,1.99497 ! ,2.00047,2.99953 ! ,1. ! ,2.00528,1.99472 ! ,2.00009,2.99991 ! ,2.00522,1.99478 ! ,2.00009,2.99991 ! ,1. ! }; ! ! ! //--------end RHS information ! ! //--------begin RANGES information ! ! int nRanges = 9; ! double ValueRanges[9]={1.,1.,1.,1.,1.,1.,1.,1.,1.}; ! char *NameRanges[9]={ ! "LAMBDA0","LAMBDA1","LAMBDA2","LAMBDA3","LAMBDA4","LAMBDA5","LAMBDA6","LAMBDA7","LAMBDA8" ! }; ! ! ! //--------end RANGES information ! //--------start BOUNDS information ! ! int nBounds = 19; ! double BoundValue[19]={ 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,2.}; ! char *BoundStructVarName[] = { ! "lamp0", ! "lamp1", ! "lamp2", ! "lamp3", ! "lamp4", ! "lamp5", ! "lamp6", ! "lamp7", ! "lamp8", ! "lamm0", ! "lamm1", ! "lamm2", ! "lamm3", ! "lamm4", ! "lamm5", ! "lamm6", ! "lamm7", ! "lamm8", ! "DUMMY" ! }; ! char *TypeofBound[] = { ! "BV", ! "BV", ! "BV", ! "BV", ! "BV", ! "BV", ! "BV", ! "BV", ! "BV", ! "BV", ! "BV", ! "BV", ! "BV", ! "BV", ! "BV", ! "BV", ! "BV", ! "BV", ! "FX" ! }; ! //--------end BOUNDS information ! ! ! int timeout=60; // in seconds. ! ! //----------------------- end input information. ! ! ! ! ! ! //--- not from input file but from input data. ! int it; ! for(it=0; it< nRows;it++){ ! if (CharRow[it] == "N") ! typeRows[it] = GLP_FR; ! else if (CharRow[it] == "G") ! typeRows[it] = GLP_LO; ! else if (CharRow[it] == "L") ! typeRows[it] = GLP_UP; ! else if (CharRow[it] == "E") ! typeRows[it] = GLP_FX; ! } ! ! ! ! ! ! ! ! int status= glp_main_t( ! nRows,nameRows,typeRows, // ROWS info ! NStructVar, NStructRows, NRowsInWhichStructVarArePresent, // COLUMNS info ! StructVarName, NameRowsInWhichStructVarArePresent, // COLUMNS info ! Coefficients, // COLUMNS info ! ValueB, // RHS info ! nRanges, ValueRanges, NameRanges, // RANGES info ! nBounds, BoundValue, BoundStructVarName, TypeofBound // BOUNDS info ! // ,argc, argv ! ,final_values, timeout ! ); ! ! ! printf("from main, final printout -------------------------------\n"); ! printf(" number of structural variables %d\n",NStructVar); ! int ica; ! for(ica=0;ica. ! * ! * GLPK is free software: you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by ! * the Free Software Foundation, either version 3 of the License, or ! * (at your option) any later version. ! * ! * GLPK is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ! * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ! * License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with GLPK. If not, see . ! ***********************************************************************/ ! ! #ifndef GLPK_H ! #define GLPK_H ! ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! #include ! #include ! ! /* library version numbers: */ ! #define GLP_MAJOR_VERSION 4 ! #define GLP_MINOR_VERSION 39 ! ! #ifndef GLP_PROB ! #define GLP_PROB ! typedef struct { double _opaque_prob; } glp_prob; ! /* LP/MIP problem object */ ! #endif ! ! /* optimization direction flag: */ ! #define GLP_MIN 1 /* minimization */ ! #define GLP_MAX 2 /* maximization */ ! ! /* kind of structural variable: */ ! #define GLP_CV 1 /* continuous variable */ ! #define GLP_IV 2 /* integer variable */ ! #define GLP_BV 3 /* binary variable */ ! ! /* type of auxiliary/structural variable: */ ! #define GLP_FR 1 /* free variable */ ! #define GLP_LO 2 /* variable with lower bound */ ! #define GLP_UP 3 /* variable with upper bound */ ! #define GLP_DB 4 /* double-bounded variable */ ! #define GLP_FX 5 /* fixed variable */ ! ! /* status of auxiliary/structural variable: */ ! #define GLP_BS 1 /* basic variable */ ! #define GLP_NL 2 /* non-basic variable on lower bound */ ! #define GLP_NU 3 /* non-basic variable on upper bound */ ! #define GLP_NF 4 /* non-basic free variable */ ! #define GLP_NS 5 /* non-basic fixed variable */ ! ! /* scaling options: */ ! #define GLP_SF_GM 0x01 /* perform geometric mean scaling */ ! #define GLP_SF_EQ 0x10 /* perform equilibration scaling */ ! #define GLP_SF_2N 0x20 /* round scale factors to power of two */ ! #define GLP_SF_SKIP 0x40 /* skip if problem is well scaled */ ! #define GLP_SF_AUTO 0x80 /* choose scaling options automatically */ ! ! /* solution indicator: */ ! #define GLP_SOL 1 /* basic solution */ ! #define GLP_IPT 2 /* interior-point solution */ ! #define GLP_MIP 3 /* mixed integer solution */ ! ! /* solution status: */ ! #define GLP_UNDEF 1 /* solution is undefined */ ! #define GLP_FEAS 2 /* solution is feasible */ ! #define GLP_INFEAS 3 /* solution is infeasible */ ! #define GLP_NOFEAS 4 /* no feasible solution exists */ ! #define GLP_OPT 5 /* solution is optimal */ ! #define GLP_UNBND 6 /* solution is unbounded */ ! ! #ifndef GLP_BFCP ! #define GLP_BFCP ! typedef struct glp_bfcp glp_bfcp; ! #endif ! ! struct glp_bfcp ! { /* basis factorization control parameters */ ! int msg_lev; /* (reserved) */ ! int type; /* factorization type: */ ! #define GLP_BF_FT 1 /* LUF + Forrest-Tomlin */ ! #define GLP_BF_BG 2 /* LUF + Schur compl. + Bartels-Golub */ ! #define GLP_BF_GR 3 /* LUF + Schur compl. + Givens rotation */ ! int lu_size; /* luf.sv_size */ ! double piv_tol; /* luf.piv_tol */ ! int piv_lim; /* luf.piv_lim */ ! int suhl; /* luf.suhl */ ! double eps_tol; /* luf.eps_tol */ ! double max_gro; /* luf.max_gro */ ! int nfs_max; /* fhv.hh_max */ ! double upd_tol; /* fhv.upd_tol */ ! int nrs_max; /* lpf.n_max */ ! int rs_size; /* lpf.v_size */ ! double foo_bar[38]; /* (reserved) */ ! }; ! ! typedef struct ! { /* simplex method control parameters */ ! int msg_lev; /* message level: */ ! #define GLP_MSG_OFF 0 /* no output */ ! #define GLP_MSG_ERR 1 /* warning and error messages only */ ! #define GLP_MSG_ON 2 /* normal output */ ! #define GLP_MSG_ALL 3 /* full output */ ! #define GLP_MSG_DBG 4 /* debug output */ ! int meth; /* simplex method option: */ ! #define GLP_PRIMAL 1 /* use primal simplex */ ! #define GLP_DUALP 2 /* use dual; if it fails, use primal */ ! #define GLP_DUAL 3 /* use dual simplex */ ! int pricing; /* pricing technique: */ ! #define GLP_PT_STD 0x11 /* standard (Dantzig rule) */ ! #define GLP_PT_PSE 0x22 /* projected steepest edge */ ! int r_test; /* ratio test technique: */ ! #define GLP_RT_STD 0x11 /* standard (textbook) */ ! #define GLP_RT_HAR 0x22 /* two-pass Harris' ratio test */ ! double tol_bnd; /* spx.tol_bnd */ ! double tol_dj; /* spx.tol_dj */ ! double tol_piv; /* spx.tol_piv */ ! double obj_ll; /* spx.obj_ll */ ! double obj_ul; /* spx.obj_ul */ ! int it_lim; /* spx.it_lim */ ! int tm_lim; /* spx.tm_lim (milliseconds) */ ! int out_frq; /* spx.out_frq */ ! int out_dly; /* spx.out_dly (milliseconds) */ ! int presolve; /* enable/disable using LP presolver */ ! double foo_bar[36]; /* (reserved) */ ! } glp_smcp; ! ! typedef struct ! { /* interior-point solver control parameters */ ! int msg_lev; /* message level (see glp_smcp) */ ! int ord_alg; /* ordering algorithm: */ ! #define GLP_ORD_NONE 0 /* natural (original) ordering */ ! #define GLP_ORD_QMD 1 /* quotient minimum degree (QMD) */ ! #define GLP_ORD_AMD 2 /* approx. minimum degree (AMD) */ ! #define GLP_ORD_SYMAMD 3 /* approx. minimum degree (SYMAMD) */ ! double foo_bar[48]; /* (reserved) */ ! } glp_iptcp; ! ! #ifndef GLP_TREE ! #define GLP_TREE ! typedef struct { double _opaque_tree; } glp_tree; ! /* branch-and-bound tree */ ! #endif ! ! typedef struct ! { /* integer optimizer control parameters */ ! int msg_lev; /* message level (see glp_smcp) */ ! int br_tech; /* branching technique: */ ! #define GLP_BR_FFV 1 /* first fractional variable */ ! #define GLP_BR_LFV 2 /* last fractional variable */ ! #define GLP_BR_MFV 3 /* most fractional variable */ ! #define GLP_BR_DTH 4 /* heuristic by Driebeck and Tomlin */ ! #define GLP_BR_HPC 5 /* hybrid pseudocost */ ! int bt_tech; /* backtracking technique: */ ! #define GLP_BT_DFS 1 /* depth first search */ ! #define GLP_BT_BFS 2 /* breadth first search */ ! #define GLP_BT_BLB 3 /* best local bound */ ! #define GLP_BT_BPH 4 /* best projection heuristic */ ! double tol_int; /* mip.tol_int */ ! double tol_obj; /* mip.tol_obj */ ! int tm_lim; /* mip.tm_lim (milliseconds) */ ! int out_frq; /* mip.out_frq (milliseconds) */ ! int out_dly; /* mip.out_dly (milliseconds) */ ! void (*cb_func)(glp_tree *T, void *info); ! /* mip.cb_func */ ! void *cb_info; /* mip.cb_info */ ! int cb_size; /* mip.cb_size */ ! int pp_tech; /* preprocessing technique: */ ! #define GLP_PP_NONE 0 /* disable preprocessing */ ! #define GLP_PP_ROOT 1 /* preprocessing only on root level */ ! #define GLP_PP_ALL 2 /* preprocessing on all levels */ ! double mip_gap; /* relative MIP gap tolerance */ ! int mir_cuts; /* MIR cuts (GLP_ON/GLP_OFF) */ ! int gmi_cuts; /* Gomory's cuts (GLP_ON/GLP_OFF) */ ! int cov_cuts; /* cover cuts (GLP_ON/GLP_OFF) */ ! int clq_cuts; /* clique cuts (GLP_ON/GLP_OFF) */ ! int presolve; /* enable/disable using MIP presolver */ ! int binarize; /* try to binarize integer variables */ ! int fp_heur; /* feasibility pump heuristic */ ! double foo_bar[30]; /* (reserved) */ ! } glp_iocp; ! ! typedef struct ! { /* additional row attributes */ ! int level; ! /* subproblem level at which the row was added */ ! int origin; ! /* the row origin flag: */ ! #define GLP_RF_REG 0 /* regular constraint */ ! #define GLP_RF_LAZY 1 /* "lazy" constraint */ ! #define GLP_RF_CUT 2 /* cutting plane constraint */ ! int klass; ! /* the row class descriptor: */ ! #define GLP_RF_GMI 1 /* Gomory's mixed integer cut */ ! #define GLP_RF_MIR 2 /* mixed integer rounding cut */ ! #define GLP_RF_COV 3 /* mixed cover cut */ ! #define GLP_RF_CLQ 4 /* clique cut */ ! double foo_bar[7]; ! /* (reserved) */ ! } glp_attr; ! ! /* enable/disable flag: */ ! #define GLP_ON 1 /* enable something */ ! #define GLP_OFF 0 /* disable something */ ! ! /* reason codes: */ ! #define GLP_IROWGEN 0x01 /* request for row generation */ ! #define GLP_IBINGO 0x02 /* better integer solution found */ ! #define GLP_IHEUR 0x03 /* request for heuristic solution */ ! #define GLP_ICUTGEN 0x04 /* request for cut generation */ ! #define GLP_IBRANCH 0x05 /* request for branching */ ! #define GLP_ISELECT 0x06 /* request for subproblem selection */ ! #define GLP_IPREPRO 0x07 /* request for preprocessing */ ! ! /* branch selection indicator: */ ! #define GLP_NO_BRNCH 0 /* select no branch */ ! #define GLP_DN_BRNCH 1 /* select down-branch */ ! #define GLP_UP_BRNCH 2 /* select up-branch */ ! ! /* return codes: */ ! #define GLP_EBADB 0x01 /* invalid basis */ ! #define GLP_ESING 0x02 /* singular matrix */ ! #define GLP_ECOND 0x03 /* ill-conditioned matrix */ ! #define GLP_EBOUND 0x04 /* invalid bounds */ ! #define GLP_EFAIL 0x05 /* solver failed */ ! #define GLP_EOBJLL 0x06 /* objective lower limit reached */ ! #define GLP_EOBJUL 0x07 /* objective upper limit reached */ ! #define GLP_EITLIM 0x08 /* iteration limit exceeded */ ! #define GLP_ETMLIM 0x09 /* time limit exceeded */ ! #define GLP_ENOPFS 0x0A /* no primal feasible solution */ ! #define GLP_ENODFS 0x0B /* no dual feasible solution */ ! #define GLP_EROOT 0x0C /* root LP optimum not provided */ ! #define GLP_ESTOP 0x0D /* search terminated by application */ ! #define GLP_EMIPGAP 0x0E /* relative mip gap tolerance reached */ ! #define GLP_ENOFEAS 0x0F /* no primal/dual feasible solution */ ! #define GLP_ENOCVG 0x10 /* no convergence */ ! #define GLP_EINSTAB 0x11 /* numerical instability */ ! #define GLP_EDATA 0x12 /* invalid data */ ! #define GLP_ERANGE 0x13 /* result out of range */ ! ! /* condition indicator: */ ! #define GLP_KKT_PE 1 /* primal equalities */ ! #define GLP_KKT_PB 2 /* primal bounds */ ! #define GLP_KKT_DE 3 /* dual equalities */ ! #define GLP_KKT_DB 4 /* dual bounds */ ! #define GLP_KKT_CS 5 /* complementary slackness */ ! ! /* MPS file format: */ ! #define GLP_MPS_DECK 1 /* fixed (ancient) */ ! #define GLP_MPS_FILE 2 /* free (modern) */ ! ! typedef struct ! { /* MPS format control parameters */ ! int blank; ! /* character code to replace blanks in symbolic names */ ! char *obj_name; ! /* objective row name */ ! double tol_mps; ! /* zero tolerance for MPS data */ ! double foo_bar[17]; ! /* (reserved for use in the future) */ ! } glp_mpscp; ! ! typedef struct ! { /* CPLEX LP format control parameters */ ! double foo_bar[20]; ! /* (reserved for use in the future) */ ! } glp_cpxcp; ! ! #ifndef GLP_TRAN ! #define GLP_TRAN ! typedef struct { double _opaque_tran; } glp_tran; ! /* MathProg translator workspace */ ! #endif ! ! glp_prob *glp_create_prob(void); ! /* create problem object */ ! ! void glp_set_prob_name(glp_prob *P, const char *name); ! /* assign (change) problem name */ ! ! void glp_set_obj_name(glp_prob *P, const char *name); ! /* assign (change) objective function name */ ! ! void glp_set_obj_dir(glp_prob *P, int dir); ! /* set (change) optimization direction flag */ ! ! int glp_add_rows(glp_prob *P, int nrs); ! /* add new rows to problem object */ ! ! int glp_add_cols(glp_prob *P, int ncs); ! /* add new columns to problem object */ ! ! void glp_set_row_name(glp_prob *P, int i, const char *name); ! /* assign (change) row name */ ! ! void glp_set_col_name(glp_prob *P, int j, const char *name); ! /* assign (change) column name */ ! ! void glp_set_row_bnds(glp_prob *P, int i, int type, double lb, ! double ub); ! /* set (change) row bounds */ ! ! void glp_set_col_bnds(glp_prob *P, int j, int type, double lb, ! double ub); ! /* set (change) column bounds */ ! ! void glp_set_obj_coef(glp_prob *P, int j, double coef); ! /* set (change) obj. coefficient or constant term */ ! ! void glp_set_mat_row(glp_prob *P, int i, int len, const int ind[], ! const double val[]); ! /* set (replace) row of the constraint matrix */ ! ! void glp_set_mat_col(glp_prob *P, int j, int len, const int ind[], ! const double val[]); ! /* set (replace) column of the constraint matrix */ ! ! void glp_load_matrix(glp_prob *P, int ne, const int ia[], ! const int ja[], const double ar[]); ! /* load (replace) the whole constraint matrix */ ! ! void glp_del_rows(glp_prob *P, int nrs, const int num[]); ! /* delete specified rows from problem object */ ! ! void glp_del_cols(glp_prob *P, int ncs, const int num[]); ! /* delete specified columns from problem object */ ! ! void glp_copy_prob(glp_prob *dest, glp_prob *prob, int names); ! /* copy problem object content */ ! ! void glp_erase_prob(glp_prob *P); ! /* erase problem object content */ ! ! void glp_delete_prob(glp_prob *P); ! /* delete problem object */ ! ! const char *glp_get_prob_name(glp_prob *P); ! /* retrieve problem name */ ! ! const char *glp_get_obj_name(glp_prob *P); ! /* retrieve objective function name */ ! ! int glp_get_obj_dir(glp_prob *P); ! /* retrieve optimization direction flag */ ! ! int glp_get_num_rows(glp_prob *P); ! /* retrieve number of rows */ ! ! int glp_get_num_cols(glp_prob *P); ! /* retrieve number of columns */ ! ! const char *glp_get_row_name(glp_prob *P, int i); ! /* retrieve row name */ ! ! const char *glp_get_col_name(glp_prob *P, int j); ! /* retrieve column name */ ! ! int glp_get_row_type(glp_prob *P, int i); ! /* retrieve row type */ ! ! double glp_get_row_lb(glp_prob *P, int i); ! /* retrieve row lower bound */ ! ! double glp_get_row_ub(glp_prob *P, int i); ! /* retrieve row upper bound */ ! ! int glp_get_col_type(glp_prob *P, int j); ! /* retrieve column type */ ! ! double glp_get_col_lb(glp_prob *P, int j); ! /* retrieve column lower bound */ ! ! double glp_get_col_ub(glp_prob *P, int j); ! /* retrieve column upper bound */ ! ! double glp_get_obj_coef(glp_prob *P, int j); ! /* retrieve obj. coefficient or constant term */ ! ! int glp_get_num_nz(glp_prob *P); ! /* retrieve number of constraint coefficients */ ! ! int glp_get_mat_row(glp_prob *P, int i, int ind[], double val[]); ! /* retrieve row of the constraint matrix */ ! ! int glp_get_mat_col(glp_prob *P, int j, int ind[], double val[]); ! /* retrieve column of the constraint matrix */ ! ! void glp_create_index(glp_prob *P); ! /* create the name index */ ! ! int glp_find_row(glp_prob *P, const char *name); ! /* find row by its name */ ! ! int glp_find_col(glp_prob *P, const char *name); ! /* find column by its name */ ! ! void glp_delete_index(glp_prob *P); ! /* delete the name index */ ! ! void glp_set_rii(glp_prob *P, int i, double rii); ! /* set (change) row scale factor */ ! ! void glp_set_sjj(glp_prob *P, int j, double sjj); ! /* set (change) column scale factor */ ! ! double glp_get_rii(glp_prob *P, int i); ! /* retrieve row scale factor */ ! ! double glp_get_sjj(glp_prob *P, int j); ! /* retrieve column scale factor */ ! ! void glp_scale_prob(glp_prob *P, int flags); ! /* scale problem data */ ! ! void glp_unscale_prob(glp_prob *P); ! /* unscale problem data */ ! ! void glp_set_row_stat(glp_prob *P, int i, int stat); ! /* set (change) row status */ ! ! void glp_set_col_stat(glp_prob *P, int j, int stat); ! /* set (change) column status */ ! ! void glp_std_basis(glp_prob *P); ! /* construct standard initial LP basis */ ! ! void glp_adv_basis(glp_prob *P, int flags); ! /* construct advanced initial LP basis */ ! ! void glp_cpx_basis(glp_prob *P); ! /* construct Bixby's initial LP basis */ ! ! int glp_simplex(glp_prob *P, const glp_smcp *parm); ! /* solve LP problem with the simplex method */ ! ! int glp_exact(glp_prob *P, const glp_smcp *parm); ! /* solve LP problem in exact arithmetic */ ! ! void glp_init_smcp(glp_smcp *parm); ! /* initialize simplex method control parameters */ ! ! int glp_get_status(glp_prob *P); ! /* retrieve generic status of basic solution */ ! ! int glp_get_prim_stat(glp_prob *P); ! /* retrieve status of primal basic solution */ ! ! int glp_get_dual_stat(glp_prob *P); ! /* retrieve status of dual basic solution */ ! ! double glp_get_obj_val(glp_prob *P); ! /* retrieve objective value (basic solution) */ ! ! int glp_get_row_stat(glp_prob *P, int i); ! /* retrieve row status */ ! ! double glp_get_row_prim(glp_prob *P, int i); ! /* retrieve row primal value (basic solution) */ ! ! double glp_get_row_dual(glp_prob *P, int i); ! /* retrieve row dual value (basic solution) */ ! ! int glp_get_col_stat(glp_prob *P, int j); ! /* retrieve column status */ ! ! double glp_get_col_prim(glp_prob *P, int j); ! /* retrieve column primal value (basic solution) */ ! ! double glp_get_col_dual(glp_prob *P, int j); ! /* retrieve column dual value (basic solution) */ ! ! int glp_get_unbnd_ray(glp_prob *P); ! /* determine variable causing unboundedness */ ! ! int glp_interior(glp_prob *P, const glp_iptcp *parm); ! /* solve LP problem with the interior-point method */ ! ! void glp_init_iptcp(glp_iptcp *parm); ! /* initialize interior-point solver control parameters */ ! ! int glp_ipt_status(glp_prob *P); ! /* retrieve status of interior-point solution */ ! ! double glp_ipt_obj_val(glp_prob *P); ! /* retrieve objective value (interior point) */ ! ! double glp_ipt_row_prim(glp_prob *P, int i); ! /* retrieve row primal value (interior point) */ ! ! double glp_ipt_row_dual(glp_prob *P, int i); ! /* retrieve row dual value (interior point) */ ! ! double glp_ipt_col_prim(glp_prob *P, int j); ! /* retrieve column primal value (interior point) */ ! ! double glp_ipt_col_dual(glp_prob *P, int j); ! /* retrieve column dual value (interior point) */ ! ! void glp_set_col_kind(glp_prob *P, int j, int kind); ! /* set (change) column kind */ ! ! int glp_get_col_kind(glp_prob *P, int j); ! /* retrieve column kind */ ! ! int glp_get_num_int(glp_prob *P); ! /* retrieve number of integer columns */ ! ! int glp_get_num_bin(glp_prob *P); ! /* retrieve number of binary columns */ ! ! int glp_intopt(glp_prob *P, const glp_iocp *parm); ! /* solve MIP problem with the branch-and-bound method */ ! ! void glp_init_iocp(glp_iocp *parm); ! /* initialize integer optimizer control parameters */ ! ! int glp_mip_status(glp_prob *P); ! /* retrieve status of MIP solution */ ! ! double glp_mip_obj_val(glp_prob *P); ! /* retrieve objective value (MIP solution) */ ! ! double glp_mip_row_val(glp_prob *P, int i); ! /* retrieve row value (MIP solution) */ ! ! double glp_mip_col_val(glp_prob *P, int j); ! /* retrieve column value (MIP solution) */ ! ! int glp_print_sol(glp_prob *P, const char *fname); ! /* write basic solution in printable format */ ! ! int glp_read_sol(glp_prob *P, const char *fname); ! /* read basic solution from text file */ ! ! int glp_write_sol(glp_prob *P, const char *fname); ! /* write basic solution to text file */ ! ! int glp_print_ipt(glp_prob *P, const char *fname); ! /* write interior-point solution in printable format */ ! ! int glp_read_ipt(glp_prob *P, const char *fname); ! /* read interior-point solution from text file */ ! ! int glp_write_ipt(glp_prob *P, const char *fname); ! /* write interior-point solution to text file */ ! ! int glp_print_mip(glp_prob *P, const char *fname); ! /* write MIP solution in printable format */ ! ! int glp_read_mip(glp_prob *P, const char *fname); ! /* read MIP solution from text file */ ! ! int glp_write_mip(glp_prob *P, const char *fname); ! /* write MIP solution to text file */ ! ! int glp_bf_exists(glp_prob *P); ! /* check if the basis factorization exists */ ! ! int glp_factorize(glp_prob *P); ! /* compute the basis factorization */ ! ! int glp_bf_updated(glp_prob *P); ! /* check if the basis factorization has been updated */ ! ! void glp_get_bfcp(glp_prob *P, glp_bfcp *parm); ! /* retrieve basis factorization control parameters */ ! ! void glp_set_bfcp(glp_prob *P, const glp_bfcp *parm); ! /* change basis factorization control parameters */ ! ! int glp_get_bhead(glp_prob *P, int k); ! /* retrieve the basis header information */ ! ! int glp_get_row_bind(glp_prob *P, int i); ! /* retrieve row index in the basis header */ ! ! int glp_get_col_bind(glp_prob *P, int j); ! /* retrieve column index in the basis header */ ! ! void glp_ftran(glp_prob *P, double x[]); ! /* perform forward transformation (solve system B*x = b) */ ! ! void glp_btran(glp_prob *P, double x[]); ! /* perform backward transformation (solve system B'*x = b) */ ! ! int glp_warm_up(glp_prob *P); ! /* "warm up" LP basis */ ! ! int glp_eval_tab_row(glp_prob *P, int k, int ind[], double val[]); ! /* compute row of the simplex tableau */ ! ! int glp_eval_tab_col(glp_prob *P, int k, int ind[], double val[]); ! /* compute column of the simplex tableau */ ! ! int glp_ios_reason(glp_tree *T); ! /* determine reason for calling the callback routine */ ! ! glp_prob *glp_ios_get_prob(glp_tree *T); ! /* access the problem object */ ! ! void glp_ios_tree_size(glp_tree *T, int *a_cnt, int *n_cnt, ! int *t_cnt); ! /* determine size of the branch-and-bound tree */ ! ! int glp_ios_curr_node(glp_tree *T); ! /* determine current active subproblem */ ! ! int glp_ios_next_node(glp_tree *T, int p); ! /* determine next active subproblem */ ! ! int glp_ios_prev_node(glp_tree *T, int p); ! /* determine previous active subproblem */ ! ! int glp_ios_up_node(glp_tree *T, int p); ! /* determine parent subproblem */ ! ! int glp_ios_node_level(glp_tree *T, int p); ! /* determine subproblem level */ ! ! double glp_ios_node_bound(glp_tree *T, int p); ! /* determine subproblem local bound */ ! ! int glp_ios_best_node(glp_tree *T); ! /* find active subproblem with best local bound */ ! ! double glp_ios_mip_gap(glp_tree *T); ! /* compute relative MIP gap */ ! ! void *glp_ios_node_data(glp_tree *T, int p); ! /* access subproblem application-specific data */ ! ! void glp_ios_row_attr(glp_tree *T, int i, glp_attr *attr); ! /* retrieve additional row attributes */ ! ! int glp_ios_pool_size(glp_tree *T); ! /* determine current size of the cut pool */ ! ! int glp_ios_add_row(glp_tree *T, ! const char *name, int klass, int flags, int len, const int ind[], ! const double val[], int type, double rhs); ! /* add row (constraint) to the cut pool */ ! ! void glp_ios_del_row(glp_tree *T, int i); ! /* remove row (constraint) from the cut pool */ ! ! void glp_ios_clear_pool(glp_tree *T); ! /* remove all rows (constraints) from the cut pool */ ! ! int glp_ios_can_branch(glp_tree *T, int j); ! /* check if can branch upon specified variable */ ! ! void glp_ios_branch_upon(glp_tree *T, int j, int sel); ! /* choose variable to branch upon */ ! ! void glp_ios_select_node(glp_tree *T, int p); ! /* select subproblem to continue the search */ ! ! int glp_ios_heur_sol(glp_tree *T, const double x[]); ! /* provide solution found by heuristic */ ! ! void glp_ios_terminate(glp_tree *T); ! /* terminate the solution process */ ! ! void glp_init_mpscp(glp_mpscp *parm); ! /* initialize MPS format control parameters */ ! ! int glp_read_mps(glp_prob *P, int fmt, const glp_mpscp *parm, ! const char *fname); ! /* read problem data in MPS format */ ! ! int glp_write_mps(glp_prob *P, int fmt, const glp_mpscp *parm, ! const char *fname); ! /* write problem data in MPS format */ ! ! void glp_init_cpxcp(glp_cpxcp *parm); ! /* initialize CPLEX LP format control parameters */ ! ! int glp_read_lp(glp_prob *P, const glp_cpxcp *parm, const char *fname); ! /* read problem data in CPLEX LP format */ ! ! int glp_write_lp(glp_prob *P, const glp_cpxcp *parm, const char *fname); ! /* write problem data in CPLEX LP format */ ! ! glp_tran *glp_mpl_alloc_wksp(void); ! /* allocate the MathProg translator workspace */ ! ! int glp_mpl_read_model(glp_tran *tran, const char *fname, int skip); ! /* read and translate model section */ ! ! int glp_mpl_read_data(glp_tran *tran, const char *fname); ! /* read and translate data section */ ! ! int glp_mpl_generate(glp_tran *tran, const char *fname); ! /* generate the model */ ! ! void glp_mpl_build_prob(glp_tran *tran, glp_prob *prob); ! /* build LP/MIP problem instance from the model */ ! ! int glp_mpl_postsolve(glp_tran *tran, glp_prob *prob, int sol); ! /* postsolve the model */ ! ! void glp_mpl_free_wksp(glp_tran *tran); ! /* free the MathProg translator workspace */ ! ! int glp_main(int argc, const char *argv[]); ! /* stand-alone LP/MIP solver */ ! ! /**********************************************************************/ ! ! typedef struct _glp_graph glp_graph; ! typedef struct _glp_vertex glp_vertex; ! typedef struct _glp_arc glp_arc; ! ! struct _glp_graph ! { /* graph descriptor */ ! void *pool; /* DMP *pool; */ ! /* memory pool to store graph components */ ! char *name; ! /* graph name (1 to 255 chars); NULL means no name is assigned ! to the graph */ ! int nv_max; ! /* length of the vertex list (enlarged automatically) */ ! int nv; ! /* number of vertices in the graph, 0 <= nv <= nv_max */ ! int na; ! /* number of arcs in the graph, na >= 0 */ ! glp_vertex **v; /* glp_vertex *v[1+nv_max]; */ ! /* v[i], 1 <= i <= nv, is a pointer to i-th vertex */ ! void *index; /* AVL *index; */ ! /* vertex index to find vertices by their names; NULL means the ! index does not exist */ ! int v_size; ! /* size of data associated with each vertex (0 to 256 bytes) */ ! int a_size; ! /* size of data associated with each arc (0 to 256 bytes) */ ! }; ! ! struct _glp_vertex ! { /* vertex descriptor */ ! int i; ! /* vertex ordinal number, 1 <= i <= nv */ ! char *name; ! /* vertex name (1 to 255 chars); NULL means no name is assigned ! to the vertex */ ! void *entry; /* AVLNODE *entry; */ ! /* pointer to corresponding entry in the vertex index; NULL means ! that either the index does not exist or the vertex has no name ! assigned */ ! void *data; ! /* pointer to data associated with the vertex */ ! void *temp; ! /* working pointer */ ! glp_arc *in; ! /* pointer to the (unordered) list of incoming arcs */ ! glp_arc *out; ! /* pointer to the (unordered) list of outgoing arcs */ ! }; ! ! struct _glp_arc ! { /* arc descriptor */ ! glp_vertex *tail; ! /* pointer to the tail endpoint */ ! glp_vertex *head; ! /* pointer to the head endpoint */ ! void *data; ! /* pointer to data associated with the arc */ ! void *temp; ! /* working pointer */ ! glp_arc *t_prev; ! /* pointer to previous arc having the same tail endpoint */ ! glp_arc *t_next; ! /* pointer to next arc having the same tail endpoint */ ! glp_arc *h_prev; ! /* pointer to previous arc having the same head endpoint */ ! glp_arc *h_next; ! /* pointer to next arc having the same head endpoint */ ! }; ! ! glp_graph *glp_create_graph(int v_size, int a_size); ! /* create graph */ ! ! void glp_set_graph_name(glp_graph *G, const char *name); ! /* assign (change) graph name */ ! ! int glp_add_vertices(glp_graph *G, int nadd); ! /* add new vertices to graph */ ! ! void glp_set_vertex_name(glp_graph *G, int i, const char *name); ! /* assign (change) vertex name */ ! ! glp_arc *glp_add_arc(glp_graph *G, int i, int j); ! /* add new arc to graph */ ! ! void glp_erase_graph(glp_graph *G, int v_size, int a_size); ! /* erase graph content */ ! ! void glp_delete_graph(glp_graph *G); ! /* delete graph */ ! ! void glp_create_v_index(glp_graph *G); ! /* create vertex name index */ ! ! int glp_find_vertex(glp_graph *G, const char *name); ! /* find vertex by its name */ ! ! void glp_delete_v_index(glp_graph *G); ! /* delete vertex name index */ ! ! int glp_read_graph(glp_graph *G, const char *fname); ! /* read graph from plain text file */ ! ! int glp_write_graph(glp_graph *G, const char *fname); ! /* write graph to plain text file */ ! ! void glp_mincost_lp(glp_prob *P, glp_graph *G, int names, int v_rhs, ! int a_low, int a_cap, int a_cost); ! /* convert minimum cost flow problem to LP */ ! ! int glp_mincost_okalg(glp_graph *G, int v_rhs, int a_low, int a_cap, ! int a_cost, double *sol, int a_x, int v_pi); ! /* find minimum-cost flow with out-of-kilter algorithm */ ! ! void glp_maxflow_lp(glp_prob *P, glp_graph *G, int names, int s, ! int t, int a_cap); ! /* convert maximum flow problem to LP */ ! ! int glp_maxflow_ffalg(glp_graph *G, int s, int t, int a_cap, ! double *sol, int a_x, int v_cut); ! /* find maximal flow with Ford-Fulkerson algorithm */ ! ! int glp_check_asnprob(glp_graph *G, int v_set); ! /* check correctness of assignment problem data */ ! ! /* assignment problem formulation: */ ! #define GLP_ASN_MIN 1 /* perfect matching (minimization) */ ! #define GLP_ASN_MAX 2 /* perfect matching (maximization) */ ! #define GLP_ASN_MMP 3 /* maximum matching */ ! ! int glp_asnprob_lp(glp_prob *P, int form, glp_graph *G, int names, ! int v_set, int a_cost); ! /* convert assignment problem to LP */ ! ! int glp_asnprob_okalg(int form, glp_graph *G, int v_set, int a_cost, ! double *sol, int a_x); ! /* solve assignment problem with out-of-kilter algorithm */ ! ! int glp_asnprob_hall(glp_graph *G, int v_set, int a_x); ! /* find bipartite matching of maximum cardinality */ ! ! int glp_read_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, ! int a_cost, const char *fname); ! /* read min-cost flow problem data in DIMACS format */ ! ! int glp_write_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, ! int a_cost, const char *fname); ! /* write min-cost flow problem data in DIMACS format */ ! ! int glp_read_maxflow(glp_graph *G, int *s, int *t, int a_cap, ! const char *fname); ! /* read maximum flow problem data in DIMACS format */ ! ! int glp_write_maxflow(glp_graph *G, int s, int t, int a_cap, ! const char *fname); ! /* write maximum flow problem data in DIMACS format */ ! ! int glp_read_asnprob(glp_graph *G, int v_set, int a_cost, const char ! *fname); ! /* read assignment problem data in DIMACS format */ ! ! int glp_write_asnprob(glp_graph *G, int v_set, int a_cost, const char ! *fname); ! /* write assignment problem data in DIMACS format */ ! ! int glp_read_ccformat(glp_graph *G, int v_wgt, const char *fname); ! /* read graph in DIMACS clique/coloring format */ ! ! int glp_write_ccformat(glp_graph *G, int v_wgt, const char *fname); ! /* write graph in DIMACS clique/coloring format */ ! ! int glp_netgen(glp_graph *G, int v_rhs, int a_cap, int a_cost, ! const int parm[1+15]); ! /* Klingman's network problem generator */ ! ! int glp_gridgen(glp_graph *G, int v_rhs, int a_cap, int a_cost, ! const int parm[1+14]); ! /* grid-like network problem generator */ ! ! int glp_rmfgen(glp_graph *G, int *s, int *t, int a_cap, ! const int parm[1+5]); ! /* Goldfarb's maximum flow problem generator */ ! ! int glp_weak_comp(glp_graph *G, int v_num); ! /* find all weakly connected components of graph */ ! ! int glp_strong_comp(glp_graph *G, int v_num); ! /* find all strongly connected components of graph */ ! ! /**********************************************************************/ ! ! typedef struct { int lo, hi; } glp_long; ! /* long integer data type */ ! ! const char *glp_version(void); ! /* determine library version */ ! ! void glp_printf(const char *fmt, ...); ! /* write formatted output to terminal */ ! ! void glp_vprintf(const char *fmt, va_list arg); ! /* write formatted output to terminal */ ! ! #define glp_assert(expr) \ ! ((void)((expr) || (glp_assert_(#expr, __FILE__, __LINE__), 1))) ! ! void glp_assert_(const char *expr, const char *file, int line); ! /* check for logical condition */ ! ! int glp_term_out(int flag); ! /* enable/disable terminal output */ ! ! void glp_term_hook(int (*func)(void *info, const char *s), void *info); ! /* install hook to intercept terminal output */ ! ! void *glp_malloc(int size); ! /* allocate memory block */ ! ! void *glp_calloc(int n, int size); ! /* allocate memory block */ ! ! void glp_free(void *ptr); ! /* free memory block */ ! ! void glp_mem_usage(int *count, int *cpeak, glp_long *total, ! glp_long *tpeak); ! /* get memory usage information */ ! ! void glp_mem_limit(int limit); ! /* set memory usage limit */ ! ! void glp_free_env(void); ! /* free GLPK library environment */ ! ! /**********************************************************************/ ! ! #ifndef GLP_DATA ! #define GLP_DATA ! typedef struct { double _opaque_data; } glp_data; ! /* plain data file */ ! #endif ! ! glp_data *glp_sdf_open_file(const char *fname); ! /* open plain data file */ ! ! void glp_sdf_set_jump(glp_data *data, void *jump); ! /* set up error handling */ ! ! void glp_sdf_error(glp_data *data, const char *fmt, ...); ! /* print error message */ ! ! void glp_sdf_warning(glp_data *data, const char *fmt, ...); ! /* print warning message */ ! ! int glp_sdf_read_int(glp_data *data); ! /* read integer number */ ! ! double glp_sdf_read_num(glp_data *data); ! /* read floating-point number */ ! ! const char *glp_sdf_read_item(glp_data *data); ! /* read data item */ ! ! const char *glp_sdf_read_text(glp_data *data); ! /* read text until end of line */ ! ! int glp_sdf_line(glp_data *data); ! /* determine current line number */ ! ! void glp_sdf_close_file(glp_data *data); ! /* close plain data file */ ! ! /**********************************************************************/ ! ! #define LPX glp_prob ! ! /* problem class: */ ! #define LPX_LP 100 /* linear programming (LP) */ ! #define LPX_MIP 101 /* mixed integer programming (MIP) */ ! ! /* type of auxiliary/structural variable: */ ! #define LPX_FR 110 /* free variable */ ! #define LPX_LO 111 /* variable with lower bound */ ! #define LPX_UP 112 /* variable with upper bound */ ! #define LPX_DB 113 /* double-bounded variable */ ! #define LPX_FX 114 /* fixed variable */ ! ! /* optimization direction flag: */ ! #define LPX_MIN 120 /* minimization */ ! #define LPX_MAX 121 /* maximization */ ! ! /* status of primal basic solution: */ ! #define LPX_P_UNDEF 132 /* primal solution is undefined */ ! #define LPX_P_FEAS 133 /* solution is primal feasible */ ! #define LPX_P_INFEAS 134 /* solution is primal infeasible */ ! #define LPX_P_NOFEAS 135 /* no primal feasible solution exists */ ! ! /* status of dual basic solution: */ ! #define LPX_D_UNDEF 136 /* dual solution is undefined */ ! #define LPX_D_FEAS 137 /* solution is dual feasible */ ! #define LPX_D_INFEAS 138 /* solution is dual infeasible */ ! #define LPX_D_NOFEAS 139 /* no dual feasible solution exists */ ! ! /* status of auxiliary/structural variable: */ ! #define LPX_BS 140 /* basic variable */ ! #define LPX_NL 141 /* non-basic variable on lower bound */ ! #define LPX_NU 142 /* non-basic variable on upper bound */ ! #define LPX_NF 143 /* non-basic free variable */ ! #define LPX_NS 144 /* non-basic fixed variable */ ! ! /* status of interior-point solution: */ ! #define LPX_T_UNDEF 150 /* interior solution is undefined */ ! #define LPX_T_OPT 151 /* interior solution is optimal */ ! ! /* kind of structural variable: */ ! #define LPX_CV 160 /* continuous variable */ ! #define LPX_IV 161 /* integer variable */ ! ! /* status of integer solution: */ ! #define LPX_I_UNDEF 170 /* integer solution is undefined */ ! #define LPX_I_OPT 171 /* integer solution is optimal */ ! #define LPX_I_FEAS 172 /* integer solution is feasible */ ! #define LPX_I_NOFEAS 173 /* no integer solution exists */ ! ! /* status codes reported by the routine lpx_get_status: */ ! #define LPX_OPT 180 /* optimal */ ! #define LPX_FEAS 181 /* feasible */ ! #define LPX_INFEAS 182 /* infeasible */ ! #define LPX_NOFEAS 183 /* no feasible */ ! #define LPX_UNBND 184 /* unbounded */ ! #define LPX_UNDEF 185 /* undefined */ ! ! /* exit codes returned by solver routines: */ ! #define LPX_E_OK 200 /* success */ ! #define LPX_E_EMPTY 201 /* empty problem */ ! #define LPX_E_BADB 202 /* invalid initial basis */ ! #define LPX_E_INFEAS 203 /* infeasible initial solution */ ! #define LPX_E_FAULT 204 /* unable to start the search */ ! #define LPX_E_OBJLL 205 /* objective lower limit reached */ ! #define LPX_E_OBJUL 206 /* objective upper limit reached */ ! #define LPX_E_ITLIM 207 /* iterations limit exhausted */ ! #define LPX_E_TMLIM 208 /* time limit exhausted */ ! #define LPX_E_NOFEAS 209 /* no feasible solution */ ! #define LPX_E_INSTAB 210 /* numerical instability */ ! #define LPX_E_SING 211 /* problems with basis matrix */ ! #define LPX_E_NOCONV 212 /* no convergence (interior) */ ! #define LPX_E_NOPFS 213 /* no primal feas. sol. (LP presolver) */ ! #define LPX_E_NODFS 214 /* no dual feas. sol. (LP presolver) */ ! #define LPX_E_MIPGAP 215 /* relative mip gap tolerance reached */ ! ! /* control parameter identifiers: */ ! #define LPX_K_MSGLEV 300 /* lp->msg_lev */ ! #define LPX_K_SCALE 301 /* lp->scale */ ! #define LPX_K_DUAL 302 /* lp->dual */ ! #define LPX_K_PRICE 303 /* lp->price */ ! #define LPX_K_RELAX 304 /* lp->relax */ ! #define LPX_K_TOLBND 305 /* lp->tol_bnd */ ! #define LPX_K_TOLDJ 306 /* lp->tol_dj */ ! #define LPX_K_TOLPIV 307 /* lp->tol_piv */ ! #define LPX_K_ROUND 308 /* lp->round */ ! #define LPX_K_OBJLL 309 /* lp->obj_ll */ ! #define LPX_K_OBJUL 310 /* lp->obj_ul */ ! #define LPX_K_ITLIM 311 /* lp->it_lim */ ! #define LPX_K_ITCNT 312 /* lp->it_cnt */ ! #define LPX_K_TMLIM 313 /* lp->tm_lim */ ! #define LPX_K_OUTFRQ 314 /* lp->out_frq */ ! #define LPX_K_OUTDLY 315 /* lp->out_dly */ ! #define LPX_K_BRANCH 316 /* lp->branch */ ! #define LPX_K_BTRACK 317 /* lp->btrack */ ! #define LPX_K_TOLINT 318 /* lp->tol_int */ ! #define LPX_K_TOLOBJ 319 /* lp->tol_obj */ ! #define LPX_K_MPSINFO 320 /* lp->mps_info */ ! #define LPX_K_MPSOBJ 321 /* lp->mps_obj */ ! #define LPX_K_MPSORIG 322 /* lp->mps_orig */ ! #define LPX_K_MPSWIDE 323 /* lp->mps_wide */ ! #define LPX_K_MPSFREE 324 /* lp->mps_free */ ! #define LPX_K_MPSSKIP 325 /* lp->mps_skip */ ! #define LPX_K_LPTORIG 326 /* lp->lpt_orig */ ! #define LPX_K_PRESOL 327 /* lp->presol */ ! #define LPX_K_BINARIZE 328 /* lp->binarize */ ! #define LPX_K_USECUTS 329 /* lp->use_cuts */ ! #define LPX_K_BFTYPE 330 /* lp->bfcp->type */ ! #define LPX_K_MIPGAP 331 /* lp->mip_gap */ ! ! #define LPX_C_COVER 0x01 /* mixed cover cuts */ ! #define LPX_C_CLIQUE 0x02 /* clique cuts */ ! #define LPX_C_GOMORY 0x04 /* Gomory's mixed integer cuts */ ! #define LPX_C_MIR 0x08 /* mixed integer rounding cuts */ ! #define LPX_C_ALL 0xFF /* all cuts */ ! ! typedef struct ! { /* this structure contains results reported by the routines which ! checks Karush-Kuhn-Tucker conditions (for details see comments ! to those routines) */ ! /*--------------------------------------------------------------*/ ! /* xR - A * xS = 0 (KKT.PE) */ ! double pe_ae_max; ! /* largest absolute error */ ! int pe_ae_row; ! /* number of row with largest absolute error */ ! double pe_re_max; ! /* largest relative error */ ! int pe_re_row; ! /* number of row with largest relative error */ ! int pe_quality; ! /* quality of primal solution: ! 'H' - high ! 'M' - medium ! 'L' - low ! '?' - primal solution is wrong */ ! /*--------------------------------------------------------------*/ ! /* l[k] <= x[k] <= u[k] (KKT.PB) */ ! double pb_ae_max; ! /* largest absolute error */ ! int pb_ae_ind; ! /* number of variable with largest absolute error */ ! double pb_re_max; ! /* largest relative error */ ! int pb_re_ind; ! /* number of variable with largest relative error */ ! int pb_quality; ! /* quality of primal feasibility: ! 'H' - high ! 'M' - medium ! 'L' - low ! '?' - primal solution is infeasible */ ! /*--------------------------------------------------------------*/ ! /* A' * (dR - cR) + (dS - cS) = 0 (KKT.DE) */ ! double de_ae_max; ! /* largest absolute error */ ! int de_ae_col; ! /* number of column with largest absolute error */ ! double de_re_max; ! /* largest relative error */ ! int de_re_col; ! /* number of column with largest relative error */ ! int de_quality; ! /* quality of dual solution: ! 'H' - high ! 'M' - medium ! 'L' - low ! '?' - dual solution is wrong */ ! /*--------------------------------------------------------------*/ ! /* d[k] >= 0 or d[k] <= 0 (KKT.DB) */ ! double db_ae_max; ! /* largest absolute error */ ! int db_ae_ind; ! /* number of variable with largest absolute error */ ! double db_re_max; ! /* largest relative error */ ! int db_re_ind; ! /* number of variable with largest relative error */ ! int db_quality; ! /* quality of dual feasibility: ! 'H' - high ! 'M' - medium ! 'L' - low ! '?' - dual solution is infeasible */ ! /*--------------------------------------------------------------*/ ! /* (x[k] - bound of x[k]) * d[k] = 0 (KKT.CS) */ ! double cs_ae_max; ! /* largest absolute error */ ! int cs_ae_ind; ! /* number of variable with largest absolute error */ ! double cs_re_max; ! /* largest relative error */ ! int cs_re_ind; ! /* number of variable with largest relative error */ ! int cs_quality; ! /* quality of complementary slackness: ! 'H' - high ! 'M' - medium ! 'L' - low ! '?' - primal and dual solutions are not complementary */ ! } LPXKKT; ! ! #define lpx_create_prob _glp_lpx_create_prob ! LPX *lpx_create_prob(void); ! /* create problem object */ ! ! #define lpx_set_prob_name _glp_lpx_set_prob_name ! void lpx_set_prob_name(LPX *lp, const char *name); ! /* assign (change) problem name */ ! ! #define lpx_set_obj_name _glp_lpx_set_obj_name ! void lpx_set_obj_name(LPX *lp, const char *name); ! /* assign (change) objective function name */ ! ! #define lpx_set_obj_dir _glp_lpx_set_obj_dir ! void lpx_set_obj_dir(LPX *lp, int dir); ! /* set (change) optimization direction flag */ ! ! #define lpx_add_rows _glp_lpx_add_rows ! int lpx_add_rows(LPX *lp, int nrs); ! /* add new rows to problem object */ ! ! #define lpx_add_cols _glp_lpx_add_cols ! int lpx_add_cols(LPX *lp, int ncs); ! /* add new columns to problem object */ ! ! #define lpx_set_row_name _glp_lpx_set_row_name ! void lpx_set_row_name(LPX *lp, int i, const char *name); ! /* assign (change) row name */ ! ! #define lpx_set_col_name _glp_lpx_set_col_name ! void lpx_set_col_name(LPX *lp, int j, const char *name); ! /* assign (change) column name */ ! ! #define lpx_set_row_bnds _glp_lpx_set_row_bnds ! void lpx_set_row_bnds(LPX *lp, int i, int type, double lb, double ub); ! /* set (change) row bounds */ ! ! #define lpx_set_col_bnds _glp_lpx_set_col_bnds ! void lpx_set_col_bnds(LPX *lp, int j, int type, double lb, double ub); ! /* set (change) column bounds */ ! ! #define lpx_set_obj_coef _glp_lpx_set_obj_coef ! void lpx_set_obj_coef(glp_prob *lp, int j, double coef); ! /* set (change) obj. coefficient or constant term */ ! ! #define lpx_set_mat_row _glp_lpx_set_mat_row ! void lpx_set_mat_row(LPX *lp, int i, int len, const int ind[], ! const double val[]); ! /* set (replace) row of the constraint matrix */ ! ! #define lpx_set_mat_col _glp_lpx_set_mat_col ! void lpx_set_mat_col(LPX *lp, int j, int len, const int ind[], ! const double val[]); ! /* set (replace) column of the constraint matrix */ ! ! #define lpx_load_matrix _glp_lpx_load_matrix ! void lpx_load_matrix(LPX *lp, int ne, const int ia[], const int ja[], ! const double ar[]); ! /* load (replace) the whole constraint matrix */ ! ! #define lpx_del_rows _glp_lpx_del_rows ! void lpx_del_rows(LPX *lp, int nrs, const int num[]); ! /* delete specified rows from problem object */ ! ! #define lpx_del_cols _glp_lpx_del_cols ! void lpx_del_cols(LPX *lp, int ncs, const int num[]); ! /* delete specified columns from problem object */ ! ! #define lpx_delete_prob _glp_lpx_delete_prob ! void lpx_delete_prob(LPX *lp); ! /* delete problem object */ ! ! #define lpx_get_prob_name _glp_lpx_get_prob_name ! const char *lpx_get_prob_name(LPX *lp); ! /* retrieve problem name */ ! ! #define lpx_get_obj_name _glp_lpx_get_obj_name ! const char *lpx_get_obj_name(LPX *lp); ! /* retrieve objective function name */ ! ! #define lpx_get_obj_dir _glp_lpx_get_obj_dir ! int lpx_get_obj_dir(LPX *lp); ! /* retrieve optimization direction flag */ ! ! #define lpx_get_num_rows _glp_lpx_get_num_rows ! int lpx_get_num_rows(LPX *lp); ! /* retrieve number of rows */ ! ! #define lpx_get_num_cols _glp_lpx_get_num_cols ! int lpx_get_num_cols(LPX *lp); ! /* retrieve number of columns */ ! ! #define lpx_get_row_name _glp_lpx_get_row_name ! const char *lpx_get_row_name(LPX *lp, int i); ! /* retrieve row name */ ! ! #define lpx_get_col_name _glp_lpx_get_col_name ! const char *lpx_get_col_name(LPX *lp, int j); ! /* retrieve column name */ ! ! #define lpx_get_row_type _glp_lpx_get_row_type ! int lpx_get_row_type(LPX *lp, int i); ! /* retrieve row type */ ! ! #define lpx_get_row_lb _glp_lpx_get_row_lb ! double lpx_get_row_lb(LPX *lp, int i); ! /* retrieve row lower bound */ ! ! #define lpx_get_row_ub _glp_lpx_get_row_ub ! double lpx_get_row_ub(LPX *lp, int i); ! /* retrieve row upper bound */ ! ! #define lpx_get_row_bnds _glp_lpx_get_row_bnds ! void lpx_get_row_bnds(LPX *lp, int i, int *typx, double *lb, ! double *ub); ! /* retrieve row bounds */ ! ! #define lpx_get_col_type _glp_lpx_get_col_type ! int lpx_get_col_type(LPX *lp, int j); ! /* retrieve column type */ ! ! #define lpx_get_col_lb _glp_lpx_get_col_lb ! double lpx_get_col_lb(LPX *lp, int j); ! /* retrieve column lower bound */ ! ! #define lpx_get_col_ub _glp_lpx_get_col_ub ! double lpx_get_col_ub(LPX *lp, int j); ! /* retrieve column upper bound */ ! ! #define lpx_get_col_bnds _glp_lpx_get_col_bnds ! void lpx_get_col_bnds(LPX *lp, int j, int *typx, double *lb, ! double *ub); ! /* retrieve column bounds */ ! ! #define lpx_get_obj_coef _glp_lpx_get_obj_coef ! double lpx_get_obj_coef(LPX *lp, int j); ! /* retrieve obj. coefficient or constant term */ ! ! #define lpx_get_num_nz _glp_lpx_get_num_nz ! int lpx_get_num_nz(LPX *lp); ! /* retrieve number of constraint coefficients */ ! ! #define lpx_get_mat_row _glp_lpx_get_mat_row ! int lpx_get_mat_row(LPX *lp, int i, int ind[], double val[]); ! /* retrieve row of the constraint matrix */ ! ! #define lpx_get_mat_col _glp_lpx_get_mat_col ! int lpx_get_mat_col(LPX *lp, int j, int ind[], double val[]); ! /* retrieve column of the constraint matrix */ ! ! #define lpx_create_index _glp_lpx_create_index ! void lpx_create_index(LPX *lp); ! /* create the name index */ ! ! #define lpx_find_row _glp_lpx_find_row ! int lpx_find_row(LPX *lp, const char *name); ! /* find row by its name */ ! ! #define lpx_find_col _glp_lpx_find_col ! int lpx_find_col(LPX *lp, const char *name); ! /* find column by its name */ ! ! #define lpx_delete_index _glp_lpx_delete_index ! void lpx_delete_index(LPX *lp); ! /* delete the name index */ ! ! #define lpx_scale_prob _glp_lpx_scale_prob ! void lpx_scale_prob(LPX *lp); ! /* scale problem data */ ! ! #define lpx_unscale_prob _glp_lpx_unscale_prob ! void lpx_unscale_prob(LPX *lp); ! /* unscale problem data */ ! ! #define lpx_set_row_stat _glp_lpx_set_row_stat ! void lpx_set_row_stat(LPX *lp, int i, int stat); ! /* set (change) row status */ ! ! #define lpx_set_col_stat _glp_lpx_set_col_stat ! void lpx_set_col_stat(LPX *lp, int j, int stat); ! /* set (change) column status */ ! ! #define lpx_std_basis _glp_lpx_std_basis ! void lpx_std_basis(LPX *lp); ! /* construct standard initial LP basis */ ! ! #define lpx_adv_basis _glp_lpx_adv_basis ! void lpx_adv_basis(LPX *lp); ! /* construct advanced initial LP basis */ ! ! #define lpx_cpx_basis _glp_lpx_cpx_basis ! void lpx_cpx_basis(LPX *lp); ! /* construct Bixby's initial LP basis */ ! ! #define lpx_simplex _glp_lpx_simplex ! int lpx_simplex(LPX *lp); ! /* easy-to-use driver to the simplex method */ ! ! #define lpx_exact _glp_lpx_exact ! int lpx_exact(LPX *lp); ! /* easy-to-use driver to the exact simplex method */ ! ! #define lpx_get_status _glp_lpx_get_status ! int lpx_get_status(LPX *lp); ! /* retrieve generic status of basic solution */ ! ! #define lpx_get_prim_stat _glp_lpx_get_prim_stat ! int lpx_get_prim_stat(LPX *lp); ! /* retrieve primal status of basic solution */ ! ! #define lpx_get_dual_stat _glp_lpx_get_dual_stat ! int lpx_get_dual_stat(LPX *lp); ! /* retrieve dual status of basic solution */ ! ! #define lpx_get_obj_val _glp_lpx_get_obj_val ! double lpx_get_obj_val(LPX *lp); ! /* retrieve objective value (basic solution) */ ! ! #define lpx_get_row_stat _glp_lpx_get_row_stat ! int lpx_get_row_stat(LPX *lp, int i); ! /* retrieve row status (basic solution) */ ! ! #define lpx_get_row_prim _glp_lpx_get_row_prim ! double lpx_get_row_prim(LPX *lp, int i); ! /* retrieve row primal value (basic solution) */ ! ! #define lpx_get_row_dual _glp_lpx_get_row_dual ! double lpx_get_row_dual(LPX *lp, int i); ! /* retrieve row dual value (basic solution) */ ! ! #define lpx_get_row_info _glp_lpx_get_row_info ! void lpx_get_row_info(LPX *lp, int i, int *tagx, double *vx, ! double *dx); ! /* obtain row solution information */ ! ! #define lpx_get_col_stat _glp_lpx_get_col_stat ! int lpx_get_col_stat(LPX *lp, int j); ! /* retrieve column status (basic solution) */ ! ! #define lpx_get_col_prim _glp_lpx_get_col_prim ! double lpx_get_col_prim(LPX *lp, int j); ! /* retrieve column primal value (basic solution) */ ! ! #define lpx_get_col_dual _glp_lpx_get_col_dual ! double lpx_get_col_dual(glp_prob *lp, int j); ! /* retrieve column dual value (basic solution) */ ! ! #define lpx_get_col_info _glp_lpx_get_col_info ! void lpx_get_col_info(LPX *lp, int j, int *tagx, double *vx, ! double *dx); ! /* obtain column solution information (obsolete) */ ! ! #define lpx_get_ray_info _glp_lpx_get_ray_info ! int lpx_get_ray_info(LPX *lp); ! /* determine what causes primal unboundness */ ! ! #define lpx_check_kkt _glp_lpx_check_kkt ! void lpx_check_kkt(LPX *lp, int scaled, LPXKKT *kkt); ! /* check Karush-Kuhn-Tucker conditions */ ! ! #define lpx_warm_up _glp_lpx_warm_up ! int lpx_warm_up(LPX *lp); ! /* "warm up" LP basis */ ! ! #define lpx_eval_tab_row _glp_lpx_eval_tab_row ! int lpx_eval_tab_row(LPX *lp, int k, int ind[], double val[]); ! /* compute row of the simplex table */ ! ! #define lpx_eval_tab_col _glp_lpx_eval_tab_col ! int lpx_eval_tab_col(LPX *lp, int k, int ind[], double val[]); ! /* compute column of the simplex table */ ! ! #define lpx_transform_row _glp_lpx_transform_row ! int lpx_transform_row(LPX *lp, int len, int ind[], double val[]); ! /* transform explicitly specified row */ ! ! #define lpx_transform_col _glp_lpx_transform_col ! int lpx_transform_col(LPX *lp, int len, int ind[], double val[]); ! /* transform explicitly specified column */ ! ! #define lpx_prim_ratio_test _glp_lpx_prim_ratio_test ! int lpx_prim_ratio_test(LPX *lp, int len, const int ind[], ! const double val[], int how, double tol); ! /* perform primal ratio test */ ! ! #define lpx_dual_ratio_test _glp_lpx_dual_ratio_test ! int lpx_dual_ratio_test(LPX *lp, int len, const int ind[], ! const double val[], int how, double tol); ! /* perform dual ratio test */ ! ! #define lpx_interior _glp_lpx_interior ! int lpx_interior(LPX *lp); ! /* easy-to-use driver to the interior point method */ ! ! #define lpx_ipt_status _glp_lpx_ipt_status ! int lpx_ipt_status(LPX *lp); ! /* retrieve status of interior-point solution */ ! ! #define lpx_ipt_obj_val _glp_lpx_ipt_obj_val ! double lpx_ipt_obj_val(LPX *lp); ! /* retrieve objective value (interior point) */ ! ! #define lpx_ipt_row_prim _glp_lpx_ipt_row_prim ! double lpx_ipt_row_prim(LPX *lp, int i); ! /* retrieve row primal value (interior point) */ ! ! #define lpx_ipt_row_dual _glp_lpx_ipt_row_dual ! double lpx_ipt_row_dual(LPX *lp, int i); ! /* retrieve row dual value (interior point) */ ! ! #define lpx_ipt_col_prim _glp_lpx_ipt_col_prim ! double lpx_ipt_col_prim(LPX *lp, int j); ! /* retrieve column primal value (interior point) */ ! ! #define lpx_ipt_col_dual _glp_lpx_ipt_col_dual ! double lpx_ipt_col_dual(LPX *lp, int j); ! /* retrieve column dual value (interior point) */ ! ! #define lpx_set_class _glp_lpx_set_class ! void lpx_set_class(LPX *lp, int klass); ! /* set problem class */ ! ! #define lpx_get_class _glp_lpx_get_class ! int lpx_get_class(LPX *lp); ! /* determine problem klass */ ! ! #define lpx_set_col_kind _glp_lpx_set_col_kind ! void lpx_set_col_kind(LPX *lp, int j, int kind); ! /* set (change) column kind */ ! ! #define lpx_get_col_kind _glp_lpx_get_col_kind ! int lpx_get_col_kind(LPX *lp, int j); ! /* retrieve column kind */ ! ! #define lpx_get_num_int _glp_lpx_get_num_int ! int lpx_get_num_int(LPX *lp); ! /* retrieve number of integer columns */ ! ! #define lpx_get_num_bin _glp_lpx_get_num_bin ! int lpx_get_num_bin(LPX *lp); ! /* retrieve number of binary columns */ ! ! #define lpx_integer _glp_lpx_integer ! int lpx_integer(LPX *lp); ! /* easy-to-use driver to the branch-and-bound method */ ! ! #define lpx_intopt _glp_lpx_intopt ! int lpx_intopt(LPX *lp); ! /* easy-to-use driver to the branch-and-bound method */ ! ! #define lpx_mip_status _glp_lpx_mip_status ! int lpx_mip_status(LPX *lp); ! /* retrieve status of MIP solution */ ! ! #define lpx_mip_obj_val _glp_lpx_mip_obj_val ! double lpx_mip_obj_val(LPX *lp); ! /* retrieve objective value (MIP solution) */ ! ! #define lpx_mip_row_val _glp_lpx_mip_row_val ! double lpx_mip_row_val(LPX *lp, int i); ! /* retrieve row value (MIP solution) */ ! ! #define lpx_mip_col_val _glp_lpx_mip_col_val ! double lpx_mip_col_val(LPX *lp, int j); ! /* retrieve column value (MIP solution) */ ! ! #define lpx_check_int _glp_lpx_check_int ! void lpx_check_int(LPX *lp, LPXKKT *kkt); ! /* check integer feasibility conditions */ ! ! #define lpx_reset_parms _glp_lpx_reset_parms ! void lpx_reset_parms(LPX *lp); ! /* reset control parameters to default values */ ! ! #define lpx_set_int_parm _glp_lpx_set_int_parm ! void lpx_set_int_parm(LPX *lp, int parm, int val); ! /* set (change) integer control parameter */ ! ! #define lpx_get_int_parm _glp_lpx_get_int_parm ! int lpx_get_int_parm(LPX *lp, int parm); ! /* query integer control parameter */ ! ! #define lpx_set_real_parm _glp_lpx_set_real_parm ! void lpx_set_real_parm(LPX *lp, int parm, double val); ! /* set (change) real control parameter */ ! ! #define lpx_get_real_parm _glp_lpx_get_real_parm ! double lpx_get_real_parm(LPX *lp, int parm); ! /* query real control parameter */ ! ! #define lpx_read_mps _glp_lpx_read_mps ! LPX *lpx_read_mps(const char *fname); ! /* read problem data in fixed MPS format */ ! ! #define lpx_write_mps _glp_lpx_write_mps ! int lpx_write_mps(LPX *lp, const char *fname); ! /* write problem data in fixed MPS format */ ! ! #define lpx_read_bas _glp_lpx_read_bas ! int lpx_read_bas(LPX *lp, const char *fname); ! /* read LP basis in fixed MPS format */ ! ! #define lpx_write_bas _glp_lpx_write_bas ! int lpx_write_bas(LPX *lp, const char *fname); ! /* write LP basis in fixed MPS format */ ! ! #define lpx_read_freemps _glp_lpx_read_freemps ! LPX *lpx_read_freemps(const char *fname); ! /* read problem data in free MPS format */ ! ! #define lpx_write_freemps _glp_lpx_write_freemps ! int lpx_write_freemps(LPX *lp, const char *fname); ! /* write problem data in free MPS format */ ! ! #define lpx_read_cpxlp _glp_lpx_read_cpxlp ! LPX *lpx_read_cpxlp(const char *fname); ! /* read problem data in CPLEX LP format */ ! ! #define lpx_write_cpxlp _glp_lpx_write_cpxlp ! int lpx_write_cpxlp(LPX *lp, const char *fname); ! /* write problem data in CPLEX LP format */ ! ! #define lpx_read_model _glp_lpx_read_model ! LPX *lpx_read_model(const char *model, const char *data, ! const char *output); ! /* read LP/MIP model written in GNU MathProg language */ ! ! #define lpx_print_prob _glp_lpx_print_prob ! int lpx_print_prob(LPX *lp, const char *fname); ! /* write problem data in plain text format */ ! ! #define lpx_print_sol _glp_lpx_print_sol ! int lpx_print_sol(LPX *lp, const char *fname); ! /* write LP problem solution in printable format */ ! ! #define lpx_print_sens_bnds _glp_lpx_print_sens_bnds ! int lpx_print_sens_bnds(LPX *lp, const char *fname); ! /* write bounds sensitivity information */ ! ! #define lpx_print_ips _glp_lpx_print_ips ! int lpx_print_ips(LPX *lp, const char *fname); ! /* write interior point solution in printable format */ ! ! #define lpx_print_mip _glp_lpx_print_mip ! int lpx_print_mip(LPX *lp, const char *fname); ! /* write MIP problem solution in printable format */ ! ! #define lpx_is_b_avail _glp_lpx_is_b_avail ! int lpx_is_b_avail(LPX *lp); ! /* check if LP basis is available */ ! ! #define lpx_write_pb _glp_lpx_write_pb ! int lpx_write_pb(LPX *lp, const char *fname, int normalized, ! int binarize); ! /* write problem data in (normalized) OPB format */ ! ! #define lpx_main _glp_lpx_main ! int lpx_main(int argc, const char *argv[]); ! /* stand-alone LP/MIP solver */ ! ! #ifdef __cplusplus ! } ! #endif ! ! #endif ! ! /* eof */ --- 1,1696 ---- ! /* glpk.h */ ! ! /*********************************************************************** ! * This code is part of GLPK (GNU Linear Programming Kit). ! * ! * Copyright (C) 2000,01,02,03,04,05,06,07,08,2009 Andrew Makhorin, ! * Department for Applied Informatics, Moscow Aviation Institute, ! * Moscow, Russia. All rights reserved. E-mail: . ! * ! * GLPK is free software: you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by ! * the Free Software Foundation, either version 3 of the License, or ! * (at your option) any later version. ! * ! * GLPK is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ! * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ! * License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with GLPK. If not, see . ! ***********************************************************************/ ! ! #ifndef GLPK_H ! #define GLPK_H ! ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! #include ! #include ! ! /* library version numbers: */ ! #define GLP_MAJOR_VERSION 4 ! #define GLP_MINOR_VERSION 39 ! ! #ifndef GLP_PROB ! #define GLP_PROB ! typedef struct { double _opaque_prob; } glp_prob; ! /* LP/MIP problem object */ ! #endif ! ! /* optimization direction flag: */ ! #define GLP_MIN 1 /* minimization */ ! #define GLP_MAX 2 /* maximization */ ! ! /* kind of structural variable: */ ! #define GLP_CV 1 /* continuous variable */ ! #define GLP_IV 2 /* integer variable */ ! #define GLP_BV 3 /* binary variable */ ! ! /* type of auxiliary/structural variable: */ ! #define GLP_FR 1 /* free variable */ ! #define GLP_LO 2 /* variable with lower bound */ ! #define GLP_UP 3 /* variable with upper bound */ ! #define GLP_DB 4 /* double-bounded variable */ ! #define GLP_FX 5 /* fixed variable */ ! ! /* status of auxiliary/structural variable: */ ! #define GLP_BS 1 /* basic variable */ ! #define GLP_NL 2 /* non-basic variable on lower bound */ ! #define GLP_NU 3 /* non-basic variable on upper bound */ ! #define GLP_NF 4 /* non-basic free variable */ ! #define GLP_NS 5 /* non-basic fixed variable */ ! ! /* scaling options: */ ! #define GLP_SF_GM 0x01 /* perform geometric mean scaling */ ! #define GLP_SF_EQ 0x10 /* perform equilibration scaling */ ! #define GLP_SF_2N 0x20 /* round scale factors to power of two */ ! #define GLP_SF_SKIP 0x40 /* skip if problem is well scaled */ ! #define GLP_SF_AUTO 0x80 /* choose scaling options automatically */ ! ! /* solution indicator: */ ! #define GLP_SOL 1 /* basic solution */ ! #define GLP_IPT 2 /* interior-point solution */ ! #define GLP_MIP 3 /* mixed integer solution */ ! ! /* solution status: */ ! #define GLP_UNDEF 1 /* solution is undefined */ ! #define GLP_FEAS 2 /* solution is feasible */ ! #define GLP_INFEAS 3 /* solution is infeasible */ ! #define GLP_NOFEAS 4 /* no feasible solution exists */ ! #define GLP_OPT 5 /* solution is optimal */ ! #define GLP_UNBND 6 /* solution is unbounded */ ! ! #ifndef GLP_BFCP ! #define GLP_BFCP ! typedef struct glp_bfcp glp_bfcp; ! #endif ! ! struct glp_bfcp ! { /* basis factorization control parameters */ ! int msg_lev; /* (reserved) */ ! int type; /* factorization type: */ ! #define GLP_BF_FT 1 /* LUF + Forrest-Tomlin */ ! #define GLP_BF_BG 2 /* LUF + Schur compl. + Bartels-Golub */ ! #define GLP_BF_GR 3 /* LUF + Schur compl. + Givens rotation */ ! int lu_size; /* luf.sv_size */ ! double piv_tol; /* luf.piv_tol */ ! int piv_lim; /* luf.piv_lim */ ! int suhl; /* luf.suhl */ ! double eps_tol; /* luf.eps_tol */ ! double max_gro; /* luf.max_gro */ ! int nfs_max; /* fhv.hh_max */ ! double upd_tol; /* fhv.upd_tol */ ! int nrs_max; /* lpf.n_max */ ! int rs_size; /* lpf.v_size */ ! double foo_bar[38]; /* (reserved) */ ! }; ! ! typedef struct ! { /* simplex method control parameters */ ! int msg_lev; /* message level: */ ! #define GLP_MSG_OFF 0 /* no output */ ! #define GLP_MSG_ERR 1 /* warning and error messages only */ ! #define GLP_MSG_ON 2 /* normal output */ ! #define GLP_MSG_ALL 3 /* full output */ ! #define GLP_MSG_DBG 4 /* debug output */ ! int meth; /* simplex method option: */ ! #define GLP_PRIMAL 1 /* use primal simplex */ ! #define GLP_DUALP 2 /* use dual; if it fails, use primal */ ! #define GLP_DUAL 3 /* use dual simplex */ ! int pricing; /* pricing technique: */ ! #define GLP_PT_STD 0x11 /* standard (Dantzig rule) */ ! #define GLP_PT_PSE 0x22 /* projected steepest edge */ ! int r_test; /* ratio test technique: */ ! #define GLP_RT_STD 0x11 /* standard (textbook) */ ! #define GLP_RT_HAR 0x22 /* two-pass Harris' ratio test */ ! double tol_bnd; /* spx.tol_bnd */ ! double tol_dj; /* spx.tol_dj */ ! double tol_piv; /* spx.tol_piv */ ! double obj_ll; /* spx.obj_ll */ ! double obj_ul; /* spx.obj_ul */ ! int it_lim; /* spx.it_lim */ ! int tm_lim; /* spx.tm_lim (milliseconds) */ ! int out_frq; /* spx.out_frq */ ! int out_dly; /* spx.out_dly (milliseconds) */ ! int presolve; /* enable/disable using LP presolver */ ! double foo_bar[36]; /* (reserved) */ ! } glp_smcp; ! ! typedef struct ! { /* interior-point solver control parameters */ ! int msg_lev; /* message level (see glp_smcp) */ ! int ord_alg; /* ordering algorithm: */ ! #define GLP_ORD_NONE 0 /* natural (original) ordering */ ! #define GLP_ORD_QMD 1 /* quotient minimum degree (QMD) */ ! #define GLP_ORD_AMD 2 /* approx. minimum degree (AMD) */ ! #define GLP_ORD_SYMAMD 3 /* approx. minimum degree (SYMAMD) */ ! double foo_bar[48]; /* (reserved) */ ! } glp_iptcp; ! ! #ifndef GLP_TREE ! #define GLP_TREE ! typedef struct { double _opaque_tree; } glp_tree; ! /* branch-and-bound tree */ ! #endif ! ! typedef struct ! { /* integer optimizer control parameters */ ! int msg_lev; /* message level (see glp_smcp) */ ! int br_tech; /* branching technique: */ ! #define GLP_BR_FFV 1 /* first fractional variable */ ! #define GLP_BR_LFV 2 /* last fractional variable */ ! #define GLP_BR_MFV 3 /* most fractional variable */ ! #define GLP_BR_DTH 4 /* heuristic by Driebeck and Tomlin */ ! #define GLP_BR_HPC 5 /* hybrid pseudocost */ ! int bt_tech; /* backtracking technique: */ ! #define GLP_BT_DFS 1 /* depth first search */ ! #define GLP_BT_BFS 2 /* breadth first search */ ! #define GLP_BT_BLB 3 /* best local bound */ ! #define GLP_BT_BPH 4 /* best projection heuristic */ ! double tol_int; /* mip.tol_int */ ! double tol_obj; /* mip.tol_obj */ ! int tm_lim; /* mip.tm_lim (milliseconds) */ ! int out_frq; /* mip.out_frq (milliseconds) */ ! int out_dly; /* mip.out_dly (milliseconds) */ ! void (*cb_func)(glp_tree *T, void *info); ! /* mip.cb_func */ ! void *cb_info; /* mip.cb_info */ ! int cb_size; /* mip.cb_size */ ! int pp_tech; /* preprocessing technique: */ ! #define GLP_PP_NONE 0 /* disable preprocessing */ ! #define GLP_PP_ROOT 1 /* preprocessing only on root level */ ! #define GLP_PP_ALL 2 /* preprocessing on all levels */ ! double mip_gap; /* relative MIP gap tolerance */ ! int mir_cuts; /* MIR cuts (GLP_ON/GLP_OFF) */ ! int gmi_cuts; /* Gomory's cuts (GLP_ON/GLP_OFF) */ ! int cov_cuts; /* cover cuts (GLP_ON/GLP_OFF) */ ! int clq_cuts; /* clique cuts (GLP_ON/GLP_OFF) */ ! int presolve; /* enable/disable using MIP presolver */ ! int binarize; /* try to binarize integer variables */ ! int fp_heur; /* feasibility pump heuristic */ ! double foo_bar[30]; /* (reserved) */ ! } glp_iocp; ! ! typedef struct ! { /* additional row attributes */ ! int level; ! /* subproblem level at which the row was added */ ! int origin; ! /* the row origin flag: */ ! #define GLP_RF_REG 0 /* regular constraint */ ! #define GLP_RF_LAZY 1 /* "lazy" constraint */ ! #define GLP_RF_CUT 2 /* cutting plane constraint */ ! int klass; ! /* the row class descriptor: */ ! #define GLP_RF_GMI 1 /* Gomory's mixed integer cut */ ! #define GLP_RF_MIR 2 /* mixed integer rounding cut */ ! #define GLP_RF_COV 3 /* mixed cover cut */ ! #define GLP_RF_CLQ 4 /* clique cut */ ! double foo_bar[7]; ! /* (reserved) */ ! } glp_attr; ! ! /* enable/disable flag: */ ! #define GLP_ON 1 /* enable something */ ! #define GLP_OFF 0 /* disable something */ ! ! /* reason codes: */ ! #define GLP_IROWGEN 0x01 /* request for row generation */ ! #define GLP_IBINGO 0x02 /* better integer solution found */ ! #define GLP_IHEUR 0x03 /* request for heuristic solution */ ! #define GLP_ICUTGEN 0x04 /* request for cut generation */ ! #define GLP_IBRANCH 0x05 /* request for branching */ ! #define GLP_ISELECT 0x06 /* request for subproblem selection */ ! #define GLP_IPREPRO 0x07 /* request for preprocessing */ ! ! /* branch selection indicator: */ ! #define GLP_NO_BRNCH 0 /* select no branch */ ! #define GLP_DN_BRNCH 1 /* select down-branch */ ! #define GLP_UP_BRNCH 2 /* select up-branch */ ! ! /* return codes: */ ! #define GLP_EBADB 0x01 /* invalid basis */ ! #define GLP_ESING 0x02 /* singular matrix */ ! #define GLP_ECOND 0x03 /* ill-conditioned matrix */ ! #define GLP_EBOUND 0x04 /* invalid bounds */ ! #define GLP_EFAIL 0x05 /* solver failed */ ! #define GLP_EOBJLL 0x06 /* objective lower limit reached */ ! #define GLP_EOBJUL 0x07 /* objective upper limit reached */ ! #define GLP_EITLIM 0x08 /* iteration limit exceeded */ ! #define GLP_ETMLIM 0x09 /* time limit exceeded */ ! #define GLP_ENOPFS 0x0A /* no primal feasible solution */ ! #define GLP_ENODFS 0x0B /* no dual feasible solution */ ! #define GLP_EROOT 0x0C /* root LP optimum not provided */ ! #define GLP_ESTOP 0x0D /* search terminated by application */ ! #define GLP_EMIPGAP 0x0E /* relative mip gap tolerance reached */ ! #define GLP_ENOFEAS 0x0F /* no primal/dual feasible solution */ ! #define GLP_ENOCVG 0x10 /* no convergence */ ! #define GLP_EINSTAB 0x11 /* numerical instability */ ! #define GLP_EDATA 0x12 /* invalid data */ ! #define GLP_ERANGE 0x13 /* result out of range */ ! ! /* condition indicator: */ ! #define GLP_KKT_PE 1 /* primal equalities */ ! #define GLP_KKT_PB 2 /* primal bounds */ ! #define GLP_KKT_DE 3 /* dual equalities */ ! #define GLP_KKT_DB 4 /* dual bounds */ ! #define GLP_KKT_CS 5 /* complementary slackness */ ! ! /* MPS file format: */ ! #define GLP_MPS_DECK 1 /* fixed (ancient) */ ! #define GLP_MPS_FILE 2 /* free (modern) */ ! ! typedef struct ! { /* MPS format control parameters */ ! int blank; ! /* character code to replace blanks in symbolic names */ ! char *obj_name; ! /* objective row name */ ! double tol_mps; ! /* zero tolerance for MPS data */ ! double foo_bar[17]; ! /* (reserved for use in the future) */ ! } glp_mpscp; ! ! typedef struct ! { /* CPLEX LP format control parameters */ ! double foo_bar[20]; ! /* (reserved for use in the future) */ ! } glp_cpxcp; ! ! #ifndef GLP_TRAN ! #define GLP_TRAN ! typedef struct { double _opaque_tran; } glp_tran; ! /* MathProg translator workspace */ ! #endif ! ! glp_prob *glp_create_prob(void); ! /* create problem object */ ! ! void glp_set_prob_name(glp_prob *P, const char *name); ! /* assign (change) problem name */ ! ! void glp_set_obj_name(glp_prob *P, const char *name); ! /* assign (change) objective function name */ ! ! void glp_set_obj_dir(glp_prob *P, int dir); ! /* set (change) optimization direction flag */ ! ! int glp_add_rows(glp_prob *P, int nrs); ! /* add new rows to problem object */ ! ! int glp_add_cols(glp_prob *P, int ncs); ! /* add new columns to problem object */ ! ! void glp_set_row_name(glp_prob *P, int i, const char *name); ! /* assign (change) row name */ ! ! void glp_set_col_name(glp_prob *P, int j, const char *name); ! /* assign (change) column name */ ! ! void glp_set_row_bnds(glp_prob *P, int i, int type, double lb, ! double ub); ! /* set (change) row bounds */ ! ! void glp_set_col_bnds(glp_prob *P, int j, int type, double lb, ! double ub); ! /* set (change) column bounds */ ! ! void glp_set_obj_coef(glp_prob *P, int j, double coef); ! /* set (change) obj. coefficient or constant term */ ! ! void glp_set_mat_row(glp_prob *P, int i, int len, const int ind[], ! const double val[]); ! /* set (replace) row of the constraint matrix */ ! ! void glp_set_mat_col(glp_prob *P, int j, int len, const int ind[], ! const double val[]); ! /* set (replace) column of the constraint matrix */ ! ! void glp_load_matrix(glp_prob *P, int ne, const int ia[], ! const int ja[], const double ar[]); ! /* load (replace) the whole constraint matrix */ ! ! void glp_del_rows(glp_prob *P, int nrs, const int num[]); ! /* delete specified rows from problem object */ ! ! void glp_del_cols(glp_prob *P, int ncs, const int num[]); ! /* delete specified columns from problem object */ ! ! void glp_copy_prob(glp_prob *dest, glp_prob *prob, int names); ! /* copy problem object content */ ! ! void glp_erase_prob(glp_prob *P); ! /* erase problem object content */ ! ! void glp_delete_prob(glp_prob *P); ! /* delete problem object */ ! ! const char *glp_get_prob_name(glp_prob *P); ! /* retrieve problem name */ ! ! const char *glp_get_obj_name(glp_prob *P); ! /* retrieve objective function name */ ! ! int glp_get_obj_dir(glp_prob *P); ! /* retrieve optimization direction flag */ ! ! int glp_get_num_rows(glp_prob *P); ! /* retrieve number of rows */ ! ! int glp_get_num_cols(glp_prob *P); ! /* retrieve number of columns */ ! ! const char *glp_get_row_name(glp_prob *P, int i); ! /* retrieve row name */ ! ! const char *glp_get_col_name(glp_prob *P, int j); ! /* retrieve column name */ ! ! int glp_get_row_type(glp_prob *P, int i); ! /* retrieve row type */ ! ! double glp_get_row_lb(glp_prob *P, int i); ! /* retrieve row lower bound */ ! ! double glp_get_row_ub(glp_prob *P, int i); ! /* retrieve row upper bound */ ! ! int glp_get_col_type(glp_prob *P, int j); ! /* retrieve column type */ ! ! double glp_get_col_lb(glp_prob *P, int j); ! /* retrieve column lower bound */ ! ! double glp_get_col_ub(glp_prob *P, int j); ! /* retrieve column upper bound */ ! ! double glp_get_obj_coef(glp_prob *P, int j); ! /* retrieve obj. coefficient or constant term */ ! ! int glp_get_num_nz(glp_prob *P); ! /* retrieve number of constraint coefficients */ ! ! int glp_get_mat_row(glp_prob *P, int i, int ind[], double val[]); ! /* retrieve row of the constraint matrix */ ! ! int glp_get_mat_col(glp_prob *P, int j, int ind[], double val[]); ! /* retrieve column of the constraint matrix */ ! ! void glp_create_index(glp_prob *P); ! /* create the name index */ ! ! int glp_find_row(glp_prob *P, const char *name); ! /* find row by its name */ ! ! int glp_find_col(glp_prob *P, const char *name); ! /* find column by its name */ ! ! void glp_delete_index(glp_prob *P); ! /* delete the name index */ ! ! void glp_set_rii(glp_prob *P, int i, double rii); ! /* set (change) row scale factor */ ! ! void glp_set_sjj(glp_prob *P, int j, double sjj); ! /* set (change) column scale factor */ ! ! double glp_get_rii(glp_prob *P, int i); ! /* retrieve row scale factor */ ! ! double glp_get_sjj(glp_prob *P, int j); ! /* retrieve column scale factor */ ! ! void glp_scale_prob(glp_prob *P, int flags); ! /* scale problem data */ ! ! void glp_unscale_prob(glp_prob *P); ! /* unscale problem data */ ! ! void glp_set_row_stat(glp_prob *P, int i, int stat); ! /* set (change) row status */ ! ! void glp_set_col_stat(glp_prob *P, int j, int stat); ! /* set (change) column status */ ! ! void glp_std_basis(glp_prob *P); ! /* construct standard initial LP basis */ ! ! void glp_adv_basis(glp_prob *P, int flags); ! /* construct advanced initial LP basis */ ! ! void glp_cpx_basis(glp_prob *P); ! /* construct Bixby's initial LP basis */ ! ! int glp_simplex(glp_prob *P, const glp_smcp *parm); ! /* solve LP problem with the simplex method */ ! ! int glp_exact(glp_prob *P, const glp_smcp *parm); ! /* solve LP problem in exact arithmetic */ ! ! void glp_init_smcp(glp_smcp *parm); ! /* initialize simplex method control parameters */ ! ! int glp_get_status(glp_prob *P); ! /* retrieve generic status of basic solution */ ! ! int glp_get_prim_stat(glp_prob *P); ! /* retrieve status of primal basic solution */ ! ! int glp_get_dual_stat(glp_prob *P); ! /* retrieve status of dual basic solution */ ! ! double glp_get_obj_val(glp_prob *P); ! /* retrieve objective value (basic solution) */ ! ! int glp_get_row_stat(glp_prob *P, int i); ! /* retrieve row status */ ! ! double glp_get_row_prim(glp_prob *P, int i); ! /* retrieve row primal value (basic solution) */ ! ! double glp_get_row_dual(glp_prob *P, int i); ! /* retrieve row dual value (basic solution) */ ! ! int glp_get_col_stat(glp_prob *P, int j); ! /* retrieve column status */ ! ! double glp_get_col_prim(glp_prob *P, int j); ! /* retrieve column primal value (basic solution) */ ! ! double glp_get_col_dual(glp_prob *P, int j); ! /* retrieve column dual value (basic solution) */ ! ! int glp_get_unbnd_ray(glp_prob *P); ! /* determine variable causing unboundedness */ ! ! int glp_interior(glp_prob *P, const glp_iptcp *parm); ! /* solve LP problem with the interior-point method */ ! ! void glp_init_iptcp(glp_iptcp *parm); ! /* initialize interior-point solver control parameters */ ! ! int glp_ipt_status(glp_prob *P); ! /* retrieve status of interior-point solution */ ! ! double glp_ipt_obj_val(glp_prob *P); ! /* retrieve objective value (interior point) */ ! ! double glp_ipt_row_prim(glp_prob *P, int i); ! /* retrieve row primal value (interior point) */ ! ! double glp_ipt_row_dual(glp_prob *P, int i); ! /* retrieve row dual value (interior point) */ ! ! double glp_ipt_col_prim(glp_prob *P, int j); ! /* retrieve column primal value (interior point) */ ! ! double glp_ipt_col_dual(glp_prob *P, int j); ! /* retrieve column dual value (interior point) */ ! ! void glp_set_col_kind(glp_prob *P, int j, int kind); ! /* set (change) column kind */ ! ! int glp_get_col_kind(glp_prob *P, int j); ! /* retrieve column kind */ ! ! int glp_get_num_int(glp_prob *P); ! /* retrieve number of integer columns */ ! ! int glp_get_num_bin(glp_prob *P); ! /* retrieve number of binary columns */ ! ! int glp_intopt(glp_prob *P, const glp_iocp *parm); ! /* solve MIP problem with the branch-and-bound method */ ! ! void glp_init_iocp(glp_iocp *parm); ! /* initialize integer optimizer control parameters */ ! ! int glp_mip_status(glp_prob *P); ! /* retrieve status of MIP solution */ ! ! double glp_mip_obj_val(glp_prob *P); ! /* retrieve objective value (MIP solution) */ ! ! double glp_mip_row_val(glp_prob *P, int i); ! /* retrieve row value (MIP solution) */ ! ! double glp_mip_col_val(glp_prob *P, int j); ! /* retrieve column value (MIP solution) */ ! ! int glp_print_sol(glp_prob *P, const char *fname); ! /* write basic solution in printable format */ ! ! int glp_read_sol(glp_prob *P, const char *fname); ! /* read basic solution from text file */ ! ! int glp_write_sol(glp_prob *P, const char *fname); ! /* write basic solution to text file */ ! ! int glp_print_ipt(glp_prob *P, const char *fname); ! /* write interior-point solution in printable format */ ! ! int glp_read_ipt(glp_prob *P, const char *fname); ! /* read interior-point solution from text file */ ! ! int glp_write_ipt(glp_prob *P, const char *fname); ! /* write interior-point solution to text file */ ! ! int glp_print_mip(glp_prob *P, const char *fname); ! /* write MIP solution in printable format */ ! ! int glp_read_mip(glp_prob *P, const char *fname); ! /* read MIP solution from text file */ ! ! int glp_write_mip(glp_prob *P, const char *fname); ! /* write MIP solution to text file */ ! ! int glp_bf_exists(glp_prob *P); ! /* check if the basis factorization exists */ ! ! int glp_factorize(glp_prob *P); ! /* compute the basis factorization */ ! ! int glp_bf_updated(glp_prob *P); ! /* check if the basis factorization has been updated */ ! ! void glp_get_bfcp(glp_prob *P, glp_bfcp *parm); ! /* retrieve basis factorization control parameters */ ! ! void glp_set_bfcp(glp_prob *P, const glp_bfcp *parm); ! /* change basis factorization control parameters */ ! ! int glp_get_bhead(glp_prob *P, int k); ! /* retrieve the basis header information */ ! ! int glp_get_row_bind(glp_prob *P, int i); ! /* retrieve row index in the basis header */ ! ! int glp_get_col_bind(glp_prob *P, int j); ! /* retrieve column index in the basis header */ ! ! void glp_ftran(glp_prob *P, double x[]); ! /* perform forward transformation (solve system B*x = b) */ ! ! void glp_btran(glp_prob *P, double x[]); ! /* perform backward transformation (solve system B'*x = b) */ ! ! int glp_warm_up(glp_prob *P); ! /* "warm up" LP basis */ ! ! int glp_eval_tab_row(glp_prob *P, int k, int ind[], double val[]); ! /* compute row of the simplex tableau */ ! ! int glp_eval_tab_col(glp_prob *P, int k, int ind[], double val[]); ! /* compute column of the simplex tableau */ ! ! int glp_ios_reason(glp_tree *T); ! /* determine reason for calling the callback routine */ ! ! glp_prob *glp_ios_get_prob(glp_tree *T); ! /* access the problem object */ ! ! void glp_ios_tree_size(glp_tree *T, int *a_cnt, int *n_cnt, ! int *t_cnt); ! /* determine size of the branch-and-bound tree */ ! ! int glp_ios_curr_node(glp_tree *T); ! /* determine current active subproblem */ ! ! int glp_ios_next_node(glp_tree *T, int p); ! /* determine next active subproblem */ ! ! int glp_ios_prev_node(glp_tree *T, int p); ! /* determine previous active subproblem */ ! ! int glp_ios_up_node(glp_tree *T, int p); ! /* determine parent subproblem */ ! ! int glp_ios_node_level(glp_tree *T, int p); ! /* determine subproblem level */ ! ! double glp_ios_node_bound(glp_tree *T, int p); ! /* determine subproblem local bound */ ! ! int glp_ios_best_node(glp_tree *T); ! /* find active subproblem with best local bound */ ! ! double glp_ios_mip_gap(glp_tree *T); ! /* compute relative MIP gap */ ! ! void *glp_ios_node_data(glp_tree *T, int p); ! /* access subproblem application-specific data */ ! ! void glp_ios_row_attr(glp_tree *T, int i, glp_attr *attr); ! /* retrieve additional row attributes */ ! ! int glp_ios_pool_size(glp_tree *T); ! /* determine current size of the cut pool */ ! ! int glp_ios_add_row(glp_tree *T, ! const char *name, int klass, int flags, int len, const int ind[], ! const double val[], int type, double rhs); ! /* add row (constraint) to the cut pool */ ! ! void glp_ios_del_row(glp_tree *T, int i); ! /* remove row (constraint) from the cut pool */ ! ! void glp_ios_clear_pool(glp_tree *T); ! /* remove all rows (constraints) from the cut pool */ ! ! int glp_ios_can_branch(glp_tree *T, int j); ! /* check if can branch upon specified variable */ ! ! void glp_ios_branch_upon(glp_tree *T, int j, int sel); ! /* choose variable to branch upon */ ! ! void glp_ios_select_node(glp_tree *T, int p); ! /* select subproblem to continue the search */ ! ! int glp_ios_heur_sol(glp_tree *T, const double x[]); ! /* provide solution found by heuristic */ ! ! void glp_ios_terminate(glp_tree *T); ! /* terminate the solution process */ ! ! void glp_init_mpscp(glp_mpscp *parm); ! /* initialize MPS format control parameters */ ! int glp_read_mps( ! int nRows, char *nameRows[], int typeRows[], // ROWS info ! int NStructVar, int NStructRows, int NRowsInWhichStructVarArePresent[], // COLUMNS info ! char *StructVarName[],char *NameRowsInWhichStructVarArePresent[], // COLUMNS info ! double *Coefficients, // COLUMNS info ! double ValueB[], // RHS info ! int nRanges, double ValueRanges[], char* NameRanges[], // RANGES info ! int nBounds, double BoundValue[], char *BoundStructVarName[], char *TypeofBound[], // BOUNDS info ! glp_prob *P, int fmt, const glp_mpscp *parm, ! const char *fname); ! ! /* read problem data in MPS format */ ! ! int glp_write_mps(glp_prob *P, int fmt, const glp_mpscp *parm, ! const char *fname); ! /* write problem data in MPS format */ ! ! void glp_init_cpxcp(glp_cpxcp *parm); ! /* initialize CPLEX LP format control parameters */ ! ! int glp_read_lp(glp_prob *P, const glp_cpxcp *parm, const char *fname); ! /* read problem data in CPLEX LP format */ ! ! int glp_write_lp(glp_prob *P, const glp_cpxcp *parm, const char *fname); ! /* write problem data in CPLEX LP format */ ! ! glp_tran *glp_mpl_alloc_wksp(void); ! /* allocate the MathProg translator workspace */ ! ! int glp_mpl_read_model(glp_tran *tran, const char *fname, int skip); ! /* read and translate model section */ ! ! int glp_mpl_read_data(glp_tran *tran, const char *fname); ! /* read and translate data section */ ! ! int glp_mpl_generate(glp_tran *tran, const char *fname); ! /* generate the model */ ! ! void glp_mpl_build_prob(glp_tran *tran, glp_prob *prob); ! /* build LP/MIP problem instance from the model */ ! ! int glp_mpl_postsolve(glp_tran *tran, glp_prob *prob, int sol); ! /* postsolve the model */ ! ! void glp_mpl_free_wksp(glp_tran *tran); ! /* free the MathProg translator workspace */ ! ! int glp_main_t( ! int nRows, char *nameRows[], int typeRows[], // ROWS info ! int NStructVar, int NStructRows, int NRowsInWhichStructVarArePresent[], // COLUMNS info ! char *StructVarName[],char *NameRowsInWhichStructVarArePresent[], // COLUMNS info ! double *Coefficients, // COLUMNS info ! double ValueB[], // RHS info ! int nRanges, double ValueRanges[], char* NameRanges[], // RANGES info ! int nBounds, double BoundValue[], char *BoundStructVarName[], char *TypeofBound[] // BOUNDS info ! // ,int argc, const char *argv[] ! ,double final_values[], int timelimit ! ); ! ! int glp_main( ! int nRows, char *nameRows[], int typeRows[], // ROWS info ! int NStructVar, int NStructRows, int NRowsInWhichStructVarArePresent[], // COLUMNS info ! char *StructVarName[],char *NameRowsInWhichStructVarArePresent[], // COLUMNS info ! double *Coefficients, // COLUMNS info ! double ValueB[], // RHS info ! int nRanges, double ValueRanges[], char* NameRanges[], // RANGES info ! int nBounds, double BoundValue[], char *BoundStructVarName[], char *TypeofBound[] // BOUNDS info ! // ,int argc, const char *argv[] ! ,double final_values[] ! ); ! /* stand-alone LP/MIP solver */ ! ! /**********************************************************************/ ! ! typedef struct _glp_graph glp_graph; ! typedef struct _glp_vertex glp_vertex; ! typedef struct _glp_arc glp_arc; ! ! struct _glp_graph ! { /* graph descriptor */ ! void *pool; /* DMP *pool; */ ! /* memory pool to store graph components */ ! char *name; ! /* graph name (1 to 255 chars); NULL means no name is assigned ! to the graph */ ! int nv_max; ! /* length of the vertex list (enlarged automatically) */ ! int nv; ! /* number of vertices in the graph, 0 <= nv <= nv_max */ ! int na; ! /* number of arcs in the graph, na >= 0 */ ! glp_vertex **v; /* glp_vertex *v[1+nv_max]; */ ! /* v[i], 1 <= i <= nv, is a pointer to i-th vertex */ ! void *index; /* AVL *index; */ ! /* vertex index to find vertices by their names; NULL means the ! index does not exist */ ! int v_size; ! /* size of data associated with each vertex (0 to 256 bytes) */ ! int a_size; ! /* size of data associated with each arc (0 to 256 bytes) */ ! }; ! ! struct _glp_vertex ! { /* vertex descriptor */ ! int i; ! /* vertex ordinal number, 1 <= i <= nv */ ! char *name; ! /* vertex name (1 to 255 chars); NULL means no name is assigned ! to the vertex */ ! void *entry; /* AVLNODE *entry; */ ! /* pointer to corresponding entry in the vertex index; NULL means ! that either the index does not exist or the vertex has no name ! assigned */ ! void *data; ! /* pointer to data associated with the vertex */ ! void *temp; ! /* working pointer */ ! glp_arc *in; ! /* pointer to the (unordered) list of incoming arcs */ ! glp_arc *out; ! /* pointer to the (unordered) list of outgoing arcs */ ! }; ! ! struct _glp_arc ! { /* arc descriptor */ ! glp_vertex *tail; ! /* pointer to the tail endpoint */ ! glp_vertex *head; ! /* pointer to the head endpoint */ ! void *data; ! /* pointer to data associated with the arc */ ! void *temp; ! /* working pointer */ ! glp_arc *t_prev; ! /* pointer to previous arc having the same tail endpoint */ ! glp_arc *t_next; ! /* pointer to next arc having the same tail endpoint */ ! glp_arc *h_prev; ! /* pointer to previous arc having the same head endpoint */ ! glp_arc *h_next; ! /* pointer to next arc having the same head endpoint */ ! }; ! ! glp_graph *glp_create_graph(int v_size, int a_size); ! /* create graph */ ! ! void glp_set_graph_name(glp_graph *G, const char *name); ! /* assign (change) graph name */ ! ! int glp_add_vertices(glp_graph *G, int nadd); ! /* add new vertices to graph */ ! ! void glp_set_vertex_name(glp_graph *G, int i, const char *name); ! /* assign (change) vertex name */ ! ! glp_arc *glp_add_arc(glp_graph *G, int i, int j); ! /* add new arc to graph */ ! ! void glp_erase_graph(glp_graph *G, int v_size, int a_size); ! /* erase graph content */ ! ! void glp_delete_graph(glp_graph *G); ! /* delete graph */ ! ! void glp_create_v_index(glp_graph *G); ! /* create vertex name index */ ! ! int glp_find_vertex(glp_graph *G, const char *name); ! /* find vertex by its name */ ! ! void glp_delete_v_index(glp_graph *G); ! /* delete vertex name index */ ! ! int glp_read_graph(glp_graph *G, const char *fname); ! /* read graph from plain text file */ ! ! int glp_write_graph(glp_graph *G, const char *fname); ! /* write graph to plain text file */ ! ! void glp_mincost_lp(glp_prob *P, glp_graph *G, int names, int v_rhs, ! int a_low, int a_cap, int a_cost); ! /* convert minimum cost flow problem to LP */ ! ! int glp_mincost_okalg(glp_graph *G, int v_rhs, int a_low, int a_cap, ! int a_cost, double *sol, int a_x, int v_pi); ! /* find minimum-cost flow with out-of-kilter algorithm */ ! ! void glp_maxflow_lp(glp_prob *P, glp_graph *G, int names, int s, ! int t, int a_cap); ! /* convert maximum flow problem to LP */ ! ! int glp_maxflow_ffalg(glp_graph *G, int s, int t, int a_cap, ! double *sol, int a_x, int v_cut); ! /* find maximal flow with Ford-Fulkerson algorithm */ ! ! int glp_check_asnprob(glp_graph *G, int v_set); ! /* check correctness of assignment problem data */ ! ! /* assignment problem formulation: */ ! #define GLP_ASN_MIN 1 /* perfect matching (minimization) */ ! #define GLP_ASN_MAX 2 /* perfect matching (maximization) */ ! #define GLP_ASN_MMP 3 /* maximum matching */ ! ! int glp_asnprob_lp(glp_prob *P, int form, glp_graph *G, int names, ! int v_set, int a_cost); ! /* convert assignment problem to LP */ ! ! int glp_asnprob_okalg(int form, glp_graph *G, int v_set, int a_cost, ! double *sol, int a_x); ! /* solve assignment problem with out-of-kilter algorithm */ ! ! int glp_asnprob_hall(glp_graph *G, int v_set, int a_x); ! /* find bipartite matching of maximum cardinality */ ! ! int glp_read_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, ! int a_cost, const char *fname); ! /* read min-cost flow problem data in DIMACS format */ ! ! int glp_write_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, ! int a_cost, const char *fname); ! /* write min-cost flow problem data in DIMACS format */ ! ! int glp_read_maxflow(glp_graph *G, int *s, int *t, int a_cap, ! const char *fname); ! /* read maximum flow problem data in DIMACS format */ ! ! int glp_write_maxflow(glp_graph *G, int s, int t, int a_cap, ! const char *fname); ! /* write maximum flow problem data in DIMACS format */ ! ! int glp_read_asnprob(glp_graph *G, int v_set, int a_cost, const char ! *fname); ! /* read assignment problem data in DIMACS format */ ! ! int glp_write_asnprob(glp_graph *G, int v_set, int a_cost, const char ! *fname); ! /* write assignment problem data in DIMACS format */ ! ! int glp_read_ccformat(glp_graph *G, int v_wgt, const char *fname); ! /* read graph in DIMACS clique/coloring format */ ! ! int glp_write_ccformat(glp_graph *G, int v_wgt, const char *fname); ! /* write graph in DIMACS clique/coloring format */ ! ! int glp_netgen(glp_graph *G, int v_rhs, int a_cap, int a_cost, ! const int parm[1+15]); ! /* Klingman's network problem generator */ ! ! int glp_gridgen(glp_graph *G, int v_rhs, int a_cap, int a_cost, ! const int parm[1+14]); ! /* grid-like network problem generator */ ! ! int glp_rmfgen(glp_graph *G, int *s, int *t, int a_cap, ! const int parm[1+5]); ! /* Goldfarb's maximum flow problem generator */ ! ! int glp_weak_comp(glp_graph *G, int v_num); ! /* find all weakly connected components of graph */ ! ! int glp_strong_comp(glp_graph *G, int v_num); ! /* find all strongly connected components of graph */ ! ! /**********************************************************************/ ! ! typedef struct { int lo, hi; } glp_long; ! /* long integer data type */ ! ! const char *glp_version(void); ! /* determine library version */ ! ! void glp_printf(const char *fmt, ...); ! /* write formatted output to terminal */ ! ! void glp_vprintf(const char *fmt, va_list arg); ! /* write formatted output to terminal */ ! ! #define glp_assert(expr) \ ! ((void)((expr) || (glp_assert_(#expr, __FILE__, __LINE__), 1))) ! ! void glp_assert_(const char *expr, const char *file, int line); ! /* check for logical condition */ ! ! int glp_term_out(int flag); ! /* enable/disable terminal output */ ! ! void glp_term_hook(int (*func)(void *info, const char *s), void *info); ! /* install hook to intercept terminal output */ ! ! void *glp_malloc(int size); ! /* allocate memory block */ ! ! void *glp_calloc(int n, int size); ! /* allocate memory block */ ! ! void glp_free(void *ptr); ! /* free memory block */ ! ! void glp_mem_usage(int *count, int *cpeak, glp_long *total, ! glp_long *tpeak); ! /* get memory usage information */ ! ! void glp_mem_limit(int limit); ! /* set memory usage limit */ ! ! void glp_free_env(void); ! /* free GLPK library environment */ ! ! /**********************************************************************/ ! ! #ifndef GLP_DATA ! #define GLP_DATA ! typedef struct { double _opaque_data; } glp_data; ! /* plain data file */ ! #endif ! ! glp_data *glp_sdf_open_file(const char *fname); ! /* open plain data file */ ! ! void glp_sdf_set_jump(glp_data *data, void *jump); ! /* set up error handling */ ! ! void glp_sdf_error(glp_data *data, const char *fmt, ...); ! /* print error message */ ! ! void glp_sdf_warning(glp_data *data, const char *fmt, ...); ! /* print warning message */ ! ! int glp_sdf_read_int(glp_data *data); ! /* read integer number */ ! ! double glp_sdf_read_num(glp_data *data); ! /* read floating-point number */ ! ! const char *glp_sdf_read_item(glp_data *data); ! /* read data item */ ! ! const char *glp_sdf_read_text(glp_data *data); ! /* read text until end of line */ ! ! int glp_sdf_line(glp_data *data); ! /* determine current line number */ ! ! void glp_sdf_close_file(glp_data *data); ! /* close plain data file */ ! ! /**********************************************************************/ ! ! #define LPX glp_prob ! ! /* problem class: */ ! #define LPX_LP 100 /* linear programming (LP) */ ! #define LPX_MIP 101 /* mixed integer programming (MIP) */ ! ! /* type of auxiliary/structural variable: */ ! #define LPX_FR 110 /* free variable */ ! #define LPX_LO 111 /* variable with lower bound */ ! #define LPX_UP 112 /* variable with upper bound */ ! #define LPX_DB 113 /* double-bounded variable */ ! #define LPX_FX 114 /* fixed variable */ ! ! /* optimization direction flag: */ ! #define LPX_MIN 120 /* minimization */ ! #define LPX_MAX 121 /* maximization */ ! ! /* status of primal basic solution: */ ! #define LPX_P_UNDEF 132 /* primal solution is undefined */ ! #define LPX_P_FEAS 133 /* solution is primal feasible */ ! #define LPX_P_INFEAS 134 /* solution is primal infeasible */ ! #define LPX_P_NOFEAS 135 /* no primal feasible solution exists */ ! ! /* status of dual basic solution: */ ! #define LPX_D_UNDEF 136 /* dual solution is undefined */ ! #define LPX_D_FEAS 137 /* solution is dual feasible */ ! #define LPX_D_INFEAS 138 /* solution is dual infeasible */ ! #define LPX_D_NOFEAS 139 /* no dual feasible solution exists */ ! ! /* status of auxiliary/structural variable: */ ! #define LPX_BS 140 /* basic variable */ ! #define LPX_NL 141 /* non-basic variable on lower bound */ ! #define LPX_NU 142 /* non-basic variable on upper bound */ ! #define LPX_NF 143 /* non-basic free variable */ ! #define LPX_NS 144 /* non-basic fixed variable */ ! ! /* status of interior-point solution: */ ! #define LPX_T_UNDEF 150 /* interior solution is undefined */ ! #define LPX_T_OPT 151 /* interior solution is optimal */ ! ! /* kind of structural variable: */ ! #define LPX_CV 160 /* continuous variable */ ! #define LPX_IV 161 /* integer variable */ ! ! /* status of integer solution: */ ! #define LPX_I_UNDEF 170 /* integer solution is undefined */ ! #define LPX_I_OPT 171 /* integer solution is optimal */ ! #define LPX_I_FEAS 172 /* integer solution is feasible */ ! #define LPX_I_NOFEAS 173 /* no integer solution exists */ ! ! /* status codes reported by the routine lpx_get_status: */ ! #define LPX_OPT 180 /* optimal */ ! #define LPX_FEAS 181 /* feasible */ ! #define LPX_INFEAS 182 /* infeasible */ ! #define LPX_NOFEAS 183 /* no feasible */ ! #define LPX_UNBND 184 /* unbounded */ ! #define LPX_UNDEF 185 /* undefined */ ! ! /* exit codes returned by solver routines: */ ! #define LPX_E_OK 200 /* success */ ! #define LPX_E_EMPTY 201 /* empty problem */ ! #define LPX_E_BADB 202 /* invalid initial basis */ ! #define LPX_E_INFEAS 203 /* infeasible initial solution */ ! #define LPX_E_FAULT 204 /* unable to start the search */ ! #define LPX_E_OBJLL 205 /* objective lower limit reached */ ! #define LPX_E_OBJUL 206 /* objective upper limit reached */ ! #define LPX_E_ITLIM 207 /* iterations limit exhausted */ ! #define LPX_E_TMLIM 208 /* time limit exhausted */ ! #define LPX_E_NOFEAS 209 /* no feasible solution */ ! #define LPX_E_INSTAB 210 /* numerical instability */ ! #define LPX_E_SING 211 /* problems with basis matrix */ ! #define LPX_E_NOCONV 212 /* no convergence (interior) */ ! #define LPX_E_NOPFS 213 /* no primal feas. sol. (LP presolver) */ ! #define LPX_E_NODFS 214 /* no dual feas. sol. (LP presolver) */ ! #define LPX_E_MIPGAP 215 /* relative mip gap tolerance reached */ ! ! /* control parameter identifiers: */ ! #define LPX_K_MSGLEV 300 /* lp->msg_lev */ ! #define LPX_K_SCALE 301 /* lp->scale */ ! #define LPX_K_DUAL 302 /* lp->dual */ ! #define LPX_K_PRICE 303 /* lp->price */ ! #define LPX_K_RELAX 304 /* lp->relax */ ! #define LPX_K_TOLBND 305 /* lp->tol_bnd */ ! #define LPX_K_TOLDJ 306 /* lp->tol_dj */ ! #define LPX_K_TOLPIV 307 /* lp->tol_piv */ ! #define LPX_K_ROUND 308 /* lp->round */ ! #define LPX_K_OBJLL 309 /* lp->obj_ll */ ! #define LPX_K_OBJUL 310 /* lp->obj_ul */ ! #define LPX_K_ITLIM 311 /* lp->it_lim */ ! #define LPX_K_ITCNT 312 /* lp->it_cnt */ ! #define LPX_K_TMLIM 313 /* lp->tm_lim */ ! #define LPX_K_OUTFRQ 314 /* lp->out_frq */ ! #define LPX_K_OUTDLY 315 /* lp->out_dly */ ! #define LPX_K_BRANCH 316 /* lp->branch */ ! #define LPX_K_BTRACK 317 /* lp->btrack */ ! #define LPX_K_TOLINT 318 /* lp->tol_int */ ! #define LPX_K_TOLOBJ 319 /* lp->tol_obj */ ! #define LPX_K_MPSINFO 320 /* lp->mps_info */ ! #define LPX_K_MPSOBJ 321 /* lp->mps_obj */ ! #define LPX_K_MPSORIG 322 /* lp->mps_orig */ ! #define LPX_K_MPSWIDE 323 /* lp->mps_wide */ ! #define LPX_K_MPSFREE 324 /* lp->mps_free */ ! #define LPX_K_MPSSKIP 325 /* lp->mps_skip */ ! #define LPX_K_LPTORIG 326 /* lp->lpt_orig */ ! #define LPX_K_PRESOL 327 /* lp->presol */ ! #define LPX_K_BINARIZE 328 /* lp->binarize */ ! #define LPX_K_USECUTS 329 /* lp->use_cuts */ ! #define LPX_K_BFTYPE 330 /* lp->bfcp->type */ ! #define LPX_K_MIPGAP 331 /* lp->mip_gap */ ! ! #define LPX_C_COVER 0x01 /* mixed cover cuts */ ! #define LPX_C_CLIQUE 0x02 /* clique cuts */ ! #define LPX_C_GOMORY 0x04 /* Gomory's mixed integer cuts */ ! #define LPX_C_MIR 0x08 /* mixed integer rounding cuts */ ! #define LPX_C_ALL 0xFF /* all cuts */ ! ! typedef struct ! { /* this structure contains results reported by the routines which ! checks Karush-Kuhn-Tucker conditions (for details see comments ! to those routines) */ ! /*--------------------------------------------------------------*/ ! /* xR - A * xS = 0 (KKT.PE) */ ! double pe_ae_max; ! /* largest absolute error */ ! int pe_ae_row; ! /* number of row with largest absolute error */ ! double pe_re_max; ! /* largest relative error */ ! int pe_re_row; ! /* number of row with largest relative error */ ! int pe_quality; ! /* quality of primal solution: ! 'H' - high ! 'M' - medium ! 'L' - low ! '?' - primal solution is wrong */ ! /*--------------------------------------------------------------*/ ! /* l[k] <= x[k] <= u[k] (KKT.PB) */ ! double pb_ae_max; ! /* largest absolute error */ ! int pb_ae_ind; ! /* number of variable with largest absolute error */ ! double pb_re_max; ! /* largest relative error */ ! int pb_re_ind; ! /* number of variable with largest relative error */ ! int pb_quality; ! /* quality of primal feasibility: ! 'H' - high ! 'M' - medium ! 'L' - low ! '?' - primal solution is infeasible */ ! /*--------------------------------------------------------------*/ ! /* A' * (dR - cR) + (dS - cS) = 0 (KKT.DE) */ ! double de_ae_max; ! /* largest absolute error */ ! int de_ae_col; ! /* number of column with largest absolute error */ ! double de_re_max; ! /* largest relative error */ ! int de_re_col; ! /* number of column with largest relative error */ ! int de_quality; ! /* quality of dual solution: ! 'H' - high ! 'M' - medium ! 'L' - low ! '?' - dual solution is wrong */ ! /*--------------------------------------------------------------*/ ! /* d[k] >= 0 or d[k] <= 0 (KKT.DB) */ ! double db_ae_max; ! /* largest absolute error */ ! int db_ae_ind; ! /* number of variable with largest absolute error */ ! double db_re_max; ! /* largest relative error */ ! int db_re_ind; ! /* number of variable with largest relative error */ ! int db_quality; ! /* quality of dual feasibility: ! 'H' - high ! 'M' - medium ! 'L' - low ! '?' - dual solution is infeasible */ ! /*--------------------------------------------------------------*/ ! /* (x[k] - bound of x[k]) * d[k] = 0 (KKT.CS) */ ! double cs_ae_max; ! /* largest absolute error */ ! int cs_ae_ind; ! /* number of variable with largest absolute error */ ! double cs_re_max; ! /* largest relative error */ ! int cs_re_ind; ! /* number of variable with largest relative error */ ! int cs_quality; ! /* quality of complementary slackness: ! 'H' - high ! 'M' - medium ! 'L' - low ! '?' - primal and dual solutions are not complementary */ ! } LPXKKT; ! ! #define lpx_create_prob _glp_lpx_create_prob ! LPX *lpx_create_prob(void); ! /* create problem object */ ! ! #define lpx_set_prob_name _glp_lpx_set_prob_name ! void lpx_set_prob_name(LPX *lp, const char *name); ! /* assign (change) problem name */ ! ! #define lpx_set_obj_name _glp_lpx_set_obj_name ! void lpx_set_obj_name(LPX *lp, const char *name); ! /* assign (change) objective function name */ ! ! #define lpx_set_obj_dir _glp_lpx_set_obj_dir ! void lpx_set_obj_dir(LPX *lp, int dir); ! /* set (change) optimization direction flag */ ! ! #define lpx_add_rows _glp_lpx_add_rows ! int lpx_add_rows(LPX *lp, int nrs); ! /* add new rows to problem object */ ! ! #define lpx_add_cols _glp_lpx_add_cols ! int lpx_add_cols(LPX *lp, int ncs); ! /* add new columns to problem object */ ! ! #define lpx_set_row_name _glp_lpx_set_row_name ! void lpx_set_row_name(LPX *lp, int i, const char *name); ! /* assign (change) row name */ ! ! #define lpx_set_col_name _glp_lpx_set_col_name ! void lpx_set_col_name(LPX *lp, int j, const char *name); ! /* assign (change) column name */ ! ! #define lpx_set_row_bnds _glp_lpx_set_row_bnds ! void lpx_set_row_bnds(LPX *lp, int i, int type, double lb, double ub); ! /* set (change) row bounds */ ! ! #define lpx_set_col_bnds _glp_lpx_set_col_bnds ! void lpx_set_col_bnds(LPX *lp, int j, int type, double lb, double ub); ! /* set (change) column bounds */ ! ! #define lpx_set_obj_coef _glp_lpx_set_obj_coef ! void lpx_set_obj_coef(glp_prob *lp, int j, double coef); ! /* set (change) obj. coefficient or constant term */ ! ! #define lpx_set_mat_row _glp_lpx_set_mat_row ! void lpx_set_mat_row(LPX *lp, int i, int len, const int ind[], ! const double val[]); ! /* set (replace) row of the constraint matrix */ ! ! #define lpx_set_mat_col _glp_lpx_set_mat_col ! void lpx_set_mat_col(LPX *lp, int j, int len, const int ind[], ! const double val[]); ! /* set (replace) column of the constraint matrix */ ! ! #define lpx_load_matrix _glp_lpx_load_matrix ! void lpx_load_matrix(LPX *lp, int ne, const int ia[], const int ja[], ! const double ar[]); ! /* load (replace) the whole constraint matrix */ ! ! #define lpx_del_rows _glp_lpx_del_rows ! void lpx_del_rows(LPX *lp, int nrs, const int num[]); ! /* delete specified rows from problem object */ ! ! #define lpx_del_cols _glp_lpx_del_cols ! void lpx_del_cols(LPX *lp, int ncs, const int num[]); ! /* delete specified columns from problem object */ ! ! #define lpx_delete_prob _glp_lpx_delete_prob ! void lpx_delete_prob(LPX *lp); ! /* delete problem object */ ! ! #define lpx_get_prob_name _glp_lpx_get_prob_name ! const char *lpx_get_prob_name(LPX *lp); ! /* retrieve problem name */ ! ! #define lpx_get_obj_name _glp_lpx_get_obj_name ! const char *lpx_get_obj_name(LPX *lp); ! /* retrieve objective function name */ ! ! #define lpx_get_obj_dir _glp_lpx_get_obj_dir ! int lpx_get_obj_dir(LPX *lp); ! /* retrieve optimization direction flag */ ! ! #define lpx_get_num_rows _glp_lpx_get_num_rows ! int lpx_get_num_rows(LPX *lp); ! /* retrieve number of rows */ ! ! #define lpx_get_num_cols _glp_lpx_get_num_cols ! int lpx_get_num_cols(LPX *lp); ! /* retrieve number of columns */ ! ! #define lpx_get_row_name _glp_lpx_get_row_name ! const char *lpx_get_row_name(LPX *lp, int i); ! /* retrieve row name */ ! ! #define lpx_get_col_name _glp_lpx_get_col_name ! const char *lpx_get_col_name(LPX *lp, int j); ! /* retrieve column name */ ! ! #define lpx_get_row_type _glp_lpx_get_row_type ! int lpx_get_row_type(LPX *lp, int i); ! /* retrieve row type */ ! ! #define lpx_get_row_lb _glp_lpx_get_row_lb ! double lpx_get_row_lb(LPX *lp, int i); ! /* retrieve row lower bound */ ! ! #define lpx_get_row_ub _glp_lpx_get_row_ub ! double lpx_get_row_ub(LPX *lp, int i); ! /* retrieve row upper bound */ ! ! #define lpx_get_row_bnds _glp_lpx_get_row_bnds ! void lpx_get_row_bnds(LPX *lp, int i, int *typx, double *lb, ! double *ub); ! /* retrieve row bounds */ ! ! #define lpx_get_col_type _glp_lpx_get_col_type ! int lpx_get_col_type(LPX *lp, int j); ! /* retrieve column type */ ! ! #define lpx_get_col_lb _glp_lpx_get_col_lb ! double lpx_get_col_lb(LPX *lp, int j); ! /* retrieve column lower bound */ ! ! #define lpx_get_col_ub _glp_lpx_get_col_ub ! double lpx_get_col_ub(LPX *lp, int j); ! /* retrieve column upper bound */ ! ! #define lpx_get_col_bnds _glp_lpx_get_col_bnds ! void lpx_get_col_bnds(LPX *lp, int j, int *typx, double *lb, ! double *ub); ! /* retrieve column bounds */ ! ! #define lpx_get_obj_coef _glp_lpx_get_obj_coef ! double lpx_get_obj_coef(LPX *lp, int j); ! /* retrieve obj. coefficient or constant term */ ! ! #define lpx_get_num_nz _glp_lpx_get_num_nz ! int lpx_get_num_nz(LPX *lp); ! /* retrieve number of constraint coefficients */ ! ! #define lpx_get_mat_row _glp_lpx_get_mat_row ! int lpx_get_mat_row(LPX *lp, int i, int ind[], double val[]); ! /* retrieve row of the constraint matrix */ ! ! #define lpx_get_mat_col _glp_lpx_get_mat_col ! int lpx_get_mat_col(LPX *lp, int j, int ind[], double val[]); ! /* retrieve column of the constraint matrix */ ! ! #define lpx_create_index _glp_lpx_create_index ! void lpx_create_index(LPX *lp); ! /* create the name index */ ! ! #define lpx_find_row _glp_lpx_find_row ! int lpx_find_row(LPX *lp, const char *name); ! /* find row by its name */ ! ! #define lpx_find_col _glp_lpx_find_col ! int lpx_find_col(LPX *lp, const char *name); ! /* find column by its name */ ! ! #define lpx_delete_index _glp_lpx_delete_index ! void lpx_delete_index(LPX *lp); ! /* delete the name index */ ! ! #define lpx_scale_prob _glp_lpx_scale_prob ! void lpx_scale_prob(LPX *lp); ! /* scale problem data */ ! ! #define lpx_unscale_prob _glp_lpx_unscale_prob ! void lpx_unscale_prob(LPX *lp); ! /* unscale problem data */ ! ! #define lpx_set_row_stat _glp_lpx_set_row_stat ! void lpx_set_row_stat(LPX *lp, int i, int stat); ! /* set (change) row status */ ! ! #define lpx_set_col_stat _glp_lpx_set_col_stat ! void lpx_set_col_stat(LPX *lp, int j, int stat); ! /* set (change) column status */ ! ! #define lpx_std_basis _glp_lpx_std_basis ! void lpx_std_basis(LPX *lp); ! /* construct standard initial LP basis */ ! ! #define lpx_adv_basis _glp_lpx_adv_basis ! void lpx_adv_basis(LPX *lp); ! /* construct advanced initial LP basis */ ! ! #define lpx_cpx_basis _glp_lpx_cpx_basis ! void lpx_cpx_basis(LPX *lp); ! /* construct Bixby's initial LP basis */ ! ! #define lpx_simplex _glp_lpx_simplex ! int lpx_simplex(LPX *lp); ! /* easy-to-use driver to the simplex method */ ! ! #define lpx_exact _glp_lpx_exact ! int lpx_exact(LPX *lp); ! /* easy-to-use driver to the exact simplex method */ ! ! #define lpx_get_status _glp_lpx_get_status ! int lpx_get_status(LPX *lp); ! /* retrieve generic status of basic solution */ ! ! #define lpx_get_prim_stat _glp_lpx_get_prim_stat ! int lpx_get_prim_stat(LPX *lp); ! /* retrieve primal status of basic solution */ ! ! #define lpx_get_dual_stat _glp_lpx_get_dual_stat ! int lpx_get_dual_stat(LPX *lp); ! /* retrieve dual status of basic solution */ ! ! #define lpx_get_obj_val _glp_lpx_get_obj_val ! double lpx_get_obj_val(LPX *lp); ! /* retrieve objective value (basic solution) */ ! ! #define lpx_get_row_stat _glp_lpx_get_row_stat ! int lpx_get_row_stat(LPX *lp, int i); ! /* retrieve row status (basic solution) */ ! ! #define lpx_get_row_prim _glp_lpx_get_row_prim ! double lpx_get_row_prim(LPX *lp, int i); ! /* retrieve row primal value (basic solution) */ ! ! #define lpx_get_row_dual _glp_lpx_get_row_dual ! double lpx_get_row_dual(LPX *lp, int i); ! /* retrieve row dual value (basic solution) */ ! ! #define lpx_get_row_info _glp_lpx_get_row_info ! void lpx_get_row_info(LPX *lp, int i, int *tagx, double *vx, ! double *dx); ! /* obtain row solution information */ ! ! #define lpx_get_col_stat _glp_lpx_get_col_stat ! int lpx_get_col_stat(LPX *lp, int j); ! /* retrieve column status (basic solution) */ ! ! #define lpx_get_col_prim _glp_lpx_get_col_prim ! double lpx_get_col_prim(LPX *lp, int j); ! /* retrieve column primal value (basic solution) */ ! ! #define lpx_get_col_dual _glp_lpx_get_col_dual ! double lpx_get_col_dual(glp_prob *lp, int j); ! /* retrieve column dual value (basic solution) */ ! ! #define lpx_get_col_info _glp_lpx_get_col_info ! void lpx_get_col_info(LPX *lp, int j, int *tagx, double *vx, ! double *dx); ! /* obtain column solution information (obsolete) */ ! ! #define lpx_get_ray_info _glp_lpx_get_ray_info ! int lpx_get_ray_info(LPX *lp); ! /* determine what causes primal unboundness */ ! ! #define lpx_check_kkt _glp_lpx_check_kkt ! void lpx_check_kkt(LPX *lp, int scaled, LPXKKT *kkt); ! /* check Karush-Kuhn-Tucker conditions */ ! ! #define lpx_warm_up _glp_lpx_warm_up ! int lpx_warm_up(LPX *lp); ! /* "warm up" LP basis */ ! ! #define lpx_eval_tab_row _glp_lpx_eval_tab_row ! int lpx_eval_tab_row(LPX *lp, int k, int ind[], double val[]); ! /* compute row of the simplex table */ ! ! #define lpx_eval_tab_col _glp_lpx_eval_tab_col ! int lpx_eval_tab_col(LPX *lp, int k, int ind[], double val[]); ! /* compute column of the simplex table */ ! ! #define lpx_transform_row _glp_lpx_transform_row ! int lpx_transform_row(LPX *lp, int len, int ind[], double val[]); ! /* transform explicitly specified row */ ! ! #define lpx_transform_col _glp_lpx_transform_col ! int lpx_transform_col(LPX *lp, int len, int ind[], double val[]); ! /* transform explicitly specified column */ ! ! #define lpx_prim_ratio_test _glp_lpx_prim_ratio_test ! int lpx_prim_ratio_test(LPX *lp, int len, const int ind[], ! const double val[], int how, double tol); ! /* perform primal ratio test */ ! ! #define lpx_dual_ratio_test _glp_lpx_dual_ratio_test ! int lpx_dual_ratio_test(LPX *lp, int len, const int ind[], ! const double val[], int how, double tol); ! /* perform dual ratio test */ ! ! #define lpx_interior _glp_lpx_interior ! int lpx_interior(LPX *lp); ! /* easy-to-use driver to the interior point method */ ! ! #define lpx_ipt_status _glp_lpx_ipt_status ! int lpx_ipt_status(LPX *lp); ! /* retrieve status of interior-point solution */ ! ! #define lpx_ipt_obj_val _glp_lpx_ipt_obj_val ! double lpx_ipt_obj_val(LPX *lp); ! /* retrieve objective value (interior point) */ ! ! #define lpx_ipt_row_prim _glp_lpx_ipt_row_prim ! double lpx_ipt_row_prim(LPX *lp, int i); ! /* retrieve row primal value (interior point) */ ! ! #define lpx_ipt_row_dual _glp_lpx_ipt_row_dual ! double lpx_ipt_row_dual(LPX *lp, int i); ! /* retrieve row dual value (interior point) */ ! ! #define lpx_ipt_col_prim _glp_lpx_ipt_col_prim ! double lpx_ipt_col_prim(LPX *lp, int j); ! /* retrieve column primal value (interior point) */ ! ! #define lpx_ipt_col_dual _glp_lpx_ipt_col_dual ! double lpx_ipt_col_dual(LPX *lp, int j); ! /* retrieve column dual value (interior point) */ ! ! #define lpx_set_class _glp_lpx_set_class ! void lpx_set_class(LPX *lp, int klass); ! /* set problem class */ ! ! #define lpx_get_class _glp_lpx_get_class ! int lpx_get_class(LPX *lp); ! /* determine problem klass */ ! ! #define lpx_set_col_kind _glp_lpx_set_col_kind ! void lpx_set_col_kind(LPX *lp, int j, int kind); ! /* set (change) column kind */ ! ! #define lpx_get_col_kind _glp_lpx_get_col_kind ! int lpx_get_col_kind(LPX *lp, int j); ! /* retrieve column kind */ ! ! #define lpx_get_num_int _glp_lpx_get_num_int ! int lpx_get_num_int(LPX *lp); ! /* retrieve number of integer columns */ ! ! #define lpx_get_num_bin _glp_lpx_get_num_bin ! int lpx_get_num_bin(LPX *lp); ! /* retrieve number of binary columns */ ! ! #define lpx_integer _glp_lpx_integer ! int lpx_integer(LPX *lp); ! /* easy-to-use driver to the branch-and-bound method */ ! ! #define lpx_intopt _glp_lpx_intopt ! int lpx_intopt(LPX *lp); ! /* easy-to-use driver to the branch-and-bound method */ ! ! #define lpx_mip_status _glp_lpx_mip_status ! int lpx_mip_status(LPX *lp); ! /* retrieve status of MIP solution */ ! ! #define lpx_mip_obj_val _glp_lpx_mip_obj_val ! double lpx_mip_obj_val(LPX *lp); ! /* retrieve objective value (MIP solution) */ ! ! #define lpx_mip_row_val _glp_lpx_mip_row_val ! double lpx_mip_row_val(LPX *lp, int i); ! /* retrieve row value (MIP solution) */ ! ! #define lpx_mip_col_val _glp_lpx_mip_col_val ! double lpx_mip_col_val(LPX *lp, int j); ! /* retrieve column value (MIP solution) */ ! ! #define lpx_check_int _glp_lpx_check_int ! void lpx_check_int(LPX *lp, LPXKKT *kkt); ! /* check integer feasibility conditions */ ! ! #define lpx_reset_parms _glp_lpx_reset_parms ! void lpx_reset_parms(LPX *lp); ! /* reset control parameters to default values */ ! ! #define lpx_set_int_parm _glp_lpx_set_int_parm ! void lpx_set_int_parm(LPX *lp, int parm, int val); ! /* set (change) integer control parameter */ ! ! #define lpx_get_int_parm _glp_lpx_get_int_parm ! int lpx_get_int_parm(LPX *lp, int parm); ! /* query integer control parameter */ ! ! #define lpx_set_real_parm _glp_lpx_set_real_parm ! void lpx_set_real_parm(LPX *lp, int parm, double val); ! /* set (change) real control parameter */ ! ! #define lpx_get_real_parm _glp_lpx_get_real_parm ! double lpx_get_real_parm(LPX *lp, int parm); ! /* query real control parameter */ ! ! #define lpx_read_mps _glp_lpx_read_mps ! LPX *lpx_read_mps(const char *fname); ! /* read problem data in fixed MPS format */ ! ! #define lpx_write_mps _glp_lpx_write_mps ! int lpx_write_mps(LPX *lp, const char *fname); ! /* write problem data in fixed MPS format */ ! ! #define lpx_read_bas _glp_lpx_read_bas ! int lpx_read_bas(LPX *lp, const char *fname); ! /* read LP basis in fixed MPS format */ ! ! #define lpx_write_bas _glp_lpx_write_bas ! int lpx_write_bas(LPX *lp, const char *fname); ! /* write LP basis in fixed MPS format */ ! ! #define lpx_read_freemps _glp_lpx_read_freemps ! LPX *lpx_read_freemps(const char *fname); ! /* read problem data in free MPS format */ ! ! #define lpx_write_freemps _glp_lpx_write_freemps ! int lpx_write_freemps(LPX *lp, const char *fname); ! /* write problem data in free MPS format */ ! ! #define lpx_read_cpxlp _glp_lpx_read_cpxlp ! LPX *lpx_read_cpxlp(const char *fname); ! /* read problem data in CPLEX LP format */ ! ! #define lpx_write_cpxlp _glp_lpx_write_cpxlp ! int lpx_write_cpxlp(LPX *lp, const char *fname); ! /* write problem data in CPLEX LP format */ ! ! #define lpx_read_model _glp_lpx_read_model ! LPX *lpx_read_model(const char *model, const char *data, ! const char *output); ! /* read LP/MIP model written in GNU MathProg language */ ! ! #define lpx_print_prob _glp_lpx_print_prob ! int lpx_print_prob(LPX *lp, const char *fname); ! /* write problem data in plain text format */ ! ! #define lpx_print_sol _glp_lpx_print_sol ! int lpx_print_sol(LPX *lp, const char *fname); ! /* write LP problem solution in printable format */ ! ! #define lpx_print_sens_bnds _glp_lpx_print_sens_bnds ! int lpx_print_sens_bnds(LPX *lp, const char *fname); ! /* write bounds sensitivity information */ ! ! #define lpx_print_ips _glp_lpx_print_ips ! int lpx_print_ips(LPX *lp, const char *fname); ! /* write interior point solution in printable format */ ! ! #define lpx_print_mip _glp_lpx_print_mip ! int lpx_print_mip(LPX *lp, const char *fname); ! /* write MIP problem solution in printable format */ ! ! #define lpx_is_b_avail _glp_lpx_is_b_avail ! int lpx_is_b_avail(LPX *lp); ! /* check if LP basis is available */ ! ! #define lpx_write_pb _glp_lpx_write_pb ! int lpx_write_pb(LPX *lp, const char *fname, int normalized, ! int binarize); ! /* write problem data in (normalized) OPB format */ ! ! #define lpx_main _glp_lpx_main ! int lpx_main(int argc, const char *argv[]); ! /* stand-alone LP/MIP solver */ ! ! #ifdef __cplusplus ! } ! #endif ! ! #endif ! ! /* eof */ Only in glpk-4.39.p4/include: Makefile Only in glpk-4.39.p4: libtool Only in glpk-4.39.p4: Makefile Only in glpk-4.39.p4/src: amd_1.lo Only in glpk-4.39.p4/src: amd_1.o Only in glpk-4.39.p4/src: amd_2.lo Only in glpk-4.39.p4/src: amd_2.o Only in glpk-4.39.p4/src: amd_aat.lo Only in glpk-4.39.p4/src: amd_aat.o Only in glpk-4.39.p4/src: amd_control.lo Only in glpk-4.39.p4/src: amd_control.o Only in glpk-4.39.p4/src: amd_defaults.lo Only in glpk-4.39.p4/src: amd_defaults.o Only in glpk-4.39.p4/src: amd_dump.lo Only in glpk-4.39.p4/src: amd_dump.o Only in glpk-4.39.p4/src: amd_info.lo Only in glpk-4.39.p4/src: amd_info.o Only in glpk-4.39.p4/src: amd_order.lo Only in glpk-4.39.p4/src: amd_order.o Only in glpk-4.39.p4/src: amd_postorder.lo Only in glpk-4.39.p4/src: amd_postorder.o Only in glpk-4.39.p4/src: amd_post_tree.lo Only in glpk-4.39.p4/src: amd_post_tree.o Only in glpk-4.39.p4/src: amd_preprocess.lo Only in glpk-4.39.p4/src: amd_preprocess.o Only in glpk-4.39.p4/src: amd_valid.lo Only in glpk-4.39.p4/src: amd_valid.o Only in glpk-4.39.p4/src: colamd.lo Only in glpk-4.39.p4/src: colamd.o Only in glpk-4.39.p4/src: .deps Only in glpk-4.39.p4/src: glpapi01.lo Only in glpk-4.39.p4/src: glpapi01.o Only in glpk-4.39.p4/src: glpapi02.lo Only in glpk-4.39.p4/src: glpapi02.o Only in glpk-4.39.p4/src: glpapi03.lo Only in glpk-4.39.p4/src: glpapi03.o Only in glpk-4.39.p4/src: glpapi04.lo Only in glpk-4.39.p4/src: glpapi04.o Only in glpk-4.39.p4/src: glpapi05.lo Only in glpk-4.39.p4/src: glpapi05.o diff -crB glpk-4.39/src/glpapi06.c glpk-4.39.p4/src/glpapi06.c *** glpk-4.39/src/glpapi06.c 2009-07-26 11:00:00.000000000 +0200 --- glpk-4.39.p4/src/glpapi06.c 2011-04-21 11:04:48.000000000 +0200 *************** *** 581,587 **** * structure, which the parameter parm points to. */ void glp_init_smcp(glp_smcp *parm) ! { parm->msg_lev = GLP_MSG_ALL; parm->meth = GLP_PRIMAL; parm->pricing = GLP_PT_PSE; parm->r_test = GLP_RT_HAR; --- 581,589 ---- * structure, which the parameter parm points to. */ void glp_init_smcp(glp_smcp *parm) ! { ! // parm->msg_lev = GLP_MSG_ALL; ! parm->msg_lev = GLP_MSG_OFF; parm->meth = GLP_PRIMAL; parm->pricing = GLP_PT_PSE; parm->r_test = GLP_RT_HAR; Only in glpk-4.39.p4/src: glpapi06.lo Only in glpk-4.39.p4/src: glpapi06.o Only in glpk-4.39.p4/src: glpapi07.lo Only in glpk-4.39.p4/src: glpapi07.o Only in glpk-4.39.p4/src: glpapi08.lo Only in glpk-4.39.p4/src: glpapi08.o diff -crB glpk-4.39/src/glpapi09.c glpk-4.39.p4/src/glpapi09.c *** glpk-4.39/src/glpapi09.c 2009-07-26 11:00:00.000000000 +0200 --- glpk-4.39.p4/src/glpapi09.c 2011-04-21 11:04:48.000000000 +0200 *************** *** 229,236 **** goto done; } /* it seems all is ok */ ! if (parm->msg_lev >= GLP_MSG_ALL) ! xprintf("Integer optimization begins...\n"); /* create the branch-and-bound tree */ #if 0 ((glp_iocp *)parm)->msg_lev = GLP_MSG_DBG; --- 229,236 ---- goto done; } /* it seems all is ok */ ! // if (parm->msg_lev >= GLP_MSG_ALL) ! // xprintf("Integer optimization begins...\n"); /* create the branch-and-bound tree */ #if 0 ((glp_iocp *)parm)->msg_lev = GLP_MSG_DBG; *************** *** 243,249 **** { case 0: if (tree->mip->mip_stat == GLP_FEAS) { if (parm->msg_lev >= GLP_MSG_ALL) ! xprintf("INTEGER OPTIMAL SOLUTION FOUND\n"); tree->mip->mip_stat = GLP_OPT; } else --- 243,249 ---- { case 0: if (tree->mip->mip_stat == GLP_FEAS) { if (parm->msg_lev >= GLP_MSG_ALL) ! // xprintf("INTEGER OPTIMAL SOLUTION FOUND\n"); tree->mip->mip_stat = GLP_OPT; } else *************** *** 398,407 **** int ni = lpx_get_num_int(prob); int nb = lpx_get_num_bin(prob); char s[50]; ! xprintf("glp_intopt: presolved MIP has %d row%s, %d column%s, " ! "%d non-zero%s\n", ! m, m == 1 ? "" : "s", n, n == 1 ? "" : "s", ! nnz, nnz == 1 ? "" : "s"); if (nb == 0) strcpy(s, "none of"); else if (ni == 1 && nb == 1) --- 398,407 ---- int ni = lpx_get_num_int(prob); int nb = lpx_get_num_bin(prob); char s[50]; ! // xprintf("glp_intopt: presolved MIP has %d row%s, %d column%s, " ! // "%d non-zero%s\n", ! // m, m == 1 ? "" : "s", n, n == 1 ? "" : "s", ! // nnz, nnz == 1 ? "" : "s"); if (nb == 0) strcpy(s, "none of"); else if (ni == 1 && nb == 1) *************** *** 412,420 **** strcpy(s, "all of"); else sprintf(s, "%d of", nb); ! xprintf( ! "glp_intopt: %d integer column%s, %s which %s binary\n", ! ni, ni == 1 ? "" : "s", s, nb == 1 ? "is" : "are"); } /* solve LP relaxation */ if (!term_out || parm->msg_lev < GLP_MSG_ALL) --- 412,420 ---- strcpy(s, "all of"); else sprintf(s, "%d of", nb); ! // xprintf( ! // "glp_intopt: %d integer column%s, %s which %s binary\n", ! // ni, ni == 1 ? "" : "s", s, nb == 1 ? "is" : "are"); } /* solve LP relaxation */ if (!term_out || parm->msg_lev < GLP_MSG_ALL) *************** *** 425,432 **** GLP_SF_GM | GLP_SF_EQ | GLP_SF_2N | GLP_SF_SKIP); glp_adv_basis(prob, 0); env->term_out = term_out; ! if (parm->msg_lev >= GLP_MSG_ALL) ! xprintf("Solving LP relaxation...\n"); prob->it_cnt = orig->it_cnt; { glp_smcp smcp; glp_init_smcp(&smcp); --- 425,432 ---- GLP_SF_GM | GLP_SF_EQ | GLP_SF_2N | GLP_SF_SKIP); glp_adv_basis(prob, 0); env->term_out = term_out; ! // if (parm->msg_lev >= GLP_MSG_ALL) ! // xprintf("Solving LP relaxation...\n"); prob->it_cnt = orig->it_cnt; { glp_smcp smcp; glp_init_smcp(&smcp); Only in glpk-4.39.p4/src: glpapi09.lo Only in glpk-4.39.p4/src: glpapi09.o Only in glpk-4.39.p4/src: glpapi10.lo Only in glpk-4.39.p4/src: glpapi10.o Only in glpk-4.39.p4/src: glpapi11.lo Only in glpk-4.39.p4/src: glpapi11.o Only in glpk-4.39.p4/src: glpapi12.lo Only in glpk-4.39.p4/src: glpapi12.o Only in glpk-4.39.p4/src: glpapi13.lo Only in glpk-4.39.p4/src: glpapi13.o Only in glpk-4.39.p4/src: glpapi14.lo Only in glpk-4.39.p4/src: glpapi14.o Only in glpk-4.39.p4/src: glpapi15.lo Only in glpk-4.39.p4/src: glpapi15.o Only in glpk-4.39.p4/src: glpapi16.lo Only in glpk-4.39.p4/src: glpapi16.o Only in glpk-4.39.p4/src: glpapi17.lo Only in glpk-4.39.p4/src: glpapi17.o Only in glpk-4.39.p4/src: glpapi18.lo Only in glpk-4.39.p4/src: glpapi18.o diff -crB glpk-4.39/src/glpapi19.c glpk-4.39.p4/src/glpapi19.c *** glpk-4.39/src/glpapi19.c 2009-07-26 11:00:00.000000000 +0200 --- glpk-4.39.p4/src/glpapi19.c 2011-05-03 08:49:44.000000000 +0200 *************** *** 1,1056 **** ! /* glpapi19.c (stand-alone LP/MIP solver) */ ! ! /*********************************************************************** ! * This code is part of GLPK (GNU Linear Programming Kit). ! * ! * Copyright (C) 2000,01,02,03,04,05,06,07,08,2009 Andrew Makhorin, ! * Department for Applied Informatics, Moscow Aviation Institute, ! * Moscow, Russia. All rights reserved. E-mail: . ! * ! * GLPK is free software: you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by ! * the Free Software Foundation, either version 3 of the License, or ! * (at your option) any later version. ! * ! * GLPK is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ! * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ! * License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with GLPK. If not, see . ! ***********************************************************************/ ! ! #define _GLPSTD_STDIO ! #include "glpapi.h" ! #include "glpgmp.h" ! ! struct csa ! { /* common storage area */ ! glp_prob *prob; ! /* LP/MIP problem object */ ! glp_bfcp bfcp; ! /* basis factorization control parameters */ ! glp_smcp smcp; ! /* simplex method control parameters */ ! glp_iptcp iptcp; ! /* interior-point method control parameters */ ! glp_iocp iocp; ! /* integer optimizer control parameters */ ! glp_tran *tran; ! /* model translator workspace */ ! glp_graph *graph; ! /* network problem object */ ! int format; ! /* problem file format: */ ! #define FMT_MPS_DECK 1 /* fixed MPS */ ! #define FMT_MPS_FILE 2 /* free MPS */ ! #define FMT_CPLEX_LP 3 /* CPLEX LP */ ! #define FMT_MATHPROG 4 /* MathProg */ ! #define FMT_MIN_COST 5 /* DIMACS min-cost flow */ ! #define FMT_MAX_FLOW 6 /* DIMACS maximum flow */ ! const char *in_file; ! /* name of input problem file */ ! #define DATA_MAX 10 ! /* maximal number of input data files */ ! int ndf; ! /* number of input data files specified */ ! const char *in_data[1+DATA_MAX]; ! /* name(s) of input data file(s) */ ! const char *out_dpy; ! /* name of output file to send display output; NULL means the ! display output is sent to the terminal */ ! int solution; ! /* solution type flag: */ ! #define SOL_BASIC 1 /* basic */ ! #define SOL_INTERIOR 2 /* interior-point */ ! #define SOL_INTEGER 3 /* mixed integer */ ! const char *in_res; ! /* name of input solution file in raw format */ ! int dir; ! /* optimization direction flag: ! 0 - not specified ! GLP_MIN - minimization ! GLP_MAX - maximization */ ! int scale; ! /* automatic problem scaling flag */ ! const char *out_sol; ! /* name of output solution file in printable format */ ! const char *out_res; ! /* name of output solution file in raw format */ ! const char *out_bnds; ! /* name of output sensitivity bounds file in printable format */ ! int check; ! /* input data checking flag; no solution is performed */ ! const char *new_name; ! /* new name to be assigned to the problem */ ! const char *out_mps; ! /* name of output problem file in fixed MPS format */ ! const char *out_freemps; ! /* name of output problem file in free MPS format */ ! const char *out_cpxlp; ! /* name of output problem file in CPLEX LP format */ ! const char *out_pb; ! /* name of output problem file in OPB format */ ! const char *out_npb; ! /* name of output problem file in normalized OPB format */ ! const char *log_file; ! /* name of output file to hardcopy terminal output */ ! int crash; ! /* initial basis option: */ ! #define USE_STD_BASIS 1 /* use standard basis */ ! #define USE_ADV_BASIS 2 /* use advanced basis */ ! #define USE_CPX_BASIS 3 /* use Bixby's basis */ ! int exact; ! /* flag to use glp_exact rather than glp_simplex */ ! int xcheck; ! /* flag to check final basis with glp_exact */ ! int nomip; ! /* flag to consider MIP as pure LP */ ! }; ! ! static void print_help(const char *my_name) ! { /* print help information */ ! xprintf("Usage: %s [options...] filename\n", my_name); ! xprintf("\n"); ! xprintf("General options:\n"); ! xprintf(" --mps read LP/MIP problem in fixed MPS fo" ! "rmat\n"); ! xprintf(" --freemps read LP/MIP problem in free MPS for" ! "mat (default)\n"); ! xprintf(" --cpxlp read LP/MIP problem in CPLEX LP for" ! "mat\n"); ! xprintf(" --math read LP/MIP model written in GNU Ma" ! "thProg modeling\n"); ! xprintf(" language\n"); ! xprintf(" -m filename, --model filename\n"); ! xprintf(" read model section and optional dat" ! "a section from\n"); ! xprintf(" filename (the same as --math)\n"); ! xprintf(" -d filename, --data filename\n"); ! xprintf(" read data section from filename (fo" ! "r --math only);\n"); ! xprintf(" if model file also has data section" ! ", it is ignored\n"); ! xprintf(" -y filename, --display filename\n"); ! xprintf(" send display output to filename (fo" ! "r --math only);\n"); ! xprintf(" by default the output is sent to te" ! "rminal\n"); ! xprintf(" --mincost read min-cost flow problem in DIMAC" ! "S format\n"); ! xprintf(" --maxflow read maximum flow problem in DIMACS" ! " format\n"); ! xprintf(" --simplex use simplex method (default)\n"); ! xprintf(" --interior use interior point method (LP only)" ! "\n"); ! xprintf(" -r filename, --read filename\n"); ! xprintf(" read solution from filename rather " ! "to find it with\n"); ! xprintf(" the solver\n"); ! xprintf(" --min minimization\n"); ! xprintf(" --max maximization\n"); ! xprintf(" --scale scale problem (default)\n"); ! xprintf(" --noscale do not scale problem\n"); ! xprintf(" -o filename, --output filename\n"); ! xprintf(" write solution to filename in print" ! "able format\n"); ! xprintf(" -w filename, --write filename\n"); ! xprintf(" write solution to filename in plain" ! " text format\n"); ! xprintf(" --bounds filename\n"); ! xprintf(" write sensitivity bounds to filenam" ! "e in printable\n"); ! xprintf(" format (LP only)\n"); ! xprintf(" --tmlim nnn limit solution time to nnn seconds " ! "\n"); ! xprintf(" --memlim nnn limit available memory to nnn megab" ! "ytes\n"); ! xprintf(" --check do not solve problem, check input d" ! "ata only\n"); ! xprintf(" --name probname change problem name to probname\n"); ! xprintf(" --wmps filename write problem to filename in fixed " ! "MPS format\n"); ! xprintf(" --wfreemps filename\n"); ! xprintf(" write problem to filename in free M" ! "PS format\n"); ! xprintf(" --wcpxlp filename write problem to filename in CPLEX " ! "LP format\n"); ! xprintf(" --wpb filename write problem to filename in OPB fo" ! "rmat\n"); ! xprintf(" --wnpb filename write problem to filename in normal" ! "ized OPB format\n"); ! xprintf(" --log filename write copy of terminal output to fi" ! "lename\n"); ! xprintf(" -h, --help display this help information and e" ! "xit\n"); ! xprintf(" -v, --version display program version and exit\n") ! ; ! xprintf("\n"); ! xprintf("LP basis factorization options:\n"); ! xprintf(" --luf LU + Forrest-Tomlin update\n"); ! xprintf(" (faster, less stable; default)\n"); ! xprintf(" --cbg LU + Schur complement + Bartels-Gol" ! "ub update\n"); ! xprintf(" (slower, more stable)\n"); ! xprintf(" --cgr LU + Schur complement + Givens rota" ! "tion update\n"); ! xprintf(" (slower, more stable)\n"); ! xprintf("\n"); ! xprintf("Options specific to simplex solver:\n"); ! xprintf(" --primal use primal simplex (default)\n"); ! xprintf(" --dual use dual simplex\n"); ! xprintf(" --std use standard initial basis of all s" ! "lacks\n"); ! xprintf(" --adv use advanced initial basis (default" ! ")\n"); ! xprintf(" --bib use Bixby's initial basis\n"); ! xprintf(" --steep use steepest edge technique (defaul" ! "t)\n"); ! xprintf(" --nosteep use standard \"textbook\" pricing\n" ! ); ! xprintf(" --relax use Harris' two-pass ratio test (de" ! "fault)\n"); ! xprintf(" --norelax use standard \"textbook\" ratio tes" ! "t\n"); ! xprintf(" --presol use presolver (default; assumes --s" ! "cale and --adv)\n"); ! xprintf(" --nopresol do not use presolver\n"); ! xprintf(" --exact use simplex method based on exact a" ! "rithmetic\n"); ! xprintf(" --xcheck check final basis using exact arith" ! "metic\n"); ! xprintf("\n"); ! xprintf("Options specific to interior-point solver:\n"); ! xprintf(" --nord use natural (original) ordering\n"); ! xprintf(" --qmd use quotient minimum degree orderin" ! "g\n"); ! xprintf(" --amd use approximate minimum degree orde" ! "ring (default)\n"); ! xprintf(" --symamd use approximate minimum degree orde" ! "ring\n"); ! xprintf("\n"); ! xprintf("Options specific to MIP solver:\n"); ! xprintf(" --nomip consider all integer variables as c" ! "ontinuous\n"); ! xprintf(" (allows solving MIP as pure LP)\n"); ! xprintf(" --first branch on first integer variable\n") ! ; ! xprintf(" --last branch on last integer variable\n"); ! xprintf(" --drtom branch using heuristic by Driebeck " ! "and Tomlin\n"); ! xprintf(" (default)\n"); ! xprintf(" --mostf branch on most fractional variable " ! "\n"); ! xprintf(" --dfs backtrack using depth first search " ! "\n"); ! xprintf(" --bfs backtrack using breadth first searc" ! "h\n"); ! xprintf(" --bestp backtrack using the best projection" ! " heuristic\n"); ! xprintf(" --bestb backtrack using node with best loca" ! "l bound\n"); ! xprintf(" (default)\n"); ! xprintf(" --intopt use MIP presolver (default)\n"); ! xprintf(" --nointopt do not use MIP presolver\n"); ! xprintf(" --binarize replace general integer variables b" ! "y binary ones\n"); ! xprintf(" (assumes --intopt)\n"); ! xprintf(" --fpump apply feasibility pump heuristic\n") ! ; ! xprintf(" --gomory generate Gomory's mixed integer cut" ! "s\n"); ! xprintf(" --mir generate MIR (mixed integer roundin" ! "g) cuts\n"); ! xprintf(" --cover generate mixed cover cuts\n"); ! xprintf(" --clique generate clique cuts\n"); ! xprintf(" --cuts generate all cuts above\n"); ! xprintf(" --mipgap tol set relative mip gap tolerance to t" ! "ol\n"); ! xprintf("\n"); ! xprintf("For description of the MPS and CPLEX LP formats see Refe" ! "rence Manual.\n"); ! xprintf("For description of the modeling language see \"GLPK: Mod" ! "eling Language\n"); ! xprintf("GNU MathProg\". Both documents are included in the GLPK " ! "distribution.\n"); ! xprintf("\n"); ! xprintf("See GLPK web page at .\n"); ! xprintf("\n"); ! xprintf("Please report bugs to .\n"); ! return; ! } ! ! static void print_version(int briefly) ! { /* print version information */ ! xprintf("GLPSOL: GLPK LP/MIP Solver %s\n", glp_version()); ! if (briefly) goto done; ! xprintf("\n"); ! xprintf("Copyright (C) 2008 Andrew Makhorin, Department for Appli" ! "ed Informatics,\n"); ! xprintf("Moscow Aviation Institute, Moscow, Russia. All rights re" ! "served.\n"); ! xprintf("\n"); ! xprintf("This program has ABSOLUTELY NO WARRANTY.\n"); ! xprintf("\n"); ! xprintf("This program is free software; you may re-distribute it " ! "under the terms\n"); ! xprintf("of the GNU General Public License version 3 or later.\n") ! ; ! done: return; ! } ! ! static int parse_cmdline(struct csa *csa, int argc, const char *argv[]) ! { /* parse command-line parameters */ ! int k; ! #define p(str) (strcmp(argv[k], str) == 0) ! for (k = 1; k < argc; k++) ! { if (p("--mps")) ! csa->format = FMT_MPS_DECK; ! else if (p("--freemps")) ! csa->format = FMT_MPS_FILE; ! else if (p("--cpxlp")) ! csa->format = FMT_CPLEX_LP; ! else if (p("--math") || p("-m") || p("--model")) ! csa->format = FMT_MATHPROG; ! else if (p("-d") || p("--data")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No input data file specified\n"); ! return 1; ! } ! if (csa->ndf == DATA_MAX) ! { xprintf("Too many input data files\n"); ! return 1; ! } ! csa->in_data[++(csa->ndf)] = argv[k]; ! } ! else if (p("-y") || p("--display")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No display output file specified\n"); ! return 1; ! } ! if (csa->out_dpy != NULL) ! { xprintf("Only one display output file allowed\n"); ! return 1; ! } ! csa->out_dpy = argv[k]; ! } ! else if (p("--mincost")) ! csa->format = FMT_MIN_COST; ! else if (p("--maxflow")) ! csa->format = FMT_MAX_FLOW; ! else if (p("--simplex")) ! csa->solution = SOL_BASIC; ! else if (p("--interior")) ! csa->solution = SOL_INTERIOR; ! else if (p("-r") || p("--read")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No input solution file specified\n"); ! return 1; ! } ! if (csa->in_res != NULL) ! { xprintf("Only one input solution file allowed\n"); ! return 1; ! } ! csa->in_res = argv[k]; ! } ! else if (p("--min")) ! csa->dir = GLP_MIN; ! else if (p("--max")) ! csa->dir = GLP_MAX; ! else if (p("--scale")) ! csa->scale = 1; ! else if (p("--noscale")) ! csa->scale = 0; ! else if (p("-o") || p("--output")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No output solution file specified\n"); ! return 1; ! } ! if (csa->out_sol != NULL) ! { xprintf("Only one output solution file allowed\n"); ! return 1; ! } ! csa->out_sol = argv[k]; ! } ! else if (p("-w") || p("--write")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No output solution file specified\n"); ! return 1; ! } ! if (csa->out_res != NULL) ! { xprintf("Only one output solution file allowed\n"); ! return 1; ! } ! csa->out_res = argv[k]; ! } ! else if (p("--bounds")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No sensitivity bounds output file specified\n"); ! return 1; ! } ! if (csa->out_bnds != NULL) ! { xprintf("Only one sensitivity bounds output file allowed" ! "\n"); ! return 1; ! } ! csa->out_bnds = argv[k]; ! } ! else if (p("--tmlim")) ! { int tm_lim; ! k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No time limit specified\n"); ! return 1; ! } ! if (str2int(argv[k], &tm_lim) || tm_lim < 0) ! { xprintf("Invalid time limit `%s'\n", argv[k]); ! return 1; ! } ! if (tm_lim <= INT_MAX / 1000) ! csa->smcp.tm_lim = csa->iocp.tm_lim = 1000 * tm_lim; ! else ! csa->smcp.tm_lim = csa->iocp.tm_lim = INT_MAX; ! } ! else if (p("--memlim")) ! { int mem_lim; ! k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No memory limit specified\n"); ! return 1; ! } ! if (str2int(argv[k], &mem_lim) || mem_lim < 1) ! { xprintf("Invalid memory limit `%s'\n", argv[k]); ! return 1; ! } ! glp_mem_limit(mem_lim); ! } ! else if (p("--check")) ! csa->check = 1; ! else if (p("--name")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No problem name specified\n"); ! return 1; ! } ! if (csa->new_name != NULL) ! { xprintf("Only one problem name allowed\n"); ! return 1; ! } ! csa->new_name = argv[k]; ! } ! else if (p("--wmps")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No fixed MPS output file specified\n"); ! return 1; ! } ! if (csa->out_mps != NULL) ! { xprintf("Only one fixed MPS output file allowed\n"); ! return 1; ! } ! csa->out_mps = argv[k]; ! } ! else if (p("--wfreemps")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No free MPS output file specified\n"); ! return 1; ! } ! if (csa->out_freemps != NULL) ! { xprintf("Only one free MPS output file allowed\n"); ! return 1; ! } ! csa->out_freemps = argv[k]; ! } ! else if (p("--wcpxlp") || p("--wlpt")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No CPLEX LP output file specified\n"); ! return 1; ! } ! if (csa->out_cpxlp != NULL) ! { xprintf("Only one CPLEX LP output file allowed\n"); ! return 1; ! } ! csa->out_cpxlp = argv[k]; ! } ! else if (p("--wpb")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No problem output file specified\n"); ! return 1; ! } ! if (csa->out_pb != NULL) ! { xprintf("Only one OPB output file allowed\n"); ! return 1; ! } ! csa->out_pb = argv[k]; ! } ! else if (p("--wnpb")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No problem output file specified\n"); ! return 1; ! } ! if (csa->out_npb != NULL) ! { xprintf("Only one normalized OPB output file allowed\n"); ! return 1; ! } ! csa->out_npb = argv[k]; ! } ! else if (p("--log")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No log file specified\n"); ! return 1; ! } ! if (csa->log_file != NULL) ! { xprintf("Only one log file allowed\n"); ! return 1; ! } ! csa->log_file = argv[k]; ! } ! else if (p("-h") || p("--help")) ! { print_help(argv[0]); ! return -1; ! } ! else if (p("-v") || p("--version")) ! { print_version(0); ! return -1; ! } ! else if (p("--luf")) ! csa->bfcp.type = GLP_BF_FT; ! else if (p("--cbg")) ! csa->bfcp.type = GLP_BF_BG; ! else if (p("--cgr")) ! csa->bfcp.type = GLP_BF_GR; ! else if (p("--primal")) ! csa->smcp.meth = GLP_PRIMAL; ! else if (p("--dual")) ! csa->smcp.meth = GLP_DUAL; ! else if (p("--std")) ! csa->crash = USE_STD_BASIS; ! else if (p("--adv")) ! csa->crash = USE_ADV_BASIS; ! else if (p("--bib")) ! csa->crash = USE_CPX_BASIS; ! else if (p("--steep")) ! csa->smcp.pricing = GLP_PT_PSE; ! else if (p("--nosteep")) ! csa->smcp.pricing = GLP_PT_STD; ! else if (p("--relax")) ! csa->smcp.r_test = GLP_RT_HAR; ! else if (p("--norelax")) ! csa->smcp.r_test = GLP_RT_STD; ! else if (p("--presol")) ! csa->smcp.presolve = GLP_ON; ! else if (p("--nopresol")) ! csa->smcp.presolve = GLP_OFF; ! else if (p("--exact")) ! csa->exact = 1; ! else if (p("--xcheck")) ! csa->xcheck = 1; ! else if (p("--nord")) ! csa->iptcp.ord_alg = GLP_ORD_NONE; ! else if (p("--qmd")) ! csa->iptcp.ord_alg = GLP_ORD_QMD; ! else if (p("--amd")) ! csa->iptcp.ord_alg = GLP_ORD_AMD; ! else if (p("--symamd")) ! csa->iptcp.ord_alg = GLP_ORD_SYMAMD; ! else if (p("--nomip")) ! csa->nomip = 1; ! else if (p("--first")) ! csa->iocp.br_tech = GLP_BR_FFV; ! else if (p("--last")) ! csa->iocp.br_tech = GLP_BR_LFV; ! else if (p("--drtom")) ! csa->iocp.br_tech = GLP_BR_DTH; ! else if (p("--mostf")) ! csa->iocp.br_tech = GLP_BR_MFV; ! else if (p("--pcost")) ! csa->iocp.br_tech = GLP_BR_HPC; ! else if (p("--dfs")) ! csa->iocp.bt_tech = GLP_BT_DFS; ! else if (p("--bfs")) ! csa->iocp.bt_tech = GLP_BT_BFS; ! else if (p("--bestp")) ! csa->iocp.bt_tech = GLP_BT_BPH; ! else if (p("--bestb")) ! csa->iocp.bt_tech = GLP_BT_BLB; ! else if (p("--intopt")) ! csa->iocp.presolve = GLP_ON; ! else if (p("--nointopt")) ! csa->iocp.presolve = GLP_OFF; ! else if (p("--binarize")) ! csa->iocp.presolve = csa->iocp.binarize = GLP_ON; ! else if (p("--fpump")) ! csa->iocp.fp_heur = GLP_ON; ! else if (p("--gomory")) ! csa->iocp.gmi_cuts = GLP_ON; ! else if (p("--mir")) ! csa->iocp.mir_cuts = GLP_ON; ! else if (p("--cover")) ! csa->iocp.cov_cuts = GLP_ON; ! else if (p("--clique")) ! csa->iocp.clq_cuts = GLP_ON; ! else if (p("--cuts")) ! csa->iocp.gmi_cuts = csa->iocp.mir_cuts = ! csa->iocp.cov_cuts = csa->iocp.clq_cuts = GLP_ON; ! else if (p("--mipgap")) ! { double mip_gap; ! k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No relative gap tolerance specified\n"); ! return 1; ! } ! if (str2num(argv[k], &mip_gap) || mip_gap < 0.0) ! { xprintf("Invalid relative mip gap tolerance `%s'\n", ! argv[k]); ! return 1; ! } ! csa->iocp.mip_gap = mip_gap; ! } ! else if (argv[k][0] == '-' || ! (argv[k][0] == '-' && argv[k][1] == '-')) ! { xprintf("Invalid option `%s'; try %s --help\n", ! argv[k], argv[0]); ! return 1; ! } ! else ! { if (csa->in_file != NULL) ! { xprintf("Only one input problem file allowed\n"); ! return 1; ! } ! csa->in_file = argv[k]; ! } ! } ! #undef p ! return 0; ! } ! ! typedef struct { double rhs, pi; } v_data; ! typedef struct { double low, cap, cost, x; } a_data; ! ! int glp_main(int argc, const char *argv[]) ! { /* stand-alone LP/MIP solver */ ! struct csa _csa, *csa = &_csa; ! int ret; ! xlong_t start; ! /* perform initialization */ ! csa->prob = glp_create_prob(); ! glp_get_bfcp(csa->prob, &csa->bfcp); ! glp_init_smcp(&csa->smcp); ! csa->smcp.presolve = GLP_ON; ! glp_init_iptcp(&csa->iptcp); ! glp_init_iocp(&csa->iocp); ! csa->iocp.presolve = GLP_ON; ! csa->tran = NULL; ! csa->graph = NULL; ! csa->format = FMT_MPS_FILE; ! csa->in_file = NULL; ! csa->ndf = 0; ! csa->out_dpy = NULL; ! csa->solution = SOL_BASIC; ! csa->in_res = NULL; ! csa->dir = 0; ! csa->scale = 1; ! csa->out_sol = NULL; ! csa->out_res = NULL; ! csa->out_bnds = NULL; ! csa->check = 0; ! csa->new_name = NULL; ! csa->out_mps = NULL; ! csa->out_freemps = NULL; ! csa->out_cpxlp = NULL; ! csa->out_pb = NULL; ! csa->out_npb = NULL; ! csa->log_file = NULL; ! csa->crash = USE_ADV_BASIS; ! csa->exact = 0; ! csa->xcheck = 0; ! csa->nomip = 0; ! /* parse command-line parameters */ ! ret = parse_cmdline(csa, argc, argv); ! if (ret < 0) ! { ret = EXIT_SUCCESS; ! goto done; ! } ! if (ret > 0) ! { ret = EXIT_FAILURE; ! goto done; ! } ! /*--------------------------------------------------------------*/ ! /* remove all output files specified in the command line */ ! if (csa->out_dpy != NULL) remove(csa->out_dpy); ! if (csa->out_sol != NULL) remove(csa->out_sol); ! if (csa->out_res != NULL) remove(csa->out_res); ! if (csa->out_bnds != NULL) remove(csa->out_bnds); ! if (csa->out_mps != NULL) remove(csa->out_mps); ! if (csa->out_freemps != NULL) remove(csa->out_freemps); ! if (csa->out_cpxlp != NULL) remove(csa->out_cpxlp); ! if (csa->out_pb != NULL) remove(csa->out_pb); ! if (csa->out_npb != NULL) remove(csa->out_npb); ! if (csa->log_file != NULL) remove(csa->log_file); ! /*--------------------------------------------------------------*/ ! /* open log file, if required */ ! if (csa->log_file != NULL) ! { if (lib_open_log(csa->log_file)) ! { xprintf("Unable to create log file\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! /*--------------------------------------------------------------*/ ! /* print version information */ ! print_version(1); ! /*--------------------------------------------------------------*/ ! /* read problem data from the input file */ ! if (csa->in_file == NULL) ! { xprintf("No input problem file specified; try %s --help\n", ! argv[0]); ! ret = EXIT_FAILURE; ! goto done; ! } ! if (csa->format == FMT_MPS_DECK) ! { ret = glp_read_mps(csa->prob, GLP_MPS_DECK, NULL, ! csa->in_file); ! if (ret != 0) ! err1: { xprintf("MPS file processing error\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! else if (csa->format == FMT_MPS_FILE) ! { ret = glp_read_mps(csa->prob, GLP_MPS_FILE, NULL, ! csa->in_file); ! if (ret != 0) goto err1; ! } ! else if (csa->format == FMT_CPLEX_LP) ! { ret = glp_read_lp(csa->prob, NULL, csa->in_file); ! if (ret != 0) ! { xprintf("CPLEX LP file processing error\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! else if (csa->format == FMT_MATHPROG) ! { int k; ! /* allocate the translator workspace */ ! csa->tran = glp_mpl_alloc_wksp(); ! /* read model section and optional data section */ ! if (glp_mpl_read_model(csa->tran, csa->in_file, csa->ndf > 0)) ! err2: { xprintf("MathProg model processing error\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! /* read optional data section(s), if necessary */ ! for (k = 1; k <= csa->ndf; k++) ! { if (glp_mpl_read_data(csa->tran, csa->in_data[k])) ! goto err2; ! } ! /* generate the model */ ! if (glp_mpl_generate(csa->tran, csa->out_dpy)) goto err2; ! /* build the problem instance from the model */ ! glp_mpl_build_prob(csa->tran, csa->prob); ! } ! else if (csa->format == FMT_MIN_COST) ! { csa->graph = glp_create_graph(sizeof(v_data), sizeof(a_data)); ! ret = glp_read_mincost(csa->graph, offsetof(v_data, rhs), ! offsetof(a_data, low), offsetof(a_data, cap), ! offsetof(a_data, cost), csa->in_file); ! if (ret != 0) ! { xprintf("DIMACS file processing error\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! glp_mincost_lp(csa->prob, csa->graph, GLP_ON, ! offsetof(v_data, rhs), offsetof(a_data, low), ! offsetof(a_data, cap), offsetof(a_data, cost)); ! glp_set_prob_name(csa->prob, csa->in_file); ! } ! else if (csa->format == FMT_MAX_FLOW) ! { int s, t; ! csa->graph = glp_create_graph(sizeof(v_data), sizeof(a_data)); ! ret = glp_read_maxflow(csa->graph, &s, &t, ! offsetof(a_data, cap), csa->in_file); ! if (ret != 0) ! { xprintf("DIMACS file processing error\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! glp_maxflow_lp(csa->prob, csa->graph, GLP_ON, s, t, ! offsetof(a_data, cap)); ! glp_set_prob_name(csa->prob, csa->in_file); ! } ! else ! xassert(csa != csa); ! /*--------------------------------------------------------------*/ ! /* change problem name, if required */ ! if (csa->new_name != NULL) ! glp_set_prob_name(csa->prob, csa->new_name); ! /* change optimization direction, if required */ ! if (csa->dir != 0) ! glp_set_obj_dir(csa->prob, csa->dir); ! /* order rows and columns of the constraint matrix */ ! lpx_order_matrix(csa->prob); ! /*--------------------------------------------------------------*/ ! /* write problem data in fixed MPS format, if required */ ! if (csa->out_mps != NULL) ! { ret = glp_write_mps(csa->prob, GLP_MPS_DECK, NULL, ! csa->out_mps); ! if (ret != 0) ! { xprintf("Unable to write problem in fixed MPS format\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! /* write problem data in free MPS format, if required */ ! if (csa->out_freemps != NULL) ! { ret = glp_write_mps(csa->prob, GLP_MPS_FILE, NULL, ! csa->out_freemps); ! if (ret != 0) ! { xprintf("Unable to write problem in free MPS format\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! /* write problem data in CPLEX LP format, if required */ ! if (csa->out_cpxlp != NULL) ! { ret = glp_write_lp(csa->prob, NULL, csa->out_cpxlp); ! if (ret != 0) ! { xprintf("Unable to write problem in CPLEX LP format\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! /* write problem data in OPB format, if required */ ! if (csa->out_pb != NULL) ! { ret = lpx_write_pb(csa->prob, csa->out_pb, 0, 0); ! if (ret != 0) ! { xprintf("Unable to write problem in OPB format\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! /* write problem data in normalized OPB format, if required */ ! if (csa->out_npb != NULL) ! { ret = lpx_write_pb(csa->prob, csa->out_npb, 1, 1); ! if (ret != 0) ! { xprintf( ! "Unable to write problem in normalized OPB format\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! /*--------------------------------------------------------------*/ ! /* if only problem data check is required, skip computations */ ! if (csa->check) ! { ret = EXIT_SUCCESS; ! goto done; ! } ! /*--------------------------------------------------------------*/ ! /* determine the solution type */ ! if (!csa->nomip && ! glp_get_num_int(csa->prob) + glp_get_num_bin(csa->prob) > 0) ! { if (csa->solution == SOL_INTERIOR) ! { xprintf("Interior-point method is not able to solve MIP pro" ! "blem; use --simplex\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! csa->solution = SOL_INTEGER; ! } ! /*--------------------------------------------------------------*/ ! /* if solution is provided, read it and skip computations */ ! if (csa->in_res != NULL) ! { if (csa->solution == SOL_BASIC) ! ret = glp_read_sol(csa->prob, csa->in_res); ! else if (csa->solution == SOL_INTERIOR) ! ret = glp_read_ipt(csa->prob, csa->in_res); ! else if (csa->solution == SOL_INTEGER) ! ret = glp_read_mip(csa->prob, csa->in_res); ! else ! xassert(csa != csa); ! if (ret != 0) ! { xprintf("Unable to read problem solution\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! goto skip; ! } ! /*--------------------------------------------------------------*/ ! /* scale the problem data, if required */ ! if (csa->scale) ! { if (csa->solution == SOL_BASIC && !csa->smcp.presolve || ! csa->solution == SOL_INTERIOR || ! csa->solution == SOL_INTEGER && !csa->iocp.presolve) ! glp_scale_prob(csa->prob, GLP_SF_AUTO); ! } ! /* construct starting LP basis */ ! if (csa->solution == SOL_BASIC && !csa->smcp.presolve || ! csa->solution == SOL_INTEGER && !csa->iocp.presolve) ! { if (csa->crash == USE_STD_BASIS) ! glp_std_basis(csa->prob); ! else if (csa->crash == USE_ADV_BASIS) ! glp_adv_basis(csa->prob, 0); ! else if (csa->crash == USE_CPX_BASIS) ! glp_cpx_basis(csa->prob); ! else ! xassert(csa != csa); ! } ! /*--------------------------------------------------------------*/ ! /* solve the problem */ ! start = xtime(); ! if (csa->solution == SOL_BASIC) ! { if (!csa->exact) ! { glp_set_bfcp(csa->prob, &csa->bfcp); ! glp_simplex(csa->prob, &csa->smcp); ! if (csa->xcheck) ! { if (csa->smcp.presolve && ! glp_get_status(csa->prob) != GLP_OPT) ! xprintf("If you need to check final basis for non-opt" ! "imal solution, use --nopresol\n"); ! else ! glp_exact(csa->prob, &csa->smcp); ! } ! if (csa->out_sol != NULL || csa->out_res != NULL) ! { if (csa->smcp.presolve && ! glp_get_status(csa->prob) != GLP_OPT) ! xprintf("If you need actual output for non-optimal solut" ! "ion, use --nopresol\n"); ! } ! } ! else ! glp_exact(csa->prob, &csa->smcp); ! } ! else if (csa->solution == SOL_INTERIOR) ! glp_interior(csa->prob, &csa->iptcp); ! else if (csa->solution == SOL_INTEGER) ! { if (!csa->iocp.presolve) ! { glp_set_bfcp(csa->prob, &csa->bfcp); ! glp_simplex(csa->prob, &csa->smcp); ! } ! #if 0 ! csa->iocp.msg_lev = GLP_MSG_DBG; ! csa->iocp.pp_tech = GLP_PP_NONE; ! #endif ! glp_intopt(csa->prob, &csa->iocp); ! } ! else ! xassert(csa != csa); ! /*--------------------------------------------------------------*/ ! /* display statistics */ ! xprintf("Time used: %.1f secs\n", xdifftime(xtime(), start)); ! { xlong_t tpeak; ! char buf[50]; ! lib_mem_usage(NULL, NULL, NULL, &tpeak); ! xprintf("Memory used: %.1f Mb (%s bytes)\n", ! xltod(tpeak) / 1048576.0, xltoa(tpeak, buf)); ! } ! /*--------------------------------------------------------------*/ ! skip: /* postsolve the model, if necessary */ ! if (csa->tran != NULL) ! { if (csa->solution == SOL_BASIC) ! ret = glp_mpl_postsolve(csa->tran, csa->prob, GLP_SOL); ! else if (csa->solution == SOL_INTERIOR) ! ret = glp_mpl_postsolve(csa->tran, csa->prob, GLP_IPT); ! else if (csa->solution == SOL_INTEGER) ! ret = glp_mpl_postsolve(csa->tran, csa->prob, GLP_MIP); ! else ! xassert(csa != csa); ! if (ret != 0) ! { xprintf("Model postsolving error\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! /*--------------------------------------------------------------*/ ! /* write problem solution in printable format, if required */ ! if (csa->out_sol != NULL) ! { if (csa->solution == SOL_BASIC) ! ret = lpx_print_sol(csa->prob, csa->out_sol); ! else if (csa->solution == SOL_INTERIOR) ! ret = lpx_print_ips(csa->prob, csa->out_sol); ! else if (csa->solution == SOL_INTEGER) ! ret = lpx_print_mip(csa->prob, csa->out_sol); ! else ! xassert(csa != csa); ! if (ret != 0) ! { xprintf("Unable to write problem solution\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! /* write problem solution in printable format, if required */ ! if (csa->out_res != NULL) ! { if (csa->solution == SOL_BASIC) ! ret = glp_write_sol(csa->prob, csa->out_res); ! else if (csa->solution == SOL_INTERIOR) ! ret = glp_write_ipt(csa->prob, csa->out_res); ! else if (csa->solution == SOL_INTEGER) ! ret = glp_write_mip(csa->prob, csa->out_res); ! else ! xassert(csa != csa); ! if (ret != 0) ! { xprintf("Unable to write problem solution\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! /* write sensitivity bounds information, if required */ ! if (csa->out_bnds != NULL) ! { if (csa->solution == SOL_BASIC) ! { ret = lpx_print_sens_bnds(csa->prob, csa->out_bnds); ! if (ret != 0) ! { xprintf("Unable to write sensitivity bounds information " ! "\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! else ! xprintf("Cannot write sensitivity bounds information for in" ! "terior-point or MIP solution\n"); ! } ! /*--------------------------------------------------------------*/ ! /* all seems to be ok */ ! ret = EXIT_SUCCESS; ! /*--------------------------------------------------------------*/ ! done: /* delete the LP/MIP problem object */ ! if (csa->prob != NULL) ! glp_delete_prob(csa->prob); ! /* free the translator workspace, if necessary */ ! if (csa->tran != NULL) ! glp_mpl_free_wksp(csa->tran); ! /* delete the network problem object, if necessary */ ! if (csa->graph != NULL) ! glp_delete_graph(csa->graph); ! xassert(gmp_pool_count() == 0); ! gmp_free_mem(); ! /* close log file, if necessary */ ! if (csa->log_file != NULL) lib_close_log(); ! /* check that no memory blocks are still allocated */ ! { int count; ! xlong_t total; ! lib_mem_usage(&count, NULL, &total, NULL); ! if (count != 0) ! xerror("Error: %d memory block(s) were lost\n", count); ! xassert(count == 0); ! xassert(total.lo == 0 && total.hi == 0); ! } ! /* free the library environment */ ! lib_free_env(); ! /* return to the control program */ ! return ret; ! } ! ! /* eof */ --- 1,982 ---- ! /* glpapi19.c (stand-alone LP/MIP solver) */ ! ! /*********************************************************************** ! * This code is part of GLPK (GNU Linear Programming Kit). ! * ! * Copyright (C) 2000,01,02,03,04,05,06,07,08,2009 Andrew Makhorin, ! * Department for Applied Informatics, Moscow Aviation Institute, ! * Moscow, Russia. All rights reserved. E-mail: . ! * ! * GLPK is free software: you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by ! * the Free Software Foundation, either version 3 of the License, or ! * (at your option) any later version. ! * ! * GLPK is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ! * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ! * License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with GLPK. If not, see . ! ***********************************************************************/ ! ! #define _GLPSTD_STDIO ! #include "glpapi.h" ! #include "glpgmp.h" ! ! struct csa ! { /* common storage area */ ! glp_prob *prob; ! /* LP/MIP problem object */ ! glp_bfcp bfcp; ! /* basis factorization control parameters */ ! glp_smcp smcp; ! /* simplex method control parameters */ ! glp_iptcp iptcp; ! /* interior-point method control parameters */ ! glp_iocp iocp; ! /* integer optimizer control parameters */ ! glp_tran *tran; ! /* model translator workspace */ ! glp_graph *graph; ! /* network problem object */ ! int format; ! /* problem file format: */ ! #define FMT_MPS_DECK 1 /* fixed MPS */ ! #define FMT_MPS_FILE 2 /* free MPS */ ! #define FMT_CPLEX_LP 3 /* CPLEX LP */ ! #define FMT_MATHPROG 4 /* MathProg */ ! #define FMT_MIN_COST 5 /* DIMACS min-cost flow */ ! #define FMT_MAX_FLOW 6 /* DIMACS maximum flow */ ! const char *in_file; ! /* name of input problem file */ ! #define DATA_MAX 10 ! /* maximal number of input data files */ ! int ndf; ! /* number of input data files specified */ ! const char *in_data[1+DATA_MAX]; ! /* name(s) of input data file(s) */ ! const char *out_dpy; ! /* name of output file to send display output; NULL means the ! display output is sent to the terminal */ ! int solution; ! /* solution type flag: */ ! #define SOL_BASIC 1 /* basic */ ! #define SOL_INTERIOR 2 /* interior-point */ ! #define SOL_INTEGER 3 /* mixed integer */ ! const char *in_res; ! /* name of input solution file in raw format */ ! int dir; ! /* optimization direction flag: ! 0 - not specified ! GLP_MIN - minimization ! GLP_MAX - maximization */ ! int scale; ! /* automatic problem scaling flag */ ! const char *out_sol; ! /* name of output solution file in printable format */ ! const char *out_res; ! /* name of output solution file in raw format */ ! const char *out_bnds; ! /* name of output sensitivity bounds file in printable format */ ! int check; ! /* input data checking flag; no solution is performed */ ! const char *new_name; ! /* new name to be assigned to the problem */ ! const char *out_mps; ! /* name of output problem file in fixed MPS format */ ! const char *out_freemps; ! /* name of output problem file in free MPS format */ ! const char *out_cpxlp; ! /* name of output problem file in CPLEX LP format */ ! const char *out_pb; ! /* name of output problem file in OPB format */ ! const char *out_npb; ! /* name of output problem file in normalized OPB format */ ! const char *log_file; ! /* name of output file to hardcopy terminal output */ ! int crash; ! /* initial basis option: */ ! #define USE_STD_BASIS 1 /* use standard basis */ ! #define USE_ADV_BASIS 2 /* use advanced basis */ ! #define USE_CPX_BASIS 3 /* use Bixby's basis */ ! int exact; ! /* flag to use glp_exact rather than glp_simplex */ ! int xcheck; ! /* flag to check final basis with glp_exact */ ! int nomip; ! /* flag to consider MIP as pure LP */ ! }; ! ! static void print_help(const char *my_name) ! { /* print help information */ ! xprintf("Usage: %s [options...] filename\n", my_name); ! xprintf("\n"); ! xprintf("General options:\n"); ! xprintf(" --mps read LP/MIP problem in fixed MPS fo" ! "rmat\n"); ! xprintf(" --freemps read LP/MIP problem in free MPS for" ! "mat (default)\n"); ! xprintf(" --cpxlp read LP/MIP problem in CPLEX LP for" ! "mat\n"); ! xprintf(" --math read LP/MIP model written in GNU Ma" ! "thProg modeling\n"); ! xprintf(" language\n"); ! xprintf(" -m filename, --model filename\n"); ! xprintf(" read model section and optional dat" ! "a section from\n"); ! xprintf(" filename (the same as --math)\n"); ! xprintf(" -d filename, --data filename\n"); ! xprintf(" read data section from filename (fo" ! "r --math only);\n"); ! xprintf(" if model file also has data section" ! ", it is ignored\n"); ! xprintf(" -y filename, --display filename\n"); ! xprintf(" send display output to filename (fo" ! "r --math only);\n"); ! xprintf(" by default the output is sent to te" ! "rminal\n"); ! xprintf(" --mincost read min-cost flow problem in DIMAC" ! "S format\n"); ! xprintf(" --maxflow read maximum flow problem in DIMACS" ! " format\n"); ! xprintf(" --simplex use simplex method (default)\n"); ! xprintf(" --interior use interior point method (LP only)" ! "\n"); ! xprintf(" -r filename, --read filename\n"); ! xprintf(" read solution from filename rather " ! "to find it with\n"); ! xprintf(" the solver\n"); ! xprintf(" --min minimization\n"); ! xprintf(" --max maximization\n"); ! xprintf(" --scale scale problem (default)\n"); ! xprintf(" --noscale do not scale problem\n"); ! xprintf(" -o filename, --output filename\n"); ! xprintf(" write solution to filename in print" ! "able format\n"); ! xprintf(" -w filename, --write filename\n"); ! xprintf(" write solution to filename in plain" ! " text format\n"); ! xprintf(" --bounds filename\n"); ! xprintf(" write sensitivity bounds to filenam" ! "e in printable\n"); ! xprintf(" format (LP only)\n"); ! xprintf(" --tmlim nnn limit solution time to nnn seconds " ! "\n"); ! xprintf(" --memlim nnn limit available memory to nnn megab" ! "ytes\n"); ! xprintf(" --check do not solve problem, check input d" ! "ata only\n"); ! xprintf(" --name probname change problem name to probname\n"); ! xprintf(" --wmps filename write problem to filename in fixed " ! "MPS format\n"); ! xprintf(" --wfreemps filename\n"); ! xprintf(" write problem to filename in free M" ! "PS format\n"); ! xprintf(" --wcpxlp filename write problem to filename in CPLEX " ! "LP format\n"); ! xprintf(" --wpb filename write problem to filename in OPB fo" ! "rmat\n"); ! xprintf(" --wnpb filename write problem to filename in normal" ! "ized OPB format\n"); ! xprintf(" --log filename write copy of terminal output to fi" ! "lename\n"); ! xprintf(" -h, --help display this help information and e" ! "xit\n"); ! xprintf(" -v, --version display program version and exit\n") ! ; ! xprintf("\n"); ! xprintf("LP basis factorization options:\n"); ! xprintf(" --luf LU + Forrest-Tomlin update\n"); ! xprintf(" (faster, less stable; default)\n"); ! xprintf(" --cbg LU + Schur complement + Bartels-Gol" ! "ub update\n"); ! xprintf(" (slower, more stable)\n"); ! xprintf(" --cgr LU + Schur complement + Givens rota" ! "tion update\n"); ! xprintf(" (slower, more stable)\n"); ! xprintf("\n"); ! xprintf("Options specific to simplex solver:\n"); ! xprintf(" --primal use primal simplex (default)\n"); ! xprintf(" --dual use dual simplex\n"); ! xprintf(" --std use standard initial basis of all s" ! "lacks\n"); ! xprintf(" --adv use advanced initial basis (default" ! ")\n"); ! xprintf(" --bib use Bixby's initial basis\n"); ! xprintf(" --steep use steepest edge technique (defaul" ! "t)\n"); ! xprintf(" --nosteep use standard \"textbook\" pricing\n" ! ); ! xprintf(" --relax use Harris' two-pass ratio test (de" ! "fault)\n"); ! xprintf(" --norelax use standard \"textbook\" ratio tes" ! "t\n"); ! xprintf(" --presol use presolver (default; assumes --s" ! "cale and --adv)\n"); ! xprintf(" --nopresol do not use presolver\n"); ! xprintf(" --exact use simplex method based on exact a" ! "rithmetic\n"); ! xprintf(" --xcheck check final basis using exact arith" ! "metic\n"); ! xprintf("\n"); ! xprintf("Options specific to interior-point solver:\n"); ! xprintf(" --nord use natural (original) ordering\n"); ! xprintf(" --qmd use quotient minimum degree orderin" ! "g\n"); ! xprintf(" --amd use approximate minimum degree orde" ! "ring (default)\n"); ! xprintf(" --symamd use approximate minimum degree orde" ! "ring\n"); ! xprintf("\n"); ! xprintf("Options specific to MIP solver:\n"); ! xprintf(" --nomip consider all integer variables as c" ! "ontinuous\n"); ! xprintf(" (allows solving MIP as pure LP)\n"); ! xprintf(" --first branch on first integer variable\n") ! ; ! xprintf(" --last branch on last integer variable\n"); ! xprintf(" --drtom branch using heuristic by Driebeck " ! "and Tomlin\n"); ! xprintf(" (default)\n"); ! xprintf(" --mostf branch on most fractional variable " ! "\n"); ! xprintf(" --dfs backtrack using depth first search " ! "\n"); ! xprintf(" --bfs backtrack using breadth first searc" ! "h\n"); ! xprintf(" --bestp backtrack using the best projection" ! " heuristic\n"); ! xprintf(" --bestb backtrack using node with best loca" ! "l bound\n"); ! xprintf(" (default)\n"); ! xprintf(" --intopt use MIP presolver (default)\n"); ! xprintf(" --nointopt do not use MIP presolver\n"); ! xprintf(" --binarize replace general integer variables b" ! "y binary ones\n"); ! xprintf(" (assumes --intopt)\n"); ! xprintf(" --fpump apply feasibility pump heuristic\n") ! ; ! xprintf(" --gomory generate Gomory's mixed integer cut" ! "s\n"); ! xprintf(" --mir generate MIR (mixed integer roundin" ! "g) cuts\n"); ! xprintf(" --cover generate mixed cover cuts\n"); ! xprintf(" --clique generate clique cuts\n"); ! xprintf(" --cuts generate all cuts above\n"); ! xprintf(" --mipgap tol set relative mip gap tolerance to t" ! "ol\n"); ! xprintf("\n"); ! xprintf("For description of the MPS and CPLEX LP formats see Refe" ! "rence Manual.\n"); ! xprintf("For description of the modeling language see \"GLPK: Mod" ! "eling Language\n"); ! xprintf("GNU MathProg\". Both documents are included in the GLPK " ! "distribution.\n"); ! xprintf("\n"); ! xprintf("See GLPK web page at .\n"); ! xprintf("\n"); ! xprintf("Please report bugs to .\n"); ! return; ! } ! ! static void print_version(int briefly) ! { /* print version information */ ! xprintf("GLPSOL: GLPK LP/MIP Solver %s\n", glp_version()); ! if (briefly) goto done; ! xprintf("\n"); ! xprintf("Copyright (C) 2008 Andrew Makhorin, Department for Appli" ! "ed Informatics,\n"); ! xprintf("Moscow Aviation Institute, Moscow, Russia. All rights re" ! "served.\n"); ! xprintf("\n"); ! xprintf("This program has ABSOLUTELY NO WARRANTY.\n"); ! xprintf("\n"); ! xprintf("This program is free software; you may re-distribute it " ! "under the terms\n"); ! xprintf("of the GNU General Public License version 3 or later.\n") ! ; ! done: return; ! } ! ! static int parse_cmdline(struct csa *csa, int argc, const char *argv[]) ! { /* parse command-line parameters */ ! int k; ! #define p(str) (strcmp(argv[k], str) == 0) ! for (k = 1; k < argc; k++) ! { if (p("--mps")) ! csa->format = FMT_MPS_DECK; ! else if (p("--freemps")) ! csa->format = FMT_MPS_FILE; ! else if (p("--cpxlp")) ! csa->format = FMT_CPLEX_LP; ! else if (p("--math") || p("-m") || p("--model")) ! csa->format = FMT_MATHPROG; ! else if (p("-d") || p("--data")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No input data file specified\n"); ! return 1; ! } ! if (csa->ndf == DATA_MAX) ! { xprintf("Too many input data files\n"); ! return 1; ! } ! csa->in_data[++(csa->ndf)] = argv[k]; ! } ! else if (p("-y") || p("--display")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No display output file specified\n"); ! return 1; ! } ! if (csa->out_dpy != NULL) ! { xprintf("Only one display output file allowed\n"); ! return 1; ! } ! csa->out_dpy = argv[k]; ! } ! else if (p("--mincost")) ! csa->format = FMT_MIN_COST; ! else if (p("--maxflow")) ! csa->format = FMT_MAX_FLOW; ! else if (p("--simplex")) ! csa->solution = SOL_BASIC; ! else if (p("--interior")) ! csa->solution = SOL_INTERIOR; ! else if (p("-r") || p("--read")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No input solution file specified\n"); ! return 1; ! } ! if (csa->in_res != NULL) ! { xprintf("Only one input solution file allowed\n"); ! return 1; ! } ! csa->in_res = argv[k]; ! } ! else if (p("--min")) ! csa->dir = GLP_MIN; ! else if (p("--max")) ! csa->dir = GLP_MAX; ! else if (p("--scale")) ! csa->scale = 1; ! else if (p("--noscale")) ! csa->scale = 0; ! else if (p("-o") || p("--output")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No output solution file specified\n"); ! return 1; ! } ! if (csa->out_sol != NULL) ! { xprintf("Only one output solution file allowed\n"); ! return 1; ! } ! csa->out_sol = argv[k]; ! } ! else if (p("-w") || p("--write")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No output solution file specified\n"); ! return 1; ! } ! if (csa->out_res != NULL) ! { xprintf("Only one output solution file allowed\n"); ! return 1; ! } ! csa->out_res = argv[k]; ! } ! else if (p("--bounds")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No sensitivity bounds output file specified\n"); ! return 1; ! } ! if (csa->out_bnds != NULL) ! { xprintf("Only one sensitivity bounds output file allowed" ! "\n"); ! return 1; ! } ! csa->out_bnds = argv[k]; ! } ! else if (p("--tmlim")) ! { int tm_lim; ! k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No time limit specified\n"); ! return 1; ! } ! if (str2int(argv[k], &tm_lim) || tm_lim < 0) ! { xprintf("Invalid time limit `%s'\n", argv[k]); ! return 1; ! } ! if (tm_lim <= INT_MAX / 1000) ! csa->smcp.tm_lim = csa->iocp.tm_lim = 1000 * tm_lim; ! else ! csa->smcp.tm_lim = csa->iocp.tm_lim = INT_MAX; ! } ! else if (p("--memlim")) ! { int mem_lim; ! k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No memory limit specified\n"); ! return 1; ! } ! if (str2int(argv[k], &mem_lim) || mem_lim < 1) ! { xprintf("Invalid memory limit `%s'\n", argv[k]); ! return 1; ! } ! glp_mem_limit(mem_lim); ! } ! else if (p("--check")) ! csa->check = 1; ! else if (p("--name")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No problem name specified\n"); ! return 1; ! } ! if (csa->new_name != NULL) ! { xprintf("Only one problem name allowed\n"); ! return 1; ! } ! csa->new_name = argv[k]; ! } ! else if (p("--wmps")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No fixed MPS output file specified\n"); ! return 1; ! } ! if (csa->out_mps != NULL) ! { xprintf("Only one fixed MPS output file allowed\n"); ! return 1; ! } ! csa->out_mps = argv[k]; ! } ! else if (p("--wfreemps")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No free MPS output file specified\n"); ! return 1; ! } ! if (csa->out_freemps != NULL) ! { xprintf("Only one free MPS output file allowed\n"); ! return 1; ! } ! csa->out_freemps = argv[k]; ! } ! else if (p("--wcpxlp") || p("--wlpt")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No CPLEX LP output file specified\n"); ! return 1; ! } ! if (csa->out_cpxlp != NULL) ! { xprintf("Only one CPLEX LP output file allowed\n"); ! return 1; ! } ! csa->out_cpxlp = argv[k]; ! } ! else if (p("--wpb")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No problem output file specified\n"); ! return 1; ! } ! if (csa->out_pb != NULL) ! { xprintf("Only one OPB output file allowed\n"); ! return 1; ! } ! csa->out_pb = argv[k]; ! } ! else if (p("--wnpb")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No problem output file specified\n"); ! return 1; ! } ! if (csa->out_npb != NULL) ! { xprintf("Only one normalized OPB output file allowed\n"); ! return 1; ! } ! csa->out_npb = argv[k]; ! } ! else if (p("--log")) ! { k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No log file specified\n"); ! return 1; ! } ! if (csa->log_file != NULL) ! { xprintf("Only one log file allowed\n"); ! return 1; ! } ! csa->log_file = argv[k]; ! } ! else if (p("-h") || p("--help")) ! { print_help(argv[0]); ! return -1; ! } ! else if (p("-v") || p("--version")) ! { print_version(0); ! return -1; ! } ! else if (p("--luf")) ! csa->bfcp.type = GLP_BF_FT; ! else if (p("--cbg")) ! csa->bfcp.type = GLP_BF_BG; ! else if (p("--cgr")) ! csa->bfcp.type = GLP_BF_GR; ! else if (p("--primal")) ! csa->smcp.meth = GLP_PRIMAL; ! else if (p("--dual")) ! csa->smcp.meth = GLP_DUAL; ! else if (p("--std")) ! csa->crash = USE_STD_BASIS; ! else if (p("--adv")) ! csa->crash = USE_ADV_BASIS; ! else if (p("--bib")) ! csa->crash = USE_CPX_BASIS; ! else if (p("--steep")) ! csa->smcp.pricing = GLP_PT_PSE; ! else if (p("--nosteep")) ! csa->smcp.pricing = GLP_PT_STD; ! else if (p("--relax")) ! csa->smcp.r_test = GLP_RT_HAR; ! else if (p("--norelax")) ! csa->smcp.r_test = GLP_RT_STD; ! else if (p("--presol")) ! csa->smcp.presolve = GLP_ON; ! else if (p("--nopresol")) ! csa->smcp.presolve = GLP_OFF; ! else if (p("--exact")) ! csa->exact = 1; ! else if (p("--xcheck")) ! csa->xcheck = 1; ! else if (p("--nord")) ! csa->iptcp.ord_alg = GLP_ORD_NONE; ! else if (p("--qmd")) ! csa->iptcp.ord_alg = GLP_ORD_QMD; ! else if (p("--amd")) ! csa->iptcp.ord_alg = GLP_ORD_AMD; ! else if (p("--symamd")) ! csa->iptcp.ord_alg = GLP_ORD_SYMAMD; ! else if (p("--nomip")) ! csa->nomip = 1; ! else if (p("--first")) ! csa->iocp.br_tech = GLP_BR_FFV; ! else if (p("--last")) ! csa->iocp.br_tech = GLP_BR_LFV; ! else if (p("--drtom")) ! csa->iocp.br_tech = GLP_BR_DTH; ! else if (p("--mostf")) ! csa->iocp.br_tech = GLP_BR_MFV; ! else if (p("--pcost")) ! csa->iocp.br_tech = GLP_BR_HPC; ! else if (p("--dfs")) ! csa->iocp.bt_tech = GLP_BT_DFS; ! else if (p("--bfs")) ! csa->iocp.bt_tech = GLP_BT_BFS; ! else if (p("--bestp")) ! csa->iocp.bt_tech = GLP_BT_BPH; ! else if (p("--bestb")) ! csa->iocp.bt_tech = GLP_BT_BLB; ! else if (p("--intopt")) ! csa->iocp.presolve = GLP_ON; ! else if (p("--nointopt")) ! csa->iocp.presolve = GLP_OFF; ! else if (p("--binarize")) ! csa->iocp.presolve = csa->iocp.binarize = GLP_ON; ! else if (p("--fpump")) ! csa->iocp.fp_heur = GLP_ON; ! else if (p("--gomory")) ! csa->iocp.gmi_cuts = GLP_ON; ! else if (p("--mir")) ! csa->iocp.mir_cuts = GLP_ON; ! else if (p("--cover")) ! csa->iocp.cov_cuts = GLP_ON; ! else if (p("--clique")) ! csa->iocp.clq_cuts = GLP_ON; ! else if (p("--cuts")) ! csa->iocp.gmi_cuts = csa->iocp.mir_cuts = ! csa->iocp.cov_cuts = csa->iocp.clq_cuts = GLP_ON; ! else if (p("--mipgap")) ! { double mip_gap; ! k++; ! if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') ! { xprintf("No relative gap tolerance specified\n"); ! return 1; ! } ! if (str2num(argv[k], &mip_gap) || mip_gap < 0.0) ! { xprintf("Invalid relative mip gap tolerance `%s'\n", ! argv[k]); ! return 1; ! } ! csa->iocp.mip_gap = mip_gap; ! } ! else if (argv[k][0] == '-' || ! (argv[k][0] == '-' && argv[k][1] == '-')) ! { xprintf("Invalid option `%s'; try %s --help\n", ! argv[k], argv[0]); ! return 1; ! } ! else ! { if (csa->in_file != NULL) ! { xprintf("Only one input problem file allowed\n"); ! return 1; ! } ! csa->in_file = argv[k]; ! } ! } ! #undef p ! return 0; ! } ! ! typedef struct { double rhs, pi; } v_data; ! typedef struct { double low, cap, cost, x; } a_data; ! int glp_main( ! int nRows, char *nameRows[], int typeRows[], // ROWS info ! int NStructVar, int NStructRows, int NRowsInWhichStructVarArePresent[], // COLUMNS info ! char *StructVarName[],char *NameRowsInWhichStructVarArePresent[], // COLUMNS info ! double *Coefficients, // COLUMNS info ! double ValueB[], // RHS info ! int nRanges, double ValueRanges[], char* NameRanges[], // RANGES info ! int nBounds, double BoundValue[], char *BoundStructVarName[], char *TypeofBound[] // BOUNDS info ! // ,int argc, const char *argv[] ! ,double final_values[]) ! { ! ! int status=glp_main_t( nRows, nameRows, typeRows, // ROWS info ! NStructVar, NStructRows, NRowsInWhichStructVarArePresent, // COLUMNS info ! StructVarName,NameRowsInWhichStructVarArePresent, // COLUMNS info ! Coefficients, // COLUMNS info ! ValueB, // RHS info ! nRanges, ValueRanges,NameRanges, // RANGES info ! nBounds, BoundValue, BoundStructVarName, TypeofBound // BOUNDS info ! // ,int argc, const char *argv[] ! ,final_values, 60) ; ! return status; ! } ! int glp_main_t( ! int nRows, char *nameRows[], int typeRows[], // ROWS info ! int NStructVar, int NStructRows, int NRowsInWhichStructVarArePresent[], // COLUMNS info ! char *StructVarName[],char *NameRowsInWhichStructVarArePresent[], // COLUMNS info ! double *Coefficients, // COLUMNS info ! double ValueB[], // RHS info ! int nRanges, double ValueRanges[], char* NameRanges[], // RANGES info ! int nBounds, double BoundValue[], char *BoundStructVarName[], char *TypeofBound[] // BOUNDS info ! // ,int argc, const char *argv[] ! ,double final_values[], int timelimit ! ) ! { /* stand-alone LP/MIP solver */ ! ! struct csa _csa, *csa = &_csa; ! ! int exitstatus; ! int ret; ! xlong_t start; ! /* perform initialization */ ! csa->prob = glp_create_prob(); ! glp_get_bfcp(csa->prob, &csa->bfcp); ! glp_init_smcp(&csa->smcp); ! csa->smcp.presolve = GLP_ON; ! glp_init_iptcp(&csa->iptcp); ! glp_init_iocp(&csa->iocp); ! csa->iocp.presolve = GLP_ON; ! csa->tran = NULL; ! csa->graph = NULL; ! csa->format = FMT_MPS_FILE; ! csa->in_file = NULL; ! csa->ndf = 0; ! csa->out_dpy = NULL; ! csa->solution = SOL_BASIC; ! csa->in_res = NULL; ! csa->dir = 0; ! csa->scale = 1; ! csa->out_sol = NULL; ! csa->out_res = NULL; ! csa->out_bnds = NULL; ! csa->check = 0; ! csa->new_name = NULL; ! csa->out_mps = NULL; ! csa->out_freemps = NULL; ! csa->out_cpxlp = NULL; ! csa->out_pb = NULL; ! csa->out_npb = NULL; ! csa->log_file = NULL; ! csa->crash = USE_ADV_BASIS; ! csa->exact = 0; ! csa->xcheck = 0; ! csa->nomip = 0; ! /* ------------------------------------------------- */ ! /* Gianluigi, added on 13-4-2011 */ ! /* timelimit is given in seconds. */ ! csa->smcp.tm_lim = csa->iocp.tm_lim = 1000*timelimit; ! ! /* ------------------------------------------------- */ ! /* parse command-line parameters */ ! ! ! // ret = parse_cmdline(csa, argc, argv); ! ! ret=0; ! csa->dir=GLP_MIN; // option : --min , it is for finding the MINIMUM ! csa->out_sol="dummy_out"; ! csa->in_file="dummy_in"; ! if (ret < 0) ! { ret = EXIT_SUCCESS; ! goto done; ! } ! if (ret > 0) ! { ret = EXIT_FAILURE; ! goto done; ! } ! /*--------------------------------------------------------------*/ ! /* remove all output files specified in the command line */ ! if (csa->out_dpy != NULL) remove(csa->out_dpy); ! // if (csa->out_sol != NULL) remove(csa->out_sol); ! if (csa->out_res != NULL) remove(csa->out_res); ! if (csa->out_bnds != NULL) remove(csa->out_bnds); ! if (csa->out_mps != NULL) remove(csa->out_mps); ! if (csa->out_freemps != NULL) remove(csa->out_freemps); ! if (csa->out_cpxlp != NULL) remove(csa->out_cpxlp); ! if (csa->out_pb != NULL) remove(csa->out_pb); ! if (csa->out_npb != NULL) remove(csa->out_npb); ! if (csa->log_file != NULL) remove(csa->log_file); ! /*--------------------------------------------------------------*/ ! /* open log file, if required */ ! if (csa->log_file != NULL) ! { if (lib_open_log(csa->log_file)) ! { xprintf("Unable to create log file\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! /*--------------------------------------------------------------*/ ! /* print version information */ ! // print_version(1); ! /*--------------------------------------------------------------*/ ! /* read problem data from the input file */ ! ! ! ret = glp_read_mps( ! nRows,nameRows,typeRows, // ROWS info ! NStructVar, NStructRows, NRowsInWhichStructVarArePresent, // COLUMNS info ! StructVarName, NameRowsInWhichStructVarArePresent, // COLUMNS info ! Coefficients, // COLUMNS info ! ValueB, // RHS info ! nRanges, ValueRanges, NameRanges, // RANGES info ! nBounds, BoundValue, BoundStructVarName, TypeofBound, // BOUNDS info ! csa->prob, GLP_MPS_FILE, NULL, ! csa->in_file); ! ! ! ! ! if (!csa->nomip && ! glp_get_num_int(csa->prob) + glp_get_num_bin(csa->prob) > 0) ! { if (csa->solution == SOL_INTERIOR) ! { xprintf("Interior-point method is not able to solve MIP pro" ! "blem; use --simplex\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! csa->solution = SOL_INTEGER; ! } ! /*--------------------------------------------------------------*/ ! /* if solution is provided, read it and skip computations */ ! ! /*--------------------------------------------------------------*/ ! /* scale the problem data, if required */ ! if (csa->scale) ! { if (csa->solution == SOL_BASIC && !csa->smcp.presolve || ! csa->solution == SOL_INTERIOR || ! csa->solution == SOL_INTEGER && !csa->iocp.presolve) ! glp_scale_prob(csa->prob, GLP_SF_AUTO); ! } ! /* construct starting LP basis */ ! if (csa->solution == SOL_BASIC && !csa->smcp.presolve || ! csa->solution == SOL_INTEGER && !csa->iocp.presolve) ! { if (csa->crash == USE_STD_BASIS) ! glp_std_basis(csa->prob); ! else if (csa->crash == USE_ADV_BASIS) ! glp_adv_basis(csa->prob, 0); ! else if (csa->crash == USE_CPX_BASIS) ! glp_cpx_basis(csa->prob); ! else ! xassert(csa != csa); ! } ! /*--------------------------------------------------------------*/ ! /* solve the problem */ ! ! start = xtime(); ! if (csa->solution == SOL_BASIC) ! { if (!csa->exact) ! { glp_set_bfcp(csa->prob, &csa->bfcp); ! glp_simplex(csa->prob, &csa->smcp); ! if (csa->xcheck) ! { if (csa->smcp.presolve && ! glp_get_status(csa->prob) != GLP_OPT) ! xprintf("If you need to check final basis for non-opt" ! "imal solution, use --nopresol\n"); ! else ! glp_exact(csa->prob, &csa->smcp); ! } ! if (csa->out_sol != NULL || csa->out_res != NULL) ! { if (csa->smcp.presolve && ! glp_get_status(csa->prob) != GLP_OPT) ! xprintf("If you need actual output for non-optimal solut" ! "ion, use --nopresol\n"); ! } ! } ! else ! glp_exact(csa->prob, &csa->smcp); ! } ! else if (csa->solution == SOL_INTERIOR) ! glp_interior(csa->prob, &csa->iptcp); ! else if (csa->solution == SOL_INTEGER) ! { if (!csa->iocp.presolve) ! { glp_set_bfcp(csa->prob, &csa->bfcp); ! glp_simplex(csa->prob, &csa->smcp); ! } ! exitstatus=glp_intopt(csa->prob, &csa->iocp); ! } ! else ! xassert(csa != csa); ! /*--------------------------------------------------------------*/ ! /* display statistics */ ! /* ! xprintf("Time used: %.1f secs\n", xdifftime(xtime(), start)); ! { xlong_t tpeak; ! char buf[50]; ! lib_mem_usage(NULL, NULL, NULL, &tpeak); ! xprintf("Memory used: %.1f Mb (%s bytes)\n", ! xltod(tpeak) / 1048576.0, xltoa(tpeak, buf)); ! } ! ! /*--------------------------------------------------------------*/ ! skip: /* postsolve the model, if necessary */ ! if (csa->tran != NULL) ! { if (csa->solution == SOL_BASIC) ! ret = glp_mpl_postsolve(csa->tran, csa->prob, GLP_SOL); ! else if (csa->solution == SOL_INTERIOR) ! ret = glp_mpl_postsolve(csa->tran, csa->prob, GLP_IPT); ! else if (csa->solution == SOL_INTEGER) ! ret = glp_mpl_postsolve(csa->tran, csa->prob, GLP_MIP); ! else ! xassert(csa != csa); ! if (ret != 0) ! { xprintf("Model postsolving error\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! /*--------------------------------------------------------------*/ ! /* write problem solution in printable format, if required */ ! if (csa->out_sol != NULL) ! { ! ! if (csa->solution == SOL_BASIC) ! ret = lpx_print_sol(csa->prob, csa->out_sol); ! else if (csa->solution == SOL_INTERIOR) ! ret = lpx_print_ips(csa->prob, csa->out_sol); ! else if (csa->solution == SOL_INTEGER) ! { ! // ! //---------------------- passing out the final values of the fit ! int ica; ! for(ica=1;ica<=NStructVar;ica++){ ! final_values[ica-1] = csa->prob->col[ica]->mipx; ! } ! //---------------------------------------------------------------- ! // final printout of the MIP problem result ! // ret = lpx_print_mip(csa->prob, csa->out_sol); ! // ! //---------------------------------------------------------------- ! ! // ret=0; ! ! } ! else ! xassert(csa != csa); ! if (ret != 0) ! { xprintf("Unable to write problem solution\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } /* end of if (csa->out_sol != NULL) */ ! ! /* write problem solution in printable format, if required */ ! if (csa->out_res != NULL) ! { ! if (csa->solution == SOL_BASIC) ! ret = glp_write_sol(csa->prob, csa->out_res); ! else if (csa->solution == SOL_INTERIOR) ! ret = glp_write_ipt(csa->prob, csa->out_res); ! else if (csa->solution == SOL_INTEGER) ! ret = glp_write_mip(csa->prob, csa->out_res); ! else ! xassert(csa != csa); ! if (ret != 0) ! { xprintf("Unable to write problem solution\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } /* end of if (csa->out_res != NULL) for the second time. ! ! ! /* write sensitivity bounds information, if required */ ! if (csa->out_bnds != NULL) ! { if (csa->solution == SOL_BASIC) ! { ret = lpx_print_sens_bnds(csa->prob, csa->out_bnds); ! if (ret != 0) ! { xprintf("Unable to write sensitivity bounds information " ! "\n"); ! ret = EXIT_FAILURE; ! goto done; ! } ! } ! else ! xprintf("Cannot write sensitivity bounds information for in" ! "terior-point or MIP solution\n"); ! } /* end of if (csa->out_bnds != NULL) */ ! /*--------------------------------------------------------------*/ ! /* all seems to be ok */ ! ret = EXIT_SUCCESS; ! /*--------------------------------------------------------------*/ ! done: /* delete the LP/MIP problem object */ ! if (csa->prob != NULL) ! glp_delete_prob(csa->prob); ! /* free the translator workspace, if necessary */ ! if (csa->tran != NULL) ! glp_mpl_free_wksp(csa->tran); ! /* delete the network problem object, if necessary */ ! if (csa->graph != NULL) ! glp_delete_graph(csa->graph); ! xassert(gmp_pool_count() == 0); ! gmp_free_mem(); ! /* close log file, if necessary */ ! if (csa->log_file != NULL) lib_close_log(); ! /* check that no memory blocks are still allocated */ ! { int count; ! xlong_t total; ! lib_mem_usage(&count, NULL, &total, NULL); ! if (count != 0) ! xerror("Error: %d memory block(s) were lost\n", count); ! xassert(count == 0); ! xassert(total.lo == 0 && total.hi == 0); ! } ! /* free the library environment */ ! lib_free_env(); ! /* return to the control program */ ! // return ret; ! return exitstatus; ! } ! ! /* eof */ ! Only in glpk-4.39.p4/src: glpapi19.lo Only in glpk-4.39.p4/src: glpapi19.o Only in glpk-4.39.p4/src: glpavl.lo Only in glpk-4.39.p4/src: glpavl.o Only in glpk-4.39.p4/src: glpbfd.lo Only in glpk-4.39.p4/src: glpbfd.o Only in glpk-4.39.p4/src: glpbfx.lo Only in glpk-4.39.p4/src: glpbfx.o Only in glpk-4.39.p4/src: glpcpx.lo Only in glpk-4.39.p4/src: glpcpx.o Only in glpk-4.39.p4/src: glpdmp.lo Only in glpk-4.39.p4/src: glpdmp.o Only in glpk-4.39.p4/src: glpdmx.lo Only in glpk-4.39.p4/src: glpdmx.o Only in glpk-4.39.p4/src: glpfhv.lo Only in glpk-4.39.p4/src: glpfhv.o Only in glpk-4.39.p4/src: glpgmp.lo Only in glpk-4.39.p4/src: glpgmp.o Only in glpk-4.39.p4/src: glphbm.lo Only in glpk-4.39.p4/src: glphbm.o diff -crB glpk-4.39/src/glpini01.c glpk-4.39.p4/src/glpini01.c *** glpk-4.39/src/glpini01.c 2009-07-26 11:00:00.000000000 +0200 --- glpk-4.39.p4/src/glpini01.c 2011-04-21 11:04:48.000000000 +0200 *************** *** 452,458 **** int *rn, *cn, *rn_inv, *cn_inv; int typx, *tagx = xcalloc(1+m+n, sizeof(int)); double lb, ub; ! xprintf("Constructing initial basis...\n"); #if 0 /* 13/V-2009 */ if (m == 0) xerror("glp_adv_basis: problem has no rows\n"); --- 452,458 ---- int *rn, *cn, *rn_inv, *cn_inv; int typx, *tagx = xcalloc(1+m+n, sizeof(int)); double lb, ub; ! // xprintf("Constructing initial basis...\n"); #if 0 /* 13/V-2009 */ if (m == 0) xerror("glp_adv_basis: problem has no rows\n"); *************** *** 472,479 **** rn = xcalloc(1+m, sizeof(int)); cn = xcalloc(1+m+n, sizeof(int)); size = triang(m, m+n, lp, mat, rn, cn); ! if (lpx_get_int_parm(lp, LPX_K_MSGLEV) >= 3) ! xprintf("Size of triangular part = %d\n", size); /* the first size rows and columns of the matrix P*A~*Q (where P and Q are permutation matrices defined by the arrays rn and cn) form a lower triangular matrix; build the arrays (rn_inv --- 472,479 ---- rn = xcalloc(1+m, sizeof(int)); cn = xcalloc(1+m+n, sizeof(int)); size = triang(m, m+n, lp, mat, rn, cn); ! // if (lpx_get_int_parm(lp, LPX_K_MSGLEV) >= 3) ! // xprintf("Size of triangular part = %d\n", size); /* the first size rows and columns of the matrix P*A~*Q (where P and Q are permutation matrices defined by the arrays rn and cn) form a lower triangular matrix; build the arrays (rn_inv Only in glpk-4.39.p4/src: glpini01.lo Only in glpk-4.39.p4/src: glpini01.o Only in glpk-4.39.p4/src: glpini02.lo Only in glpk-4.39.p4/src: glpini02.o Only in glpk-4.39.p4/src: glpios01.lo Only in glpk-4.39.p4/src: glpios01.o Only in glpk-4.39.p4/src: glpios02.lo Only in glpk-4.39.p4/src: glpios02.o diff -crB glpk-4.39/src/glpios03.c glpk-4.39.p4/src/glpios03.c *** glpk-4.39/src/glpios03.c 2009-07-26 11:00:00.000000000 +0200 --- glpk-4.39.p4/src/glpios03.c 2011-04-21 11:04:48.000000000 +0200 *************** *** 1236,1246 **** is either to be solved for the first time or to be reoptimized due to reformulation */ /* display current progress of the search */ ! if (tree->parm->msg_lev >= GLP_MSG_DBG || ! tree->parm->msg_lev >= GLP_MSG_ON && ! (double)(tree->parm->out_frq - 1) <= ! 1000.0 * xdifftime(xtime(), tree->tm_lag)) ! show_progress(tree, 0); if (tree->parm->msg_lev >= GLP_MSG_ALL && xdifftime(xtime(), ttt) >= 60.0) { xlong_t total; --- 1236,1246 ---- is either to be solved for the first time or to be reoptimized due to reformulation */ /* display current progress of the search */ ! // if (tree->parm->msg_lev >= GLP_MSG_DBG || ! // tree->parm->msg_lev >= GLP_MSG_ON && ! // (double)(tree->parm->out_frq - 1) <= ! // 1000.0 * xdifftime(xtime(), tree->tm_lag)) ! // show_progress(tree, 0); if (tree->parm->msg_lev >= GLP_MSG_ALL && xdifftime(xtime(), ttt) >= 60.0) { xlong_t total; *************** *** 1311,1321 **** is either to be solved for the first time or to be reoptimized due to reformulation */ /* display current progress of the search */ ! if (tree->parm->msg_lev >= GLP_MSG_DBG || ! tree->parm->msg_lev >= GLP_MSG_ON && ! (double)(tree->parm->out_frq - 1) <= ! 1000.0 * xdifftime(xtime(), tree->tm_lag)) ! show_progress(tree, 0); if (tree->parm->msg_lev >= GLP_MSG_ALL && xdifftime(xtime(), ttt) >= 60.0) { xlong_t total; --- 1311,1321 ---- is either to be solved for the first time or to be reoptimized due to reformulation */ /* display current progress of the search */ ! // if (tree->parm->msg_lev >= GLP_MSG_DBG || ! // tree->parm->msg_lev >= GLP_MSG_ON && ! // (double)(tree->parm->out_frq - 1) <= ! // 1000.0 * xdifftime(xtime(), tree->tm_lag)) ! // show_progress(tree, 0); if (tree->parm->msg_lev >= GLP_MSG_ALL && xdifftime(xtime(), ttt) >= 60.0) { xlong_t total; *************** *** 1480,1487 **** { if (tree->parm->msg_lev >= GLP_MSG_DBG) xprintf("New integer feasible solution found\n"); record_solution(tree); ! if (tree->parm->msg_lev >= GLP_MSG_ON) ! show_progress(tree, 1); #if 0 write_sol(tree); #endif --- 1480,1487 ---- { if (tree->parm->msg_lev >= GLP_MSG_DBG) xprintf("New integer feasible solution found\n"); record_solution(tree); ! // if (tree->parm->msg_lev >= GLP_MSG_ON) ! // show_progress(tree, 1); #if 0 write_sol(tree); #endif *************** *** 1705,1712 **** goto loop; #endif done: /* display status of the search on exit from the solver */ ! if (tree->parm->msg_lev >= GLP_MSG_ON) ! show_progress(tree, 0); #if 1 if (tree->mir_gen != NULL) ios_mir_term(tree->mir_gen), tree->mir_gen = NULL; --- 1705,1712 ---- goto loop; #endif done: /* display status of the search on exit from the solver */ ! // if (tree->parm->msg_lev >= GLP_MSG_ON) ! // show_progress(tree, 0); #if 1 if (tree->mir_gen != NULL) ios_mir_term(tree->mir_gen), tree->mir_gen = NULL; Only in glpk-4.39.p4/src: glpios03.lo Only in glpk-4.39.p4/src: glpios03.o Only in glpk-4.39.p4/src: glpios04.lo Only in glpk-4.39.p4/src: glpios04.o Only in glpk-4.39.p4/src: glpios05.lo Only in glpk-4.39.p4/src: glpios05.o Only in glpk-4.39.p4/src: glpios06.lo Only in glpk-4.39.p4/src: glpios06.o Only in glpk-4.39.p4/src: glpios07.lo Only in glpk-4.39.p4/src: glpios07.o Only in glpk-4.39.p4/src: glpios08.lo Only in glpk-4.39.p4/src: glpios08.o Only in glpk-4.39.p4/src: glpios09.lo Only in glpk-4.39.p4/src: glpios09.o Only in glpk-4.39.p4/src: glpios10.lo Only in glpk-4.39.p4/src: glpios10.o Only in glpk-4.39.p4/src: glpipm.lo Only in glpk-4.39.p4/src: glpipm.o Only in glpk-4.39.p4/src: glpipp01.lo Only in glpk-4.39.p4/src: glpipp01.o diff -crB glpk-4.39/src/glpipp02.c glpk-4.39.p4/src/glpipp02.c *** glpk-4.39/src/glpipp02.c 2009-07-26 11:00:00.000000000 +0200 --- glpk-4.39.p4/src/glpipp02.c 2011-04-21 11:04:48.000000000 +0200 *************** *** 658,665 **** } for (row = ipp->row_ptr; row != NULL; row = row->next) nrows--; for (col = ipp->col_ptr; col != NULL; col = col->next) ncols--; ! xprintf("ipp_basic_tech: %d row(s) and %d column(s) removed\n", ! nrows, ncols); return 0; } --- 658,665 ---- } for (row = ipp->row_ptr; row != NULL; row = row->next) nrows--; for (col = ipp->col_ptr; col != NULL; col = col->next) ncols--; ! // xprintf("ipp_basic_tech: %d row(s) and %d column(s) removed\n", ! // nrows, ncols); return 0; } *************** *** 884,892 **** } total += count; if (count > 0) goto loop; ! xprintf( ! "ipp_reduce_bnds: %d pass(es) made, %d bound(s) reduced\n", ! pass, total); return 0; } --- 884,892 ---- } total += count; if (count > 0) goto loop; ! // xprintf( ! // "ipp_reduce_bnds: %d pass(es) made, %d bound(s) reduced\n", ! // pass, total); return 0; } *************** *** 1213,1220 **** } total += count; if (count > 0) goto loop; ! xprintf("ipp_reduce_coef: %d pass(es) made, %d coefficient(s) red" ! "uced\n", pass, total); return; } --- 1213,1220 ---- } total += count; if (count > 0) goto loop; ! // xprintf("ipp_reduce_coef: %d pass(es) made, %d coefficient(s) red" ! // "uced\n", pass, total); return; } Only in glpk-4.39.p4/src: glpipp02.lo Only in glpk-4.39.p4/src: glpipp02.o Only in glpk-4.39.p4/src: glplib01.lo Only in glpk-4.39.p4/src: glplib01.o Only in glpk-4.39.p4/src: glplib02.lo Only in glpk-4.39.p4/src: glplib02.o Only in glpk-4.39.p4/src: glplib03.lo Only in glpk-4.39.p4/src: glplib03.o Only in glpk-4.39.p4/src: glplib04.lo Only in glpk-4.39.p4/src: glplib04.o Only in glpk-4.39.p4/src: glplib05.lo Only in glpk-4.39.p4/src: glplib05.o Only in glpk-4.39.p4/src: glplib06.lo Only in glpk-4.39.p4/src: glplib06.o Only in glpk-4.39.p4/src: glplib07.lo Only in glpk-4.39.p4/src: glplib07.o Only in glpk-4.39.p4/src: glplib08.lo Only in glpk-4.39.p4/src: glplib08.o Only in glpk-4.39.p4/src: glplib09.lo Only in glpk-4.39.p4/src: glplib09.o Only in glpk-4.39.p4/src: glplib10.lo Only in glpk-4.39.p4/src: glplib10.o Only in glpk-4.39.p4/src: glplib11.lo Only in glpk-4.39.p4/src: glplib11.o Only in glpk-4.39.p4/src: glplib12.lo Only in glpk-4.39.p4/src: glplib12.o Only in glpk-4.39.p4/src: glplpf.lo Only in glpk-4.39.p4/src: glplpf.o diff -crB glpk-4.39/src/glplpx01.c glpk-4.39.p4/src/glplpx01.c *** glpk-4.39/src/glplpx01.c 2009-07-26 11:00:00.000000000 +0200 --- glpk-4.39.p4/src/glplpx01.c 2011-04-21 11:04:48.000000000 +0200 *************** *** 1212,1219 **** LPX *lpx_read_mps(const char *fname) { /* read problem data in fixed MPS format */ LPX *lp = lpx_create_prob(); ! if (glp_read_mps(lp, GLP_MPS_DECK, NULL, fname)) ! lpx_delete_prob(lp), lp = NULL; return lp; } --- 1212,1219 ---- LPX *lpx_read_mps(const char *fname) { /* read problem data in fixed MPS format */ LPX *lp = lpx_create_prob(); ! // if (glp_read_mps(lp, GLP_MPS_DECK, NULL, fname)) ! // lpx_delete_prob(lp), lp = NULL; return lp; } *************** *** 1249,1256 **** LPX *lpx_read_freemps(const char *fname) { /* read problem data in free MPS format */ LPX *lp = lpx_create_prob(); ! if (glp_read_mps(lp, GLP_MPS_FILE, NULL, fname)) ! lpx_delete_prob(lp), lp = NULL; return lp; } --- 1249,1256 ---- LPX *lpx_read_freemps(const char *fname) { /* read problem data in free MPS format */ LPX *lp = lpx_create_prob(); ! // if (glp_read_mps(lp, GLP_MPS_FILE, NULL, fname)) ! // lpx_delete_prob(lp), lp = NULL; return lp; } *************** *** 1323,1329 **** int lpx_main(int argc, const char *argv[]) { /* stand-alone LP/MIP solver */ ! return glp_main(argc, argv); } /* eof */ --- 1323,1329 ---- int lpx_main(int argc, const char *argv[]) { /* stand-alone LP/MIP solver */ ! // return glp_main(argc, argv); } /* eof */ Only in glpk-4.39.p4/src: glplpx01.lo Only in glpk-4.39.p4/src: glplpx01.o Only in glpk-4.39.p4/src: glplpx02.lo Only in glpk-4.39.p4/src: glplpx02.o Only in glpk-4.39.p4/src: glplpx03.lo Only in glpk-4.39.p4/src: glplpx03.o Only in glpk-4.39.p4/src: glplpx04.lo Only in glpk-4.39.p4/src: glplpx04.o Only in glpk-4.39.p4/src: glpluf.lo Only in glpk-4.39.p4/src: glpluf.o Only in glpk-4.39.p4/src: glplux.lo Only in glpk-4.39.p4/src: glplux.o Only in glpk-4.39.p4/src: glpmat.lo Only in glpk-4.39.p4/src: glpmat.o Only in glpk-4.39.p4/src: glpmpl01.lo Only in glpk-4.39.p4/src: glpmpl01.o Only in glpk-4.39.p4/src: glpmpl02.lo Only in glpk-4.39.p4/src: glpmpl02.o Only in glpk-4.39.p4/src: glpmpl03.lo Only in glpk-4.39.p4/src: glpmpl03.o Only in glpk-4.39.p4/src: glpmpl04.lo Only in glpk-4.39.p4/src: glpmpl04.o Only in glpk-4.39.p4/src: glpmpl05.lo Only in glpk-4.39.p4/src: glpmpl05.o Only in glpk-4.39.p4/src: glpmpl06.lo Only in glpk-4.39.p4/src: glpmpl06.o diff -crB glpk-4.39/src/glpmps.c glpk-4.39.p4/src/glpmps.c *** glpk-4.39/src/glpmps.c 2009-07-26 11:00:00.000000000 +0200 --- glpk-4.39.p4/src/glpmps.c 2011-04-21 11:04:48.000000000 +0200 *************** *** 70,76 **** * * SYNOPSIS * ! * int glp_read_mps(glp_prob *P, int fmt, const glp_mpscp *parm, * const char *fname); * * DESCRIPTION --- 70,76 ---- * * SYNOPSIS * ! * int glp_read_mps(int nRows, glp_prob *P, int fmt, const glp_mpscp *parm, * const char *fname); * * DESCRIPTION *************** *** 234,240 **** strcmp(csa->field, "ENDATA") == 0)) error(csa, "invalid indicator record\n"); if (!name) ! { while (csa->c != '\n') read_char(csa); } ret = 1; --- 234,241 ---- strcmp(csa->field, "ENDATA") == 0)) error(csa, "invalid indicator record\n"); if (!name) ! { ! while (csa->c != '\n') read_char(csa); } ret = 1; *************** *** 404,450 **** return; } ! static void read_rows(struct csa *csa) { /* read ROWS section */ int i, type; ! loop: if (indicator(csa, 0)) goto done; ! /* field 1: row type */ ! read_field(csa), strspx(csa->field); ! if (strcmp(csa->field, "N") == 0) ! type = GLP_FR; ! else if (strcmp(csa->field, "G") == 0) ! type = GLP_LO; ! else if (strcmp(csa->field, "L") == 0) ! type = GLP_UP; ! else if (strcmp(csa->field, "E") == 0) ! type = GLP_FX; ! else if (csa->field[0] == '\0') ! error(csa, "missing row type in field 1\n"); ! else ! error(csa, "invalid row type in field 1\n"); ! /* field 2: row name */ ! read_field(csa), patch_name(csa, csa->field); ! if (csa->field[0] == '\0') ! error(csa, "missing row name in field 2\n"); ! if (glp_find_row(csa->P, csa->field) != 0) ! error(csa, "row `%s' multiply specified\n", csa->field); i = glp_add_rows(csa->P, 1); ! glp_set_row_name(csa->P, i, csa->field); ! glp_set_row_bnds(csa->P, i, type, 0.0, 0.0); ! /* fields 3, 4, 5, and 6 must be blank */ ! skip_field(csa); ! skip_field(csa); ! skip_field(csa); ! skip_field(csa); ! goto loop; ! done: return; } ! static void read_columns(struct csa *csa) { /* read COLUMNS section */ int i, j, f, len, kind = GLP_CV, *ind; double aij, *val; char name[255+1], *flag; /* allocate working arrays */ csa->work1 = ind = xcalloc(1+csa->P->m, sizeof(int)); csa->work2 = val = xcalloc(1+csa->P->m, sizeof(double)); --- 405,440 ---- return; } ! static void read_rows(int nRows, char *nameRows[], int typeRows[], ! struct csa *csa) { /* read ROWS section */ int i, type; ! ! int j; ! for(j=0; j< nRows; j++){ i = glp_add_rows(csa->P, 1); ! glp_set_row_name(csa->P, i, nameRows[j]); ! glp_set_row_bnds(csa->P, i, typeRows[j], 0.0, 0.0); ! } ! ! // j=indicator(csa,0); ! return; } ! static void read_columns( ! int NStructVar, int NStructRows, int NRowsInWhichStructVarArePresent[NStructVar], // COLUMNS info ! char *StructVarName[NStructVar],char *NameRowsInWhichStructVarArePresent[], // COLUMNS info ! double *Coefficients, // COLUMNS info ! struct csa *csa) { /* read COLUMNS section */ int i, j, f, len, kind = GLP_CV, *ind; double aij, *val; char name[255+1], *flag; + + + int k,l; + + /* allocate working arrays */ csa->work1 = ind = xcalloc(1+csa->P->m, sizeof(int)); csa->work2 = val = xcalloc(1+csa->P->m, sizeof(double)); *************** *** 452,551 **** memset(&flag[1], 0, csa->P->m); /* no current column exists */ j = 0, len = 0; ! loop: if (indicator(csa, 0)) goto done; ! /* field 1 must be blank */ ! if (csa->deck) ! { read_field(csa); ! if (csa->field[0] != '\0') ! error(csa, "field 1 must be blank\n"); ! } ! else ! csa->fldno++; ! /* field 2: column or kind name */ ! read_field(csa), patch_name(csa, csa->field); ! strcpy(name, csa->field); ! /* field 3: row name or keyword 'MARKER' */ ! read_field(csa), patch_name(csa, csa->field); ! if (strcmp(csa->field, "'MARKER'") == 0) ! { /* process kind data record */ ! /* field 4 must be blank */ ! if (csa->deck) ! { read_field(csa); ! if (csa->field[0] != '\0') ! error(csa, "field 4 must be blank\n"); ! } ! else ! csa->fldno++; ! /* field 5: keyword 'INTORG' or 'INTEND' */ ! read_field(csa), patch_name(csa, csa->field); ! if (strcmp(csa->field, "'INTORG'") == 0) ! kind = GLP_IV; ! else if (strcmp(csa->field, "'INTEND'") == 0) ! kind = GLP_CV; ! else if (csa->field[0] == '\0') ! error(csa, "missing keyword in field 5\n"); ! else ! error(csa, "invalid keyword in field 5\n"); ! /* field 6 must be blank */ ! skip_field(csa); ! goto loop; ! } ! /* process column name specified in field 2 */ ! if (name[0] == '\0') ! { /* the same column as in previous data record */ ! if (j == 0) ! error(csa, "missing column name in field 2\n"); ! } ! else if (j != 0 && strcmp(name, csa->P->col[j]->name) == 0) ! { /* the same column as in previous data record */ ! xassert(j != 0); ! } ! else ! { /* store the current column */ if (j != 0) { glp_set_mat_col(csa->P, j, len, ind, val); while (len > 0) flag[ind[len--]] = 0; } - /* create new column */ - if (glp_find_col(csa->P, name) != 0) - error(csa, "column `%s' multiply specified\n", name); j = glp_add_cols(csa->P, 1); glp_set_col_name(csa->P, j, name); glp_set_col_kind(csa->P, j, kind); ! if (kind == GLP_CV) ! glp_set_col_bnds(csa->P, j, GLP_LO, 0.0, 0.0); ! else if (kind == GLP_IV) ! glp_set_col_bnds(csa->P, j, GLP_DB, 0.0, 1.0); ! else ! xassert(kind != kind); ! } ! /* process fields 3-4 and 5-6 */ ! for (f = 3; f <= 5; f += 2) ! { /* field 3 or 5: row name */ ! if (f == 3) ! { if (csa->field[0] == '\0') ! error(csa, "missing row name in field 3\n"); ! } ! else ! { read_field(csa), patch_name(csa, csa->field); ! if (csa->field[0] == '\0') ! { /* if field 5 is blank, field 6 also must be blank */ ! skip_field(csa); ! continue; ! } ! } ! i = glp_find_row(csa->P, csa->field); ! if (i == 0) ! error(csa, "row `%s' not found\n", csa->field); ! if (flag[i]) ! error(csa, "duplicate coefficient in row `%s'\n", ! csa->field); ! /* field 4 or 6: coefficient value */ ! aij = read_number(csa); ! if (fabs(aij) < csa->parm->tol_mps) aij = 0.0; ! len++, ind[len] = i, val[len] = aij, flag[i] = 1; ! } ! goto loop; done: /* store the last column */ if (j != 0) glp_set_mat_col(csa->P, j, len, ind, val); --- 442,478 ---- memset(&flag[1], 0, csa->P->m); /* no current column exists */ j = 0, len = 0; ! ! ! ! //---------- ! ! for(k=0;kP, j, len, ind, val); while (len > 0) flag[ind[len--]] = 0; } j = glp_add_cols(csa->P, 1); glp_set_col_name(csa->P, j, name); glp_set_col_kind(csa->P, j, kind); ! glp_set_col_bnds(csa->P, j, GLP_LO, 0.0, 0.0); ! ! for(l=0; lfield, NameRowsInWhichStructVarArePresent[k*NStructRows+l]); ! // aij = Coefficients[k][l]; ! int kk = k*NStructRows + l; // Here NStructRows is right!! NOT NRowsInWhichStructVarArePresent[k]! ! aij = *(Coefficients+kk); ! i = glp_find_row(csa->P, csa->field); ! if (fabs(aij) < csa->parm->tol_mps) aij = 0.0; ! len++, ind[len] = i, val[len] = aij, flag[i] = 1; ! } ! } ! ! ! //----------------------- ! done: /* store the last column */ if (j != 0) glp_set_mat_col(csa->P, j, len, ind, val); *************** *** 554,622 **** xfree(val); xfree(flag); csa->work1 = csa->work2 = csa->work3 = NULL; return; } ! static void read_rhs(struct csa *csa) { /* read RHS section */ int i, f, v, type; double rhs; char name[255+1], *flag; /* allocate working array */ csa->work3 = flag = xcalloc(1+csa->P->m, sizeof(char)); memset(&flag[1], 0, csa->P->m); /* no current RHS vector exists */ v = 0; ! loop: if (indicator(csa, 0)) goto done; ! /* field 1 must be blank */ ! if (csa->deck) ! { read_field(csa); ! if (csa->field[0] != '\0') ! error(csa, "field 1 must be blank\n"); ! } ! else ! csa->fldno++; ! /* field 2: RHS vector name */ ! read_field(csa), patch_name(csa, csa->field); ! if (csa->field[0] == '\0') ! { /* the same RHS vector as in previous data record */ ! if (v == 0) ! { warning(csa, "missing RHS vector name in field 2\n"); ! goto blnk; ! } ! } ! else if (v != 0 && strcmp(csa->field, name) == 0) ! { /* the same RHS vector as in previous data record */ ! xassert(v != 0); ! } ! else ! blnk: { /* new RHS vector */ ! if (v != 0) ! error(csa, "multiple RHS vectors not supported\n"); ! v++; ! strcpy(name, csa->field); ! } ! /* process fields 3-4 and 5-6 */ ! for (f = 3; f <= 5; f += 2) ! { /* field 3 or 5: row name */ ! read_field(csa), patch_name(csa, csa->field); ! if (csa->field[0] == '\0') ! { if (f == 3) ! error(csa, "missing row name in field 3\n"); ! else ! { /* if field 5 is blank, field 6 also must be blank */ ! skip_field(csa); ! continue; ! } ! } ! i = glp_find_row(csa->P, csa->field); ! if (i == 0) ! error(csa, "row `%s' not found\n", csa->field); ! if (flag[i]) ! error(csa, "duplicate right-hand side for row `%s'\n", ! csa->field); ! /* field 4 or 6: right-hand side value */ ! rhs = read_number(csa); if (fabs(rhs) < csa->parm->tol_mps) rhs = 0.0; type = csa->P->row[i]->type; if (type == GLP_FR) --- 481,522 ---- xfree(val); xfree(flag); csa->work1 = csa->work2 = csa->work3 = NULL; + + // indicator(csa,0); + + return; } ! static void read_rhs( ! int nRows, double ValueB[nRows], char *nameRows[nRows], ! struct csa *csa) { /* read RHS section */ int i, f, v, type; double rhs; char name[255+1], *flag; + + + + + int j; + + + /* allocate working array */ csa->work3 = flag = xcalloc(1+csa->P->m, sizeof(char)); memset(&flag[1], 0, csa->P->m); /* no current RHS vector exists */ v = 0; ! ! ! ! //--------- ! strcpy(name,"BOUND"); ! for(j=1; jfield,nameRows[j]); ! i = glp_find_row(csa->P, csa->field); ! rhs=ValueB[j-1]; if (fabs(rhs) < csa->parm->tol_mps) rhs = 0.0; type = csa->P->row[i]->type; if (type == GLP_FR) *************** *** 629,701 **** else glp_set_row_bnds(csa->P, i, type, rhs, rhs); flag[i] = 1; ! } ! goto loop; done: /* free working array */ xfree(flag); csa->work3 = NULL; return; } ! static void read_ranges(struct csa *csa) { /* read RANGES section */ int i, f, v, type; double rhs, rng; char name[255+1], *flag; /* allocate working array */ csa->work3 = flag = xcalloc(1+csa->P->m, sizeof(char)); memset(&flag[1], 0, csa->P->m); /* no current RANGES vector exists */ v = 0; ! loop: if (indicator(csa, 0)) goto done; ! /* field 1 must be blank */ ! if (csa->deck) ! { read_field(csa); ! if (csa->field[0] != '\0') ! error(csa, "field 1 must be blank\n"); ! } ! else ! csa->fldno++; ! /* field 2: RANGES vector name */ ! read_field(csa), patch_name(csa, csa->field); ! if (csa->field[0] == '\0') ! { /* the same RANGES vector as in previous data record */ ! if (v == 0) ! { warning(csa, "missing RANGES vector name in field 2\n"); ! goto blnk; ! } ! } ! else if (v != 0 && strcmp(csa->field, name) == 0) ! { /* the same RANGES vector as in previous data record */ ! xassert(v != 0); ! } ! else ! blnk: { /* new RANGES vector */ ! if (v != 0) ! error(csa, "multiple RANGES vectors not supported\n"); ! v++; ! strcpy(name, csa->field); ! } ! /* process fields 3-4 and 5-6 */ ! for (f = 3; f <= 5; f += 2) ! { /* field 3 or 5: row name */ ! read_field(csa), patch_name(csa, csa->field); ! if (csa->field[0] == '\0') ! { if (f == 3) ! error(csa, "missing row name in field 3\n"); ! else ! { /* if field 5 is blank, field 6 also must be blank */ ! skip_field(csa); ! continue; ! } ! } ! i = glp_find_row(csa->P, csa->field); ! if (i == 0) ! error(csa, "row `%s' not found\n", csa->field); ! if (flag[i]) ! error(csa, "duplicate range for row `%s'\n", csa->field); ! /* field 4 or 6: range value */ ! rng = read_number(csa); if (fabs(rng) < csa->parm->tol_mps) rng = 0.0; type = csa->P->row[i]->type; if (type == GLP_FR) --- 529,572 ---- else glp_set_row_bnds(csa->P, i, type, rhs, rhs); flag[i] = 1; ! } ! ! // indicator(csa, 0); ! ! done: /* free working array */ xfree(flag); csa->work3 = NULL; return; } ! static void read_ranges( ! int nRanges, double ValueRanges[], char* NameRanges[], // RANGES info ! struct csa *csa) { /* read RANGES section */ int i, f, v, type; double rhs, rng; char name[255+1], *flag; + + + + + int j; + + + /* allocate working array */ csa->work3 = flag = xcalloc(1+csa->P->m, sizeof(char)); memset(&flag[1], 0, csa->P->m); /* no current RANGES vector exists */ v = 0; ! ! //------------------------------- ! strcpy(name,"RANGE"); ! for(j=0;jfield,NameRanges[j]); ! i = glp_find_row(csa->P, csa->field); ! rng = ValueRanges[j]; if (fabs(rng) < csa->parm->tol_mps) rng = 0.0; type = csa->P->row[i]->type; if (type == GLP_FR) *************** *** 721,748 **** else xassert(type != type); flag[i] = 1; } ! goto loop; done: /* free working array */ xfree(flag); csa->work3 = NULL; return; } ! static void read_bounds(struct csa *csa) { /* read BOUNDS section */ GLPCOL *col; int j, v, mask, data; double bnd, lb, ub; char type[2+1], name[255+1], *flag; /* allocate working array */ csa->work3 = flag = xcalloc(1+csa->P->n, sizeof(char)); memset(&flag[1], 0, csa->P->n); /* no current BOUNDS vector exists */ v = 0; ! loop: if (indicator(csa, 0)) goto done; ! /* field 1: bound type */ ! read_field(csa); if (strcmp(csa->field, "LO") == 0) mask = 0x01, data = 1; else if (strcmp(csa->field, "UP") == 0) --- 592,638 ---- else xassert(type != type); flag[i] = 1; + } ! // indicator(csa, 0); ! //------------------------------- ! ! ! done: /* free working array */ xfree(flag); csa->work3 = NULL; return; } ! static void read_bounds(int nBounds,double BoundValue[], char *BoundStructVarName[], char *TypeofBound[], // BOUNDS info ! struct csa *csa) { /* read BOUNDS section */ GLPCOL *col; int j, v, mask, data; double bnd, lb, ub; char type[2+1], name[255+1], *flag; + + + + + + int k; + + + + /* allocate working array */ csa->work3 = flag = xcalloc(1+csa->P->n, sizeof(char)); memset(&flag[1], 0, csa->P->n); /* no current BOUNDS vector exists */ v = 0; ! ! ! //--------------------------- ! ! for(k=0;kfield,TypeofBound[k]); if (strcmp(csa->field, "LO") == 0) mask = 0x01, data = 1; else if (strcmp(csa->field, "UP") == 0) *************** *** 766,808 **** else error(csa, "invalid bound type in field 1\n"); strcpy(type, csa->field); /* field 2: BOUNDS vector name */ ! read_field(csa), patch_name(csa, csa->field); ! if (csa->field[0] == '\0') ! { /* the same BOUNDS vector as in previous data record */ ! if (v == 0) ! { warning(csa, "missing BOUNDS vector name in field 2\n"); ! goto blnk; ! } ! } ! else if (v != 0 && strcmp(csa->field, name) == 0) ! { /* the same BOUNDS vector as in previous data record */ ! xassert(v != 0); ! } ! else ! blnk: { /* new BOUNDS vector */ ! if (v != 0) ! error(csa, "multiple BOUNDS vectors not supported\n"); ! v++; ! strcpy(name, csa->field); ! } /* field 3: column name */ ! read_field(csa), patch_name(csa, csa->field); ! if (csa->field[0] == '\0') ! error(csa, "missing column name in field 3\n"); j = glp_find_col(csa->P, csa->field); - if (j == 0) - error(csa, "column `%s' not found\n", csa->field); - if ((flag[j] & mask) == 0x01) - error(csa, "duplicate lower bound for column `%s'\n", - csa->field); - if ((flag[j] & mask) == 0x10) - error(csa, "duplicate upper bound for column `%s'\n", - csa->field); xassert((flag[j] & mask) == 0x00); /* field 4: bound value */ if (data) ! { bnd = read_number(csa); if (fabs(bnd) < csa->parm->tol_mps) bnd = 0.0; } else --- 656,672 ---- else error(csa, "invalid bound type in field 1\n"); strcpy(type, csa->field); + /* field 2: BOUNDS vector name */ ! strcpy(name,"Bounds"); ! /* field 3: column name */ ! strcpy(csa->field,BoundStructVarName[k]); j = glp_find_col(csa->P, csa->field); xassert((flag[j] & mask) == 0x00); /* field 4: bound value */ if (data) ! { bnd = BoundValue[k]; if (fabs(bnd) < csa->parm->tol_mps) bnd = 0.0; } else *************** *** 860,882 **** else glp_set_col_bnds(csa->P, j, GLP_FX, lb, ub); flag[j] |= (char)mask; ! /* fields 5 and 6 must be blank */ ! skip_field(csa); ! skip_field(csa); ! goto loop; done: /* free working array */ xfree(flag); csa->work3 = NULL; return; } ! int glp_read_mps(glp_prob *P, int fmt, const glp_mpscp *parm, const char *fname) ! { /* read problem data in MPS format */ glp_mpscp _parm; struct csa _csa, *csa = &_csa; int ret; ! xprintf("Reading problem data from `%s'...\n", fname); if (!(fmt == GLP_MPS_DECK || fmt == GLP_MPS_FILE)) xerror("glp_read_mps: fmt = %d; invalid parameter\n", fmt); if (parm == NULL) --- 724,762 ---- else glp_set_col_bnds(csa->P, j, GLP_FX, lb, ub); flag[j] |= (char)mask; ! ! ! } ! ! // indicator(csa, 0); ! //--------------------------- ! ! ! ! ! done: /* free working array */ xfree(flag); csa->work3 = NULL; return; } ! int glp_read_mps( ! int nRows, char *nameRows[], int typeRows[], // ROWS info ! int NStructVar, int NStructRows, int NRowsInWhichStructVarArePresent[], // COLUMNS info ! char *StructVarName[],char *NameRowsInWhichStructVarArePresent[], // COLUMNS info ! double *Coefficients, // COLUMNS info ! double ValueB[], // RHS info ! int nRanges, double ValueRanges[], char* NameRanges[], // RANGES info ! int nBounds, double BoundValue[], char *BoundStructVarName[], char *TypeofBound[], // BOUNDS info ! glp_prob *P, int fmt, const glp_mpscp *parm, const char *fname) ! { ! /* read problem data in MPS format */ glp_mpscp _parm; struct csa _csa, *csa = &_csa; int ret; ! // xprintf("Reading problem data from `%s'...\n", fname); if (!(fmt == GLP_MPS_DECK || fmt == GLP_MPS_FILE)) xerror("glp_read_mps: fmt = %d; invalid parameter\n", fmt); if (parm == NULL) *************** *** 904,929 **** glp_erase_prob(P); glp_create_index(P); /* open input MPS file */ ! csa->fp = xfopen(fname, "r"); ! if (csa->fp == NULL) ! { xprintf("Unable to open `%s' - %s\n", fname, xerrmsg()); ! ret = 1; ! goto done; ! } /* read NAME indicator record */ ! read_name(csa); ! if (P->name != NULL) ! xprintf("Problem: %s\n", P->name); /* read ROWS section */ ! if (!(indicator(csa, 0) && strcmp(csa->field, "ROWS") == 0)) ! error(csa, "missing ROWS indicator record\n"); ! read_rows(csa); /* determine objective row */ if (parm->obj_name == NULL || parm->obj_name[0] == '\0') { /* use the first row of N type */ int i; for (i = 1; i <= P->m; i++) ! { if (P->row[i]->type == GLP_FR) { csa->obj_row = i; break; } --- 784,812 ---- glp_erase_prob(P); glp_create_index(P); /* open input MPS file */ ! // csa->fp = xfopen(fname, "r"); ! // if (csa->fp == NULL) ! // { xprintf("Unable to open `%s' - %s\n", fname, xerrmsg()); ! // ret = 1; ! // goto done; ! // } /* read NAME indicator record */ ! // read_name(csa); ! // if (P->name != NULL) ! // xprintf("Problem: %s\n", P->name); /* read ROWS section */ ! // if (!(indicator(csa, 0) && strcmp(csa->field, "ROWS") == 0)) ! // error(csa, "missing ROWS indicator record\n"); ! read_rows(nRows, nameRows , typeRows ,csa); ! ! /* determine objective row */ if (parm->obj_name == NULL || parm->obj_name[0] == '\0') { /* use the first row of N type */ int i; for (i = 1; i <= P->m; i++) ! { ! if (P->row[i]->type == GLP_FR) { csa->obj_row = i; break; } *************** *** 946,958 **** parm->obj_name); } if (csa->obj_row != 0) ! { glp_set_obj_name(P, P->row[csa->obj_row]->name); ! xprintf("Objective: %s\n", P->obj); } /* read COLUMNS section */ ! if (strcmp(csa->field, "COLUMNS") != 0) ! error(csa, "missing COLUMNS indicator record\n"); ! read_columns(csa); /* set objective coefficients */ if (csa->obj_row != 0) { GLPAIJ *aij; --- 829,846 ---- parm->obj_name); } if (csa->obj_row != 0) ! { ! glp_set_obj_name(P, P->row[csa->obj_row]->name); ! // xprintf("Objective: %s\n", P->obj); } /* read COLUMNS section */ ! // if (strcmp(csa->field, "COLUMNS") != 0) ! // error(csa, "missing COLUMNS indicator record\n"); ! read_columns( ! NStructVar, NStructRows, NRowsInWhichStructVarArePresent, // COLUMNS info ! StructVarName, NameRowsInWhichStructVarArePresent, // COLUMNS info ! Coefficients, // COLUMNS info ! csa); /* set objective coefficients */ if (csa->obj_row != 0) { GLPAIJ *aij; *************** *** 960,981 **** aij->r_next) glp_set_obj_coef(P, aij->col->j, aij->val); } /* read optional RHS section */ ! if (strcmp(csa->field, "RHS") == 0) ! read_rhs(csa); /* read optional RANGES section */ ! if (strcmp(csa->field, "RANGES") == 0) ! read_ranges(csa); /* read optional BOUNDS section */ ! if (strcmp(csa->field, "BOUNDS") == 0) ! read_bounds(csa); /* read ENDATA indicator record */ ! if (strcmp(csa->field, "ENDATA") != 0) ! error(csa, "invalid use of %s indicator record\n", ! csa->field); /* print some statistics */ ! xprintf("%d row%s, %d column%s, %d non-zero%s\n", ! P->m, P->m == 1 ? "" : "s", P->n, P->n == 1 ? "" : "s", ! P->nnz, P->nnz == 1 ? "" : "s"); if (glp_get_num_int(P) > 0) { int ni = glp_get_num_int(P); int nb = glp_get_num_bin(P); --- 848,874 ---- aij->r_next) glp_set_obj_coef(P, aij->col->j, aij->val); } /* read optional RHS section */ ! // if (strcmp(csa->field, "RHS") == 0) ! read_rhs(nRows, ValueB, nameRows, ! csa); /* read optional RANGES section */ ! // if (strcmp(csa->field, "RANGES") == 0) ! read_ranges(nRanges,ValueRanges,NameRanges, // RANGES info ! csa); /* read optional BOUNDS section */ ! // if (strcmp(csa->field, "BOUNDS") == 0) ! read_bounds( nBounds, BoundValue, BoundStructVarName, TypeofBound, // BOUNDS info ! csa); /* read ENDATA indicator record */ ! // if (strcmp(csa->field, "ENDATA") != 0) ! // error(csa, "invalid use of %s indicator record\n", ! // csa->field); /* print some statistics */ ! // xprintf("%d row%s, %d column%s, %d non-zero%s\n", ! // P->m, P->m == 1 ? "" : "s", P->n, P->n == 1 ? "" : "s", ! // P->nnz, P->nnz == 1 ? "" : "s"); ! ! /* if (glp_get_num_int(P) > 0) { int ni = glp_get_num_int(P); int nb = glp_get_num_bin(P); *************** *** 986,992 **** xprintf("One variable is binary\n"); } else ! { xprintf("%d integer variables, ", ni); if (nb == 0) xprintf("none"); else if (nb == 1) --- 879,886 ---- xprintf("One variable is binary\n"); } else ! { ! xprintf("%d integer variables, ", ni); if (nb == 0) xprintf("none"); else if (nb == 1) *************** *** 998,1004 **** xprintf(" of which %s binary\n", nb == 1 ? "is" : "are"); } } ! xprintf("%d records were read\n", csa->recno); /* problem data has been successfully read */ glp_delete_index(P); lpx_order_matrix(P); --- 892,899 ---- xprintf(" of which %s binary\n", nb == 1 ? "is" : "are"); } } ! */ ! // xprintf("%d records were read\n", csa->recno); /* problem data has been successfully read */ glp_delete_index(P); lpx_order_matrix(P); Only in glpk-4.39.p4/src: glpmps.lo Only in glpk-4.39.p4/src: glpmps.o Only in glpk-4.39.p4/src: glpnet01.lo Only in glpk-4.39.p4/src: glpnet01.o Only in glpk-4.39.p4/src: glpnet02.lo Only in glpk-4.39.p4/src: glpnet02.o Only in glpk-4.39.p4/src: glpnet03.lo Only in glpk-4.39.p4/src: glpnet03.o Only in glpk-4.39.p4/src: glpnet04.lo Only in glpk-4.39.p4/src: glpnet04.o Only in glpk-4.39.p4/src: glpnet05.lo Only in glpk-4.39.p4/src: glpnet05.o Only in glpk-4.39.p4/src: glpnet06.lo Only in glpk-4.39.p4/src: glpnet06.o Only in glpk-4.39.p4/src: glpnet07.lo Only in glpk-4.39.p4/src: glpnet07.o Only in glpk-4.39.p4/src: glpnpp01.lo Only in glpk-4.39.p4/src: glpnpp01.o Only in glpk-4.39.p4/src: glpnpp02.lo Only in glpk-4.39.p4/src: glpnpp02.o Only in glpk-4.39.p4/src: glpnpp03.lo Only in glpk-4.39.p4/src: glpnpp03.o Only in glpk-4.39.p4/src: glpqmd.lo Only in glpk-4.39.p4/src: glpqmd.o Only in glpk-4.39.p4/src: glprgr.lo Only in glpk-4.39.p4/src: glprgr.o Only in glpk-4.39.p4/src: glprng01.lo Only in glpk-4.39.p4/src: glprng01.o Only in glpk-4.39.p4/src: glprng02.lo Only in glpk-4.39.p4/src: glprng02.o Only in glpk-4.39.p4/src: glpscf.lo Only in glpk-4.39.p4/src: glpscf.o Only in glpk-4.39.p4/src: glpscg.lo Only in glpk-4.39.p4/src: glpscg.o diff -crB glpk-4.39/src/glpscl.c glpk-4.39.p4/src/glpscl.c *** glpk-4.39/src/glpscl.c 2009-07-26 11:00:00.000000000 +0200 --- glpk-4.39.p4/src/glpscl.c 2011-04-21 11:04:48.000000000 +0200 *************** *** 390,403 **** { static const char *fmt = "%s: min|aij| = %10.3e max|aij| = %10.3e ratio = %10.3e\n"; double min_aij, max_aij, ratio; ! xprintf("Scaling...\n"); /* cancel the current scaling effect */ glp_unscale_prob(lp); /* report original scaling "quality" */ min_aij = min_mat_aij(lp, 1); max_aij = max_mat_aij(lp, 1); ratio = max_aij / min_aij; ! xprintf(fmt, " A", min_aij, max_aij, ratio); /* check if the problem is well scaled */ if (min_aij >= 0.10 && max_aij <= 10.0) { xprintf("Problem data seem to be well scaled\n"); --- 390,403 ---- { static const char *fmt = "%s: min|aij| = %10.3e max|aij| = %10.3e ratio = %10.3e\n"; double min_aij, max_aij, ratio; ! // xprintf("Scaling...\n"); /* cancel the current scaling effect */ glp_unscale_prob(lp); /* report original scaling "quality" */ min_aij = min_mat_aij(lp, 1); max_aij = max_mat_aij(lp, 1); ratio = max_aij / min_aij; ! // xprintf(fmt, " A", min_aij, max_aij, ratio); /* check if the problem is well scaled */ if (min_aij >= 0.10 && max_aij <= 10.0) { xprintf("Problem data seem to be well scaled\n"); *************** *** 410,416 **** min_aij = min_mat_aij(lp, 1); max_aij = max_mat_aij(lp, 1); ratio = max_aij / min_aij; ! xprintf(fmt, "GM", min_aij, max_aij, ratio); } /* perform equilibration scaling, if required */ if (flags & GLP_SF_EQ) --- 410,416 ---- min_aij = min_mat_aij(lp, 1); max_aij = max_mat_aij(lp, 1); ratio = max_aij / min_aij; ! // xprintf(fmt, "GM", min_aij, max_aij, ratio); } /* perform equilibration scaling, if required */ if (flags & GLP_SF_EQ) *************** *** 418,424 **** min_aij = min_mat_aij(lp, 1); max_aij = max_mat_aij(lp, 1); ratio = max_aij / min_aij; ! xprintf(fmt, "EQ", min_aij, max_aij, ratio); } /* round scale factors to nearest power of two, if required */ if (flags & GLP_SF_2N) --- 418,424 ---- min_aij = min_mat_aij(lp, 1); max_aij = max_mat_aij(lp, 1); ratio = max_aij / min_aij; ! // xprintf(fmt, "EQ", min_aij, max_aij, ratio); } /* round scale factors to nearest power of two, if required */ if (flags & GLP_SF_2N) *************** *** 430,436 **** min_aij = min_mat_aij(lp, 1); max_aij = max_mat_aij(lp, 1); ratio = max_aij / min_aij; ! xprintf(fmt, "2N", min_aij, max_aij, ratio); } done: return; } --- 430,436 ---- min_aij = min_mat_aij(lp, 1); max_aij = max_mat_aij(lp, 1); ratio = max_aij / min_aij; ! // xprintf(fmt, "2N", min_aij, max_aij, ratio); } done: return; } Only in glpk-4.39.p4/src: glpscl.lo Only in glpk-4.39.p4/src: glpscl.o Only in glpk-4.39.p4/src: glpsdf.lo Only in glpk-4.39.p4/src: glpsdf.o Only in glpk-4.39.p4/src: glpspm.lo Only in glpk-4.39.p4/src: glpspm.o diff -crB glpk-4.39/src/glpspx01.c glpk-4.39.p4/src/glpspx01.c *** glpk-4.39/src/glpspx01.c 2009-07-26 11:00:00.000000000 +0200 --- glpk-4.39.p4/src/glpspx01.c 2011-04-21 11:04:48.000000000 +0200 *************** *** 2386,2393 **** } if (type[k] == GLP_FX) cnt++; } ! xprintf("%c%6d: obj = %17.9e infeas = %10.3e (%d)\n", ! phase == 1 ? ' ' : '*', csa->it_cnt, eval_obj(csa), sum, cnt); csa->it_dpy = csa->it_cnt; skip: return; } --- 2386,2393 ---- } if (type[k] == GLP_FX) cnt++; } ! // xprintf("%c%6d: obj = %17.9e infeas = %10.3e (%d)\n", ! // phase == 1 ? ' ' : '*', csa->it_cnt, eval_obj(csa), sum, cnt); csa->it_dpy = csa->it_cnt; skip: return; } *************** *** 2772,2779 **** d_stat = (csa->q == 0 ? GLP_FEAS : GLP_INFEAS); break; case 2: ! if (parm->msg_lev >= GLP_MSG_ALL) ! xprintf("OPTIMAL SOLUTION FOUND\n"); p_stat = d_stat = GLP_FEAS; break; default: --- 2772,2779 ---- d_stat = (csa->q == 0 ? GLP_FEAS : GLP_INFEAS); break; case 2: ! // if (parm->msg_lev >= GLP_MSG_ALL) ! // xprintf("OPTIMAL SOLUTION FOUND\n"); p_stat = d_stat = GLP_FEAS; break; default: Only in glpk-4.39.p4/src: glpspx01.lo Only in glpk-4.39.p4/src: glpspx01.o diff -crB glpk-4.39/src/glpspx02.c glpk-4.39.p4/src/glpspx02.c *** glpk-4.39/src/glpspx02.c 2009-07-26 11:00:00.000000000 +0200 --- glpk-4.39.p4/src/glpspx02.c 2011-04-21 11:04:48.000000000 +0200 *************** *** 2434,2445 **** cnt = 0; for (i = 1; i <= m; i++) if (orig_type[head[i]] == GLP_FX) cnt++; ! if (csa->phase == 1) ! xprintf(" %6d: %24s infeas = %10.3e (%d)\n", ! csa->it_cnt, "", sum, cnt); ! else ! xprintf("|%6d: obj = %17.9e infeas = %10.3e (%d)\n", ! csa->it_cnt, eval_obj(csa), sum, cnt); csa->it_dpy = csa->it_cnt; skip: return; } --- 2434,2445 ---- cnt = 0; for (i = 1; i <= m; i++) if (orig_type[head[i]] == GLP_FX) cnt++; ! // if (csa->phase == 1) ! // xprintf(" %6d: %24s infeas = %10.3e (%d)\n", ! // csa->it_cnt, "", sum, cnt); ! // else ! // xprintf("|%6d: obj = %17.9e infeas = %10.3e (%d)\n", ! // csa->it_cnt, eval_obj(csa), sum, cnt); csa->it_dpy = csa->it_cnt; skip: return; } Only in glpk-4.39.p4/src: glpspx02.lo Only in glpk-4.39.p4/src: glpspx02.o Only in glpk-4.39.p4/src: glpsql.lo Only in glpk-4.39.p4/src: glpsql.o Only in glpk-4.39.p4/src: glpssx01.lo Only in glpk-4.39.p4/src: glpssx01.o diff -crB glpk-4.39/src/glpssx02.c glpk-4.39.p4/src/glpssx02.c *** glpk-4.39/src/glpssx02.c 2009-07-26 11:00:00.000000000 +0200 --- glpk-4.39.p4/src/glpssx02.c 2011-04-21 11:04:48.000000000 +0200 *************** *** 131,146 **** ssx_eval_pi(ssx); ssx_eval_cbar(ssx); /* display initial progress of the search */ ! show_progress(ssx, 1); /* main loop starts here */ for (;;) { /* display current progress of the search */ #if 0 if (utime() - ssx->tm_lag >= ssx->out_frq - 0.001) #else if (xdifftime(xtime(), ssx->tm_lag) >= ssx->out_frq - 0.001) #endif ! show_progress(ssx, 1); /* we do not need to wait until all artificial variables have left the basis */ if (mpq_sgn(bbar[0]) == 0) --- 131,152 ---- ssx_eval_pi(ssx); ssx_eval_cbar(ssx); /* display initial progress of the search */ ! // show_progress(ssx, 1); /* main loop starts here */ for (;;) { /* display current progress of the search */ + + /* + #if 0 if (utime() - ssx->tm_lag >= ssx->out_frq - 0.001) #else if (xdifftime(xtime(), ssx->tm_lag) >= ssx->out_frq - 0.001) #endif ! ;// show_progress(ssx, 1); ! ! */ ! /* we do not need to wait until all artificial variables have left the basis */ if (mpq_sgn(bbar[0]) == 0) *************** *** 242,248 **** ssx->it_cnt++; } /* display final progress of the search */ ! show_progress(ssx, 1); /* restore components of the original problem, which were changed by the routine */ for (k = 1; k <= m+n; k++) --- 248,254 ---- ssx->it_cnt++; } /* display final progress of the search */ ! // show_progress(ssx, 1); /* restore components of the original problem, which were changed by the routine */ for (k = 1; k <= m+n; k++) *************** *** 281,296 **** int ssx_phase_II(SSX *ssx) { int ret; /* display initial progress of the search */ ! show_progress(ssx, 2); /* main loop starts here */ for (;;) { /* display current progress of the search */ #if 0 if (utime() - ssx->tm_lag >= ssx->out_frq - 0.001) #else if (xdifftime(xtime(), ssx->tm_lag) >= ssx->out_frq - 0.001) #endif ! show_progress(ssx, 2); /* check if the iterations limit has been exhausted */ if (ssx->it_lim == 0) { ret = 2; --- 287,309 ---- int ssx_phase_II(SSX *ssx) { int ret; /* display initial progress of the search */ ! // show_progress(ssx, 2); /* main loop starts here */ for (;;) { /* display current progress of the search */ + + /* + #if 0 if (utime() - ssx->tm_lag >= ssx->out_frq - 0.001) #else if (xdifftime(xtime(), ssx->tm_lag) >= ssx->out_frq - 0.001) #endif ! ; // show_progress(ssx, 2); ! ! */ ! ! /* check if the iterations limit has been exhausted */ if (ssx->it_lim == 0) { ret = 2; *************** *** 346,352 **** ssx->it_cnt++; } /* display final progress of the search */ ! show_progress(ssx, 2); /* return to the calling program */ return ret; } --- 359,365 ---- ssx->it_cnt++; } /* display final progress of the search */ ! // show_progress(ssx, 2); /* return to the calling program */ return ret; } Only in glpk-4.39.p4/src: glpssx02.lo Only in glpk-4.39.p4/src: glpssx02.o Only in glpk-4.39.p4/src: glptsp.lo Only in glpk-4.39.p4/src: glptsp.o Only in glpk-4.39.p4/src: libglpk.la Only in glpk-4.39.p4/src: .libs Only in glpk-4.39.p4/src: Makefile Only in glpk-4.39.p4: stamp-h1