00001
00002
00003 #include "typedefs.h"
00004 #include <unistd.h>
00005 #include <time.h>
00006 #include <signal.h>
00007
00008 #ifdef MTCP
00009 #include "mtcp.h"
00010 #endif
00011
00023
00024 #include "centerfocus_defines.h"
00025
00026
00027
00028
00029
00030 #include <iostream>
00031 #include <fstream>
00032
00033 #include <stdlib.h>
00034
00035
00036 #include <time.h>
00037 #include <sstream>
00038 #include <list>
00039 #include <assert.h>
00040 #include <iomanip>
00041 #include <iostream>
00042
00043
00044 #include "timer.h"
00045
00046 #include "PerformanceStatistics.h"
00047
00048 #include "Parameterlist.h"
00049
00050 #include "CoeffList.h"
00051 #include "Statistik.h"
00052 #include "RangStatistik.h"
00053 #include "QuadricsStatistic.h"
00054 #include "LiftStatistic.h"
00055 #include "ReadCenterFocusParams.h"
00056
00057 #include "random.h"
00058
00059
00060
00061
00062
00063
00064
00065
00066 using std::list;
00067
00068
00069
00070 #include "Output.h"
00071 #include "Algorithm.h"
00072
00073
00074 #define USEDHOSTNAMELEN 256
00075
00076 #ifdef CF_TEST
00077 #include "CenterFocusTestUnit.h"
00078 #include "Tests.h"
00079 #endif
00080 #include <cxxtest/TestSuite.h>
00081
00082
00083
00084
00085
00086
00087
00094
00095 void printProgramAndEnvironmentInfo(ostream &os, const char* argv[])
00096 {
00097
00098 os << std::endl;
00099 os << "-- program information: " << std::endl;
00100 os << "-- program " << argv[0] << "; " << std::endl;
00101 os << " programID = " << PROGRAMID << ";"<<std::endl;
00102
00103 os << "-- svn: " << REVISION << std::endl;
00104 os << "-- compile flags: " << SW_STATUS(COMPILEFLAGS) << std::endl;
00105 cerr << "-- compile flags: " << SW_STATUS(COMPILEFLAGS) << std::endl;
00106
00107
00108
00109 os << "cfSvnRoot = \""<< SVNROOT << "\";" << std::endl;
00110 string containCfRevision(REVISION);
00111 std::string::size_type pos = containCfRevision.find_last_of(":");
00112 string cfRevision= containCfRevision.substr(pos+1);
00113
00114 #ifdef SVN
00115
00116 #endif
00117 os << "cfSvnRevision = \""<< cfRevision << "\";" << std::endl;
00118
00119 os << "cfStatus = " << SW_STATUS(STATUS) << " ;" <<std::endl << std::endl;
00120
00121 char* hostname = new char[USEDHOSTNAMELEN];
00122
00123 memset(hostname, '\0', USEDHOSTNAMELEN);
00124
00125 int resGetHostname = gethostname(hostname, USEDHOSTNAMELEN - 1 );
00126 assert(resGetHostname==0);
00127
00128 os << "--" << " started on host: [" << hostname << "] " << std::endl;
00129 delete[] hostname;
00130 os << "-- " << std::endl;
00131
00132 string strScalarType(SW_STATUS(defined_Scalar_Type));
00133 size_t found = strScalarType.find("unsigned");
00134
00135 if ( found != std::string::npos )
00136 std::cerr << "-- warning, defined_Scalar_Type is unsigned ! " << std::endl;
00137 os << "-- defined_Scalar_Type : " << SW_STATUS(defined_Scalar_Type) << std::endl;
00138
00139 #ifdef OPTIMIZED_FIELD
00140 os << "-- max monom degree : " << SW_STATUS(MAXMONOMDEG) << std::endl;
00141 os << "-- FIELDCHAR : " << SW_STATUS(FIELDCHAR) << std::endl;
00142 #endif
00143
00144 os << "-- sizeof(size_t) " << sizeof(size_t) << std::endl;
00145 os << "-- sizeof(char) " << sizeof(char) << std::endl;
00146 os << "-- sizeof(short) " << sizeof(short) << std::endl;
00147 os << "-- sizeof(int) " << sizeof(int) << std::endl;
00148 os << "-- sizeof(long) " << sizeof(long) << std::endl;
00149
00150
00151
00152 #ifdef UNSIGNED
00153 os << "-- Warning: defined_Scalar_Type is unsigned" << std::endl;
00154 #endif
00155
00156 #ifdef MAXMONOMDEG
00157 os << "-- maxmonomdegree: " << MAXMONOMDEG << std::endl;
00158 #endif
00159
00160
00161 #ifdef DEBUG
00162 std::cerr << "getchar" << std::endl;
00163 getchar();
00164 #endif
00165
00166 std::cerr << "--------------" << std::endl << std::endl;
00167 }
00168
00169
00172 void printResultFormatInfo(ostream &os)
00173 {
00174 os << "-- The result is formatted as follows: " << endl;
00175 os << "-- " << endl;
00176 os << "-- L = { Level_0 } ; " << endl;
00177 os << "-- " << endl;
00178 os << "-- Level_0 := empty | Experiment_0, Experiment_1, ... , Experiment_n } " << endl;
00179 os << "-- " << endl;
00180 os << "-- Experiment_i := { Point, PointID, VanishedValuesNum, FocalValuesList, } " << endl;
00181 os << "-- | { Point, PointID, VanishedValuesNum, FocalValuesList, Jacobian, rank(Jacobian) } " << endl;
00182 os << "-- | { Point, PointID, VanishedValuesNum, FocalValuesList, Jacobian, rank(Jacobian), QuadricSmall, TangentCone2 } " << endl;
00183 os << "-- " << endl;
00184 os << "-- with " << endl;
00185 os << "-- Point := { PMonomCoefficients_Degree_2, QMonomCoefficients_Degree_2, " << endl;
00186 os << " PMonomCoefficients_Degree_3, QMonomCoefficients_Degree_3,...," << endl;
00187 os << " PMonomCoefficients_Degree_N, QMonomCoefficients_DegreeN }" << endl;
00188 os << " where Degree 'N' is max( deg(P),deg(Q) ) " << endl;
00189 os << "-- and " << endl;
00190 os << "-- PMonomCoefficients_Degree_i := { coeff ( PMonom x^i*y^0 ), coeff ( PMonom x^(i-1)*y^1 )... , coeff ( PMonom x^0*y^i ) }" << endl;
00191 os << "-- QMonomCoefficients_Degree_i := { coeff ( QMonom x^i*y^0 ), coeff ( QMonom x^(i-1)*y^1 )... , coeff ( QMonom x^0*y^i ) }" << endl;
00192 os << " where Degree N is max( deg(P),deg(Q) ) " << endl;
00193 os << "-- " << endl;
00194 os << "-- with " << endl;
00195 os << "-- FocalValuesList := { focalvalue_01, focalvalue_02, ... , focalvalue_? }" << endl;
00196 os << "-- (length of FocalValuesList is varying, minimum is = min( number of vanished focalvalues + 1, maxFocalValuesToCompute ) " << endl;
00197 os << "-- " << endl;
00198 os << "-- with " << endl;
00199 os << "-- Jacobian := { MatrixRow_0, MatrixRow_1, MatrixRow_1, ... , MatrixRow_(S-1) }" << endl;
00200 os << " where row count S is ='minNullen', ( requested number of vanished focal values) " << endl;
00201 os << " and MatrixRow_i := { MatrixEntry#i#0, MatrixEntry#i#1, ... , MatrixEntry#i#cols-1 } " << endl;
00202 os << " where 'cols' is either the number of variated P,Q monom coefficients (parameter JacobiUnterMatrix = 1) "<< endl;
00203 os << " or 'cols' is the number of all P,Q monom coefficients ( parameter JacobiUnterMatrix = 0) "<< endl;
00204 os << "-- " << endl;
00205 os << "-- with " << endl;
00206 os << "-- QuadricSmall := { t^T*RB_0*t, t^T*RB_1*t, .. t^T*RB_r * t }" << endl;
00207 os << "-- where t := { t_1,...t_#b }" << endl;
00208 os << "-- #b := dim Ker (Jacobi)" << endl;
00209 os << "-- and <RB_0,RB_1,..RB_r > = basis ( R_0,R_1,,..R_#c )" << endl;
00210 os << "-- and r = dim<RB_0,RB_1,..RB_r > " << endl;
00211 os << "-- #c is rank CoKer(Jacobian)" << endl;
00212 os << "-- R_i' = CoKer(Jacobian) * Lambda_i " << endl;
00213 os << "-- and ( R_0,R_1,,..R_#c ) = transversalView ( R_0',R_1',,..R_#c' ) " << endl;
00214 os << "-- where ( R_0',R_1',,..R_#c' ) is a 3D matrix " << endl;
00215 os << "-- " << endl;
00216 os << "-- with " << endl;
00217 os << "-- TangentCone2 := { LinearBig, QuadricBig } " << endl;
00218 os << "-- LinearBig := { varsPQ^T*Ker(Jacobian) } " << endl;
00219 os << "-- QuadricBig := { varsPQ^T*(D^T* RB_0 *D)* varsPQ, " << endl;
00220 os << "-- varsPQ^T*(D^T* RB_1 *D)* varsPQ, ..., varsPQ^T*(D^T* RB_r *D)*varsPQ }" << endl;
00221 os << "-- where D = LeftInverse ( Ker(Jacobian) ) " << endl;
00222 os << "-- and varsPQ = ? " << endl;
00223 os << "-- " << endl;
00224
00225 }
00226
00227
00228 namespace nCenterFocus
00229 {
00230
00231
00232
00233 template<class MatrixType, class VectorType1, class VectorType2>
00234 void testSolveLGS(MatrixType &lgs, VectorType1 &rightHandSide, VectorType2 &referenceSol, int referenceRank, int solutionNum )
00235 {
00236
00237 typename MatrixType::ElementType * localRightHandSide = new typename MatrixType::ElementType[ lgs.getRowNum() ];
00238
00239 for (int varNum=0; varNum<lgs.getRowNum() ; varNum++)
00240 localRightHandSide[varNum] = rightHandSide[varNum].getX();
00241
00242 int rank=-1;
00243 typename MatrixType::ElementType * LGSsol = lgs.solveLGS( localRightHandSide, rank );
00244
00245 cerr << "LGS solved" << endl;
00246 if (solutionNum>0)
00247 {
00248
00249 assert( LGSsol );
00250
00251 if (solutionNum==1)
00252 for (int varNum=0; varNum<lgs.getColNum() ; varNum++)
00253 {
00254 assert( LGSsol[varNum] == referenceSol[varNum].getX() );
00255
00256 }
00257 assert (referenceRank == rank );
00258 }
00259 else
00260 assert(!LGSsol);
00261 delete[] localRightHandSide;
00262 return ;
00263 }
00264
00265
00266 void testSolveLGS(int characteristic, string &inputMatrixStr ,string &rhsString, string &referenceSolString, int referenceRank, int solutionNum)
00267 {
00268 defined_Field_Type field(characteristic,0);
00269
00270 stringstream referenceSolStream (referenceSolString);
00271
00272 stringstream rhsStream (rhsString);
00273 TVector<defined_Field_Type> referenceSol(&field, referenceSolStream );
00274
00275 stringstream inputMatrixStream (inputMatrixStr);
00276
00277 TMatrix<defined_Field_Type> testMatrix( &field, inputMatrixStream, "testMatrix" );
00278
00279 typedef FFpackMatrix< Modular<double> > FFpackMatrixType;
00280
00281
00282 TVector<defined_Field_Type> rightHandSide(&field, rhsStream );
00283
00284 FFpackMatrixType lgs(testMatrix, characteristic);
00285
00286
00287
00288 testSolveLGS(lgs,rightHandSide,referenceSol, referenceRank, solutionNum) ;
00289 }
00290
00296 void lgsSandbox()
00297 {
00298 int characteristic=23;
00299 int solutionNum;
00300 int referenceRank=-1;
00301
00302
00303 string inputMatrixStr ( " { {0 ,0, 0 }, {0, 0, 22 } }" );
00304 string rhsString ( " {0, 4 } " );
00305 string referenceSol ( " {0, 0, 19 } " );
00306
00307 testSolveLGS(characteristic, inputMatrixStr, rhsString, referenceSol, referenceRank=1, solutionNum=1);
00308
00309
00310
00311 inputMatrixStr = ( " { {0 ,0, 0 }, {0, 0, 23 } }" );
00312 rhsString = ( " {1, 4 } " );
00313 referenceSol = ( " {0, 0, 19 } " );
00314
00315 testSolveLGS(characteristic, inputMatrixStr, rhsString, referenceSol, referenceRank=-1, solutionNum=0);
00316
00317
00318
00319 inputMatrixStr = ( " { {1 ,0 }, {0, 2 } }" );
00320 rhsString = ( " {1, 4 } " );
00321 referenceSol = ( " {1, 2 } " );
00322
00323 testSolveLGS(characteristic, inputMatrixStr, rhsString, referenceSol, referenceRank=2, solutionNum=1);
00324
00325
00326 inputMatrixStr = ( " { {1 ,0 }, {0, 2 }, {0, 16 } }" );
00327 rhsString = ( " {1, 4, 9 } " );
00328 referenceSol = ( " {1, 2 } " );
00329
00330 testSolveLGS(characteristic, inputMatrixStr, rhsString, referenceSol, referenceRank=2, solutionNum=1);
00331
00332
00333 inputMatrixStr = ( " { { 0 ,2 }, {1, 0 }, {0, 16 } }" );
00334 rhsString = ( " {4, 1, 9 } " );
00335 referenceSol = ( " {1, 2 } " );
00336
00337 testSolveLGS(characteristic, inputMatrixStr, rhsString, referenceSol,referenceRank=2, solutionNum=1);
00338
00339 inputMatrixStr = ( " { {0 ,22, 0 }, {0, 0, 22 } }" );
00340 rhsString = ( " {4, 4 } " );
00341 referenceSol = ( " {0, 19, 19 } " );
00342
00343 testSolveLGS(characteristic, inputMatrixStr, rhsString, referenceSol,referenceRank=2, solutionNum = 1);
00344
00345 inputMatrixStr = ( " { { 8, 17, 5, 9, 13, 20, 0, 15, 0, 22, 1, 0, 8, 0}, {13, 5, 16, 4, 0, 16, 20, 17, 17, 20, 12, 2, 15, 21}, {13, 22, 13, 14, 5, 9, 16, 17, 11, 7, 21, 9, 6, 13} }" );
00346 rhsString = ( " {15, 5, 13 } " );
00347 referenceSol = ( " { 8, 17, 5, 9, 13, 20, 0, 15, 0, 22, 1, 0, 8, 0} " );
00348
00349 testSolveLGS(characteristic, inputMatrixStr, rhsString, referenceSol,referenceRank=3, solutionNum = 2);
00350
00351
00352 cerr <<" lgsSandbox Test passed!" << endl;
00353 }
00354
00355
00356 int centerfocus(int argc, const char* argv[]);
00357 };
00360 int main(int argc, const char* argv[])
00361 {
00362
00363
00364 #ifdef COUNT
00365
00366 initCounters();
00367 #endif
00368
00369 #ifdef CF_TEST
00370 cerr << "CF_TEST defined" << endl;
00371 nCenterFocus::frommerTest();
00372 nCenterFocus::lgsSandbox();
00373 nCenterFocus::testAllPolynomDefs();
00374 testRandom(29);
00375 autotest();
00376 #endif
00377
00378
00379
00380
00381 try {
00382
00383 return nCenterFocus::centerfocus(argc,argv);
00384 }
00385 catch(const char* error)
00386 {
00387
00388
00389 std::cerr << "Error:" << error << std::endl;
00390 }
00391 catch(char* error)
00392 {
00393
00394
00395 std::cerr << "Error:" << error << std::endl;
00396 }
00397
00398
00399
00400
00401
00402
00403
00404
00405 }
00406
00407
00408
00409
00410
00411 namespace nCenterFocus
00412 {
00413
00414
00415 void correctVanishedFocalValuesStatistic(const D_CenterfocusParams & params, DStatistic& st)
00416 {
00417 if (params.polynomsContainsVariableCoeff() )
00418 {
00419 int parametrizedFocalValuesNum=params.getParametrizedFocalValuesNum();
00420
00422 assert(params.requiredVanishedFocalValuesNum()>=params.getParametrizedFocalValuesNum() );
00423
00424
00425
00426 switch (params.getHamiltonianComponentSwitch() )
00427 {
00428 case 1:
00429
00430
00431
00432
00433
00434 assert( st.getMaxLoggedSuccessiveVanishedFocalValues()>=parametrizedFocalValuesNum );
00435
00436
00437
00438 st.correctHamiltonComponentStatistic( parametrizedFocalValuesNum, hamiltonianPointCount_g );
00439
00440 break;
00441
00442 case -1:
00443
00444
00445
00446
00447
00448
00449 st.correctNonHamiltonComponentStatistic( parametrizedFocalValuesNum, hamiltonianPointCount_g );
00450 break;
00451
00452 default:
00453 break;
00454 }
00455 }
00456 }
00457
00471
00473 int centerfocus(int argc, const char* argv[])
00474 {
00475 #ifdef MTCP
00476
00477 #endif
00478 std::cerr << "__FUNCTION__" << __FUNCTION__ << endl;
00479 std::cerr << "__PRETTY_FUNCTION__" << __PRETTY_FUNCTION__ << endl;
00480
00481
00482
00483
00484 #ifdef TIMER
00485 Timer tim;
00486 Timer sum;
00487 MtcpManager_g.connectTimer(tim);
00488 MtcpManager_g.connectTimer(sum);
00489
00490 tim.clear();
00491 tim.start();
00492
00493 #endif
00494
00495 D_CenterfocusParams* params= new D_CenterfocusParams(argc, argv);
00496
00497 #ifdef MTCP
00498 long randomSeed= params->getRandomSeedRef();
00499 std::stringstream sstr;
00500 sstr << randomSeed;
00501
00502 std::string mtcpName= params->getOutputFileName()+".mtcp";
00503
00504 mtcp_init(mtcpName.c_str(),params->getCheckpointInterval() , 0);
00505 #endif
00506
00507 printProgramAndEnvironmentInfo(params->getOsRef(), argv);
00508
00509 PrintCenterFocusResults resultPrinter(params->getOsRef(), std::cerr );
00510
00511
00512 resultPrinter.printHeader( *params );
00513
00514 #ifdef MTCP
00515 MtcpManager_g.checkpointingTimeFrame();
00516 #endif
00517
00518
00519
00520
00523 int maxJacobianRank = min( params->getPDFCoefficientNum(), params->getMaxFocalValuesToCompute() );
00524
00525 RankStatistic fullRankStatistic( RankStatistic::fullRankStatisticString,
00526 params->requiredVanishedFocalValuesNum(),
00527 params->getMaxFocalValuesToCompute(),
00528 maxJacobianRank );
00529
00530 RankStatistic subRankStatistic( RankStatistic::subRankStatisticString ,
00531 params->requiredVanishedFocalValuesNum(),
00532 params->getMaxFocalValuesToCompute(),
00533 maxJacobianRank );
00534
00535 LiftAndQuadricsStatistic fullQuadricsStatistic( "fullQuadricsStatistic",
00536 params->requiredVanishedFocalValuesNum(),
00537 params->getMaxFocalValuesToCompute(),
00538 maxJacobianRank ,
00539 params->getExhaustiveMaxLift() ,
00540 params->getExhaustiveLiftTrials()
00541 );
00542 LiftAndQuadricsStatistic subQuadricsStatistic( "subQuadricsStatistic" ,
00543 params->requiredVanishedFocalValuesNum(),
00544 params->getMaxFocalValuesToCompute(),
00545 maxJacobianRank ,
00546 params->getExhaustiveMaxLift() ,
00547 params->getExhaustiveLiftTrials()
00548 );
00549
00550 FailedLiftStatistic liftStatistic(params->getExhaustiveMaxLift(), params->getExhaustiveLiftTrials() ) ;
00551
00552
00553 CenterFocusExperiment<1> cfExperiment(params, &resultPrinter);
00554 #ifdef VALGRIND
00555 std::cerr << "getchar in centerfocus " << std::endl;
00556 getchar();
00557 #endif
00558
00559 std::cerr << "starting experiments..\n\n.\n\n " << std::endl;
00560 params->getOsRef() << "--Results " << std::endl;
00561 params->getOsRef() << "cfBeginResults = \"\"; -- begin results marker" << std::endl;
00562
00563 resultPrinter.startPrintingResults( );
00564
00565 int experimentCounter=0;
00566
00567 long64 inputPointCounter=0;
00568
00569 assert( params->areWellDefined() );
00570
00571
00572
00575 while (params->readNextPolynoms() )
00576 {
00577
00578
00579
00580 #ifdef DEBUG
00581 std::cerr <<std::endl << "readNextPolynoms : " << " ! \n" ;
00582 getchar();
00583 #endif
00584
00585
00586 cfExperiment.performExperiment(params, fullRankStatistic, subRankStatistic, fullQuadricsStatistic, subQuadricsStatistic, liftStatistic);
00587
00588
00589 inputPointCounter+=cfExperiment.getInputPointNum();
00590
00591
00592 experimentCounter++;
00593
00594 }
00595
00596
00597
00598
00599 params->initAllCoeffitientsAreVariables();
00600
00601
00602 resultPrinter.endPrintingResults();
00603 params->getOsRef() << "cfEndParams = \"\"; -- end params marker" << std::endl;
00604
00605 DStatistic& st = cfExperiment.getStatisticRef();
00606
00608 if ( !params->polynomsHaveCheckAllCoeff() &&
00609 !params->polynomsHaveRandomCoeff()
00610 )
00611 {
00612
00613 params->getOsRef() << "virtualInputPointCount = " << inputPointCounter << ";" << std::endl;
00614 }
00615 else
00616 {
00620 long64 experimentCounter= st.getTrialCountWithGivenNumOfFirstSuccessiveVanishedFocalValues(0);
00621
00622 if (params->getParametrizedFocalValuesNum()==0)
00623 {
00624 assert(inputPointCounter>=experimentCounter);
00625 experimentCounter = inputPointCounter;
00626 }
00627 params->getOsRef() << "virtualInputPointCount = " << experimentCounter << ";" << std::endl;
00628 }
00629
00630 correctVanishedFocalValuesStatistic(*params, st);
00631
00632 st.print(params->getOsRef());
00633
00634 fullRankStatistic.print( params->getOsRef() );
00635 subRankStatistic.print( params->getOsRef() );
00636 fullQuadricsStatistic.print( params->getOsRef() );
00637 subQuadricsStatistic.print( params->getOsRef() );
00638
00639
00640 params->getOsRef() << "hamiltonianCount =" << hamiltonianPointCount_g << ";"<< std::endl;
00641
00642
00643 params->getOsRef() << "--endResults " << std::endl;
00644 params->getOsRef() << "cfEndResults = \"\"; -- end results marker" << std::endl;
00645
00646
00647 params->getOsRef() << std::endl ;
00648
00649 cfExperiment.printVariableOrder(params->getOsRef() );
00650
00651
00652
00653
00654
00655 if (params->pureSmoothnessTest() )
00656 resultPrinter.printSmoothnessTestTail( params->getOsRef() );
00657 else
00658 resultPrinter.printTail( params->getOsRef() );
00659
00660 params->getOsRef() << std::endl ;
00661
00662 if (params->hasVariableCoefficients())
00663 {
00664
00665
00666 params->getOsRef() << "hasVariableCoefficients = true;" << std::endl;
00667 params->getOsRef() << "hasVariableConstCoefficients = true;" << std::endl;
00668 }
00669 else
00670 {
00671
00672
00673 params->getOsRef() << "hasVariableCoefficients = false;" << std::endl;
00674 params->getOsRef() << "hasVariableConstCoefficients = false;" << std::endl;
00675 }
00676 params->getOsRef() << "inputPointCounter = " << inputPointCounter << ";" << std::endl;
00677
00678
00679
00680
00681 if (params->hasVariableCoefficients() )
00682 {
00683 params->getOsRef() << "coeffTryRandom = " << params->getCoeffTryRandom() << ";" << std::endl;
00684 params->getOsRef() << "coeffTryAll = " << params->getCoeffTryAll() << ";" << std::endl;
00685
00686 if (params->allConstCoefficientsAreVariables() )
00687 {
00688 params->getOsRef() << "allConstCoefficientsAreVariables = true;" << std::endl;
00689 }
00690 else
00691 {
00692
00693
00694
00695 assert(params->getParametrizedFocalValuesNum()==0);
00696 params->getOsRef() << "allConstCoefficientsAreVariables = false;" << std::endl;
00697 }
00698 }
00699 else if (!params->hasVariableCoefficients() && params->getRequestedTrialsNum()>0 )
00700 {
00701 assert(false);
00702 params->getOsRef() << "allConstCoefficientsAreVariables = false;" << std::endl;
00703 params->getOsRef() << "coeffTryRandom = NULL ;" << std::endl;
00704 params->getOsRef() << "coeffTryAll = NULL ;" << std::endl;
00705 }
00706 else if (!params->hasVariableCoefficients() && params->getRequestedTrialsNum()==0)
00707 {
00708 params->getOsRef() << "allConstCoefficientsAreVariables = false;" << std::endl;
00709 params->getOsRef() << "coeffTryRandom = 0 ;" << std::endl;
00710 params->getOsRef() << "coeffTryAll = 0 ;" << std::endl;
00711 }
00712 params->getOsRef() << std::endl ;
00713
00714 params->getOsRef() << "cfSuccess = true ; \n" ;
00715
00716 cfExperiment.printAlgorithmTimings ( params->getOsRef() );
00717 cfExperiment.printStageTimings ( params->getOsRef() );
00718
00719
00720
00721 if (params->logExtendedLiftStatistic() )
00722 {
00723 liftStatistic.print( params->getOsRef() );
00724 g_extLiftStatistic.print(params->getOsRef() );
00725 }
00726
00727 #ifdef TIMER
00728 tim.stop();
00729 resultPrinter.outputTimerInfo(params->getOsRef(),tim);
00730 resultPrinter.outputTimerInfo(std::cerr,tim);
00731
00732
00733 #endif
00734
00735 fflush(stdin);
00736
00737 assert(!params->getOsRef().fail() );
00738
00739
00740
00741
00742 params->getOsRef().close();
00743
00744 if (! (params->writeResultToCout()) )
00745 {
00746
00747 assert(!params->getOsRef().fail() );
00748 }
00749
00750
00751 #ifdef COUNT
00752 resultPrinter.outputOperationsCount(params->getOsRef());
00753 resultPrinter.outputOperationsCount(std::cerr);
00754 #endif
00755 std::cerr <<std::endl << "output file was " << params->getOutputFileName() << " ! \n" ;
00756 delete params;
00757 std::cerr <<std::endl << "-- centerfocus: successful!" << std::endl;
00758
00759 #ifdef TIMER
00760 MtcpManager_g.disconnectTimer(tim);
00761 MtcpManager_g.disconnectTimer(sum);
00762 #endif
00763
00764 return 0;
00765 }
00766
00767
00768
00769
00770
00771
00772
00775 class CenterFocusOptions
00776 {
00777 int fieldCharacteristic;
00778 int NumberOfFocalValuesToCompute;
00779 int logExamlesWithMinJacobianRank;
00780 int logExamlesWithMinVanishedFocalValues;
00781 bool computeJacobianRank;
00782 long64 randomExperimentsNum;
00783 int maxMonomDegreeInPorQ;
00784 int epsPrecision;
00785 int randomSeed;
00786 int defaultRandomSeed;
00787 bool abortFocalComputationOnFirstUnvanishedValue;
00788 bool useFormula_1;
00789 bool useFormula_2;
00790 bool filderHamiltonComponents;
00791 bool useTimerAsRandomSeed;
00792 bool jacobianSubMatrix;
00793 bool progressIndication;
00794 long64 trialsForSingleProgressStep;
00795
00796 ifstream MonomialExperimentData;
00797 CenterFocusOptions() {};
00798 };
00799
00800
00801 };