//------------------------------------------------------------------------------ void Solver::CompleteInitialization() { OpenSolverTextFile(); WriteToTextFile(); currentState = NOMINAL; // Reset initial values if in DiscardAndContinue mode if (exitMode == DISCARD) { ResetVariables(); } }
//------------------------------------------------------------------------------ void BatchEstimator::WriteToTextFile(Solver::SolverState sState) { if (!showProgress) return; if (!textFile.is_open()) OpenSolverTextFile(); Solver::SolverState theState = sState; if (sState == Solver::UNDEFINED_STATE) theState = currentState; const std::vector<ListItem*> *map = esm.GetStateMap(); switch (theState) { case INITIALIZING: textFile << "\n****************************" << "****************************\n" << "*** Initializing Estimation \n" << "****************************" << "****************************\n" << "\n\na priori state:\n"; if (estEpochFormat != "FromParticipants") textFile << " Estimation Epoch (" << estEpochFormat << "): " << estEpoch << "\n\n"; else textFile << " Estimation Epoch (A.1 modified Julian): " << estimationEpoch << "\n\n"; for (UnsignedInt i = 0; i < map->size(); ++i) { textFile << " " << (*map)[i]->objectName << "." << (*map)[i]->elementName << "." << (*map)[i]->subelement << " = " << (*estimationState)[i] << "\n"; } break; case CHECKINGRUN: if (textFileMode == "Verbose") { textFile << "------------------------------" << "------------------------\n" << "Iteration " << iterationsTaken << "\n\nCurrent estimated state:\n"; if (estEpochFormat != "FromParticipants") textFile << " Estimation Epoch (" << estEpochFormat << "): " << estEpoch << "\n\n"; else textFile << " Estimation Epoch (A.1 modified Julian): " << estimationEpoch << "\n\n"; for (UnsignedInt i = 0; i < map->size(); ++i) { textFile << " " << (*map)[i]->objectName << "." << (*map)[i]->elementName << "." << (*map)[i]->subelement << " = " << (*estimationState)[i] << "\n"; } textFile << "\n RMS residuals at this iteration: " << newResidualRMS << "\n\n"; } break; case FINISHED: textFile << "\n****************************" << "****************************\n" << "*** Estimating Completed in " << iterationsTaken << " iterations" << "\n****************************" << "****************************\n\n" << "Estimation " << (converged ? "converged!" : "did not converge") << "\n\nFinal Estimated State:\n\n"; if (estEpochFormat != "FromParticipants") textFile << " Estimation Epoch (" << estEpochFormat << "): " << estEpoch << "\n\n"; else textFile << " Estimation Epoch (A.1 modified Julian): " << estimationEpoch << "\n\n"; for (UnsignedInt i = 0; i < map->size(); ++i) { textFile << " " << (*map)[i]->objectName << "." << (*map)[i]->elementName << "." << (*map)[i]->subelement << " = " << (*estimationState)[i] << "\n"; } { // Switch statement scoping Rmatrix finalCovariance = information.Inverse(); textFile << "\nFinal Covariance Matrix:\n\n"; for (Integer i = 0; i < finalCovariance.GetNumRows(); ++i) { for (Integer j = 0; j < finalCovariance.GetNumColumns(); ++j) textFile << " " << finalCovariance(i, j); textFile << "\n"; } } if (textFileMode == "Verbose") { textFile << "\n RMS residuals at previous iteration: " << oldResidualRMS; textFile << "\n RMS residuals at this iteration: " << newResidualRMS << "\n\n"; } textFile << "\n****************************" << "****************************\n\n" << std::endl; break; default: break; } }