//------------------------------------------------------------------------------ bool NonlinearConstraint::Initialize() { #if DEBUG_NONLINEAR_CONSTRAINT_INIT MessageInterface::ShowMessage (wxT("NonlinearConstraint::Initialize() entered. interpreted=%d, optimizer=%p, ") wxT("arg1=%p, arg2=%p\n"), interpreted, optimizer, arg1, arg2); #endif // Commented out since this caused crash when this command created // from the GUI and run (loj: 2007.05.15) //if (!interpreted) // if (!InterpretAction()) // throw CommandException( // "NonlinearConstraint: error interpreting input data\n"); bool retval = GmatCommand::Initialize(); if (optimizer == NULL) throw CommandException( wxT("Optimizer not initialized for NonlinearConstraint command\n \"") + generatingString + wxT("\"\n")); // Set references for the wrappers #ifdef DEBUG_NONLINEAR_CONSTRAINT_PARAM MessageInterface::ShowMessage(wxT("Setting refs for arg1\n")); #endif if (SetWrapperReferences(*arg1) == false) return false; CheckDataType(arg1, Gmat::REAL_TYPE, wxT("NonlinearConstraint")); #ifdef DEBUG_NONLINEAR_CONSTRAINT_PARAM MessageInterface::ShowMessage(wxT("Setting refs for arg2\n")); #endif if (SetWrapperReferences(*arg2) == false) return false; CheckDataType(arg2, Gmat::REAL_TYPE, wxT("NonlinearConstraint")); // The optimizer cannot be finalized until all of the loop is initialized optimizerDataFinalized = false; #if DEBUG_NONLINEAR_CONSTRAINT_INIT MessageInterface::ShowMessage (wxT("NonlinearConstraint::Initialize() exiting. optimizer=%p, arg1=%p, arg2 = %p\n"), optimizer, arg1, arg2); #endif return retval; }
//------------------------------------------------------------------------------ bool Minimize::Initialize() { #if DEBUG_MINIMIZE_INIT // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ debug ~~~~ MessageInterface::ShowMessage ("Minimize::Initialize() entered. optimizer=%p, objective=%p\n", optimizer, objective); #endif // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end debug ~~~~ if (!interpreted) if (!InterpretAction()) throw CommandException( "Minimize: error interpreting input data\n"); bool retval = SolverSequenceCommand::Initialize(); if (optimizer == NULL) throw CommandException( "Optimizer not initialized for Minimize command\n \"" + generatingString + "\"\n"); //Integer id = optimizer->GetParameterID("Goals"); // no clue //optimizer->SetStringParameter(id, goalName); // find objectiveName //GmatBase *obj = (*objectMap)[objectiveName]; //if (obj == NULL) //{ // std::string errorstr = "Could not find variable parameter "; // errorstr += objectiveName; // throw CommandException(errorstr); //} // The optimizer cannot be finalized until all of the loop is initialized optimizerDataFinalized = false; if (SetWrapperReferences(*objective) == false) return false; CheckDataType(objective, Gmat::REAL_TYPE, "Minimize"); #if DEBUG_MINIMIZE_INIT // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ debug ~~~~ MessageInterface::ShowMessage ("Minimize::Initialize() exiting. optimizer=%p, objective=%p\n", optimizer, objective); #endif // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end debug ~~~~ return retval; }