int main( int argv, char* argc[] ) { // Set the data: // Number of variables Index N = 100; // constant terms in the constraints Number* a = new double[N - 2]; for( Index i = 0; i < N - 2; i++ ) { a[i] = (double(i + 2)) / (double) N; } // Create a new instance of your nlp // (use a SmartPtr, not raw) SmartPtr<TNLP> mynlp = new TutorialCpp_NLP(N, a); // Create a new instance of IpoptApplication // (use a SmartPtr, not raw) SmartPtr<IpoptApplication> app = new IpoptApplication(); // Change some options // Note: The following choices are only examples, they might not be // suitable for your optimization problem. app->Options()->SetNumericValue("tol", 1e-10); app->Options()->SetStringValue("mu_strategy", "adaptive"); // Intialize the IpoptApplication and process the options app->Initialize(); // Ask Ipopt to solve the problem ApplicationReturnStatus status = app->OptimizeTNLP(mynlp); if( status == Solve_Succeeded ) { printf("\n\n*** The problem solved!\n"); } else { printf("\n\n*** The problem FAILED!\n"); } // As the SmartPtrs go out of scope, the reference count // will be decremented and the objects will automatically // be deleted. // However, we created the Number array for a here and have to delete it delete[] a; return (int) status; }
int main(int argv, char* argc[]) { // Create a new instance of your nlp // (use a SmartPtr, not raw) SmartPtr<TNLP> mynlp = new HS071_NLP(); // Create a new instance of IpoptApplication // (use a SmartPtr, not raw) // We are using the factory, since this allows us to compile this // example with an Ipopt Windows DLL SmartPtr<IpoptApplication> app = IpoptApplicationFactory(); app->RethrowNonIpoptException(true); // Change some options // Note: The following choices are only examples, they might not be // suitable for your optimization problem. app->Options()->SetNumericValue("tol", 1e-7); app->Options()->SetStringValue("mu_strategy", "adaptive"); app->Options()->SetStringValue("output_file", "ipopt.out"); // The following overwrites the default name (ipopt.opt) of the // options file // app->Options()->SetStringValue("option_file_name", "hs071.opt"); // Initialize the IpoptApplication and process the options ApplicationReturnStatus status; status = app->Initialize(); if (status != Solve_Succeeded) { std::cout << std::endl << std::endl << "*** Error during initialization!" << std::endl; return (int) status; } // Ask Ipopt to solve the problem status = app->OptimizeTNLP(mynlp); if (status == Solve_Succeeded) { std::cout << std::endl << std::endl << "*** The problem solved!" << std::endl; } else { std::cout << std::endl << std::endl << "*** The problem FAILED!" << std::endl; } // As the SmartPtrs go out of scope, the reference count // will be decremented and the objects will automatically // be deleted. return (int) status; }
bool OptimProblem::solveOptimization(const yarp::sig::Vector& desiredCoM, const yarp::sig::Vector& desiredJoints, std::string feetInContact) { assert(pimpl); pimpl->resetOptimizationData(desiredCoM, desiredJoints, feetInContact); // // Create a new instance of your nlp // // (use a SmartPtr, not raw) SmartPtr<TNLP> mynlp = new Solver(*pimpl); // // Create a new instance of IpoptApplication // (use a SmartPtr, not raw) // We are using the factory, since this allows us to compile this // example with an Ipopt Windows DLL SmartPtr<IpoptApplication> app = IpoptApplicationFactory(); // // // Change some options // // Note: The following choices are only examples, they might not be // // suitable for your optimization problem. // app->Options()->SetNumericValue("tol", 1e-9); // app->Options()->SetStringValue("mu_strategy", "adaptive"); // app->Options()->SetStringValue("output_file", "ipopt.out"); app->Options()->SetStringValue("hessian_approximation", "limited-memory"); // // // Intialize the IpoptApplication and process the options ApplicationReturnStatus status; status = app->Initialize(); if (status != Solve_Succeeded) { yError("*** Error during initialization of IpOpt!"); return (int) status; } // Ask Ipopt to solve the problem status = app->OptimizeTNLP(mynlp); if (status == Solve_Succeeded) { yInfo("*** The problem solved!"); } else { yError("*** The problem FAILED!"); } return (int) status; }
int loadProblem(char *fname,unsigned long len ){ CheckInputArgument(pvApiCtx, 9, 9); // We need total 9 input arguments. CheckOutputArgument(pvApiCtx, 1, 1); // Return value will be termination status (0 for no-errors and 1/non-zero for errors) double *QItems=NULL,*PItems=NULL,*ConItems=NULL,*conUB=NULL,*conLB=NULL,*varUB=NULL,*varLB=NULL; unsigned int nVars,nCons; unsigned int arg = 1,temp1,temp2; if ( !getIntFromScilab(arg,&nVars) && arg++ && !getIntFromScilab(arg,&nCons) && arg++ && !getDoubleMatrixFromScilab(arg,&temp1,&temp2,&QItems) && temp1 == nVars && temp2 == nVars && arg++ && !getDoubleMatrixFromScilab(arg,&temp1,&temp2,&PItems) && temp2 == nVars && arg++ && !getDoubleMatrixFromScilab(arg,&temp1,&temp2,&ConItems) && temp1 == nCons &&((nCons !=0 && temp2 == nVars)||(temp2==0)) && arg++ && !getDoubleMatrixFromScilab(arg,&temp1,&temp2,&conLB) && temp2 == nCons && arg++ && !getDoubleMatrixFromScilab(arg,&temp1,&temp2,&conUB) && temp2 == nCons && arg++ && !getDoubleMatrixFromScilab(arg,&temp1,&temp2,&varLB) && temp2 == nVars && arg++ && !getDoubleMatrixFromScilab(arg,&temp1,&temp2,&varUB) && temp2 == nVars){ using namespace Ipopt; SmartPtr<TNLP> Prob = new QuadNLP(nVars,nCons,QItems,PItems,ConItems,conUB,conLB,varUB,varLB); SmartPtr<IpoptApplication> app = IpoptApplicationFactory(); app->RethrowNonIpoptException(true); // Change some options // Note: The following choices are only examples, they might not be // suitable for your optimization problem. app->Options()->SetNumericValue("tol", 1e-7); app->Options()->SetStringValue("mu_strategy", "adaptive"); app->Options()->SetStringValue("output_file", "ipopt.out"); // Indicates whether all equality constraints are linear app->Options()->SetStringValue("jac_c_constant", "yes"); // Indicates whether all inequality constraints are linear app->Options()->SetStringValue("jac_d_constant", "yes"); // Indicates whether the problem is a quadratic problem app->Options()->SetStringValue("hessian_constant", "yes"); // The following overwrites the default name (ipopt.opt) of the // options file // app->Options()->SetStringValue("option_file_name", "hs071.opt"); // Initialize the IpoptApplication and process the options ApplicationReturnStatus status; status = app->Initialize(); if (status != Solve_Succeeded) { sciprint("\n*** Error during initialization!\n"); return0toScilab(); return (int) status; } // Ask Ipopt to solve the problem status = app->OptimizeTNLP(Prob); if (status == Solve_Succeeded) { sciprint("\n*** The problem solved!\n"); } else { sciprint( "\n*** The problem FAILED!\n"); } // As the SmartPtrs go out of scope, the reference count // will be decremented and the objects will automatically // be deleted. } else { sciprint("\nError:: check argument %d\n",arg); return0toScilab(); return 1; } return0toScilab(); }
void SensApplication::SetIpoptAlgorithmObjects(SmartPtr<IpoptApplication> app_ipopt, ApplicationReturnStatus ipopt_retval) { DBG_START_METH("SensApplication::SetIpoptAlgorithmObjects", dbg_verbosity); // get optionsList and Journalist options_ = app_ipopt->Options(); jnlst_ = app_ipopt->Jnlst(); ipopt_retval_ = ipopt_retval; // Check whether Ipopt solved to optimality - if not, end computation. if ( ipopt_retval != Solve_Succeeded && ipopt_retval != Solved_To_Acceptable_Level) { jnlst_->Printf(J_ERROR, J_MAIN, "sIPOPT: Aborting sIPOPT computation, because IPOPT did not succeed\n\n"); options_->SetStringValue("sens_internal_abort", "yes"); options_->SetStringValue("redhess_internal_abort", "yes"); } // get pointers from IpoptApplication assessor methods SmartPtr<IpoptAlgorithm> alg = app_ipopt->AlgorithmObject(); SmartPtr<PDSearchDirCalculator> pd_search; pd_search = dynamic_cast<PDSearchDirCalculator*>(GetRawPtr(alg->SearchDirCalc())); // get PD_Solver pd_solver_ = pd_search->PDSolver(); // get data ip_data_ = app_ipopt->IpoptDataObject(); // get calulated quantities ip_cq_ = app_ipopt->IpoptCQObject(); // get NLP ip_nlp_ = app_ipopt->IpoptNLPObject(); options_->GetIntegerValue("n_sens_steps",n_sens_steps_,""); // This checking should be rewritten /* if (false && run_sens_) { // check suffixes std::string state; std::string state_value; const Index* index; const Number* number; Index n_sens_indices, n_this_nmpc_indices; // collect information from suffixes state = "sens_state_1"; //index = ampl_tnlp_->get_index_suffix(state.c_str()); if (index==NULL) { THROW_EXCEPTION(NMPC_SUFFIX_ERROR, "Suffix sens_state_1 is not set"); } n_nmpc_indices = AsIndexSum(ip_data_->curr()->x()->Dim(), index, 1); for (Index i=1; i<=n_sens_steps_; ++i) { state = "sens_state_"; state_value = "sens_state_value_"; append_Index(state, i); append_Index(state_value, i); //index = ampl_tnlp_->get_index_suffix(state.c_str()); if (index==NULL) { std::string msg = "Suffix " + state + " is not set"; THROW_EXCEPTION(NMPC_SUFFIX_ERROR, msg); } n_this_nmpc_indices = AsIndexSum(ip_data_->curr()->x()->Dim(), index, 1); if (n_this_nmpc_indices!=n_nmpc_indices) { std::string msg = "Suffix" + state + "does not have the correct number of flags"; THROW_EXCEPTION(NMPC_SUFFIX_ERROR, msg); } //number = ampl_tnlp_->get_number_suffix(state_value.c_str()); if (number==NULL) { std::string msg = "Suffix " + state_value + " is not set"; THROW_EXCEPTION(NMPC_SUFFIX_ERROR, msg); } } } */ }
int sci_solveminbndp(char *fname) { using namespace Ipopt; CheckInputArgument(pvApiCtx, 5, 5); CheckOutputArgument(pvApiCtx, 9, 9); // Error management variable SciErr sciErr; //Function pointers,lower bound and upper bound pointers int* funptr=NULL; int* gradhesptr=NULL; double* varLB=NULL; double* varUB=NULL; // Input arguments double *cpu_time=NULL,*max_iter=NULL,*tol_val=NULL; static unsigned int nVars = 0,nCons = 0; unsigned int temp1 = 0,temp2 = 0, iret = 0; int x1_rows, x1_cols, x2_rows, x2_cols; // Output arguments double ObjVal=0,iteration=0,cpuTime=0,fobj_eval=0; const double *fX = NULL,*fZl=NULL; const double *fZu=NULL; double dual_inf, constr_viol, complementarity, kkt_error; int rstatus = 0; int int_fobj_eval, int_constr_eval, int_fobj_grad_eval, int_constr_jac_eval, int_hess_eval; ////////// Manage the input argument ////////// //Objective Function if(getFunctionFromScilab(1,&funptr)) { return 1; } //Function for gradient and hessian if(getFunctionFromScilab(2,&gradhesptr)) { return 1; } //x1(lower bound) matrix from scilab if(getDoubleMatrixFromScilab(3, &x1_rows, &x1_cols, &varLB)) { return 1; } //x2(upper bound) matrix from scilab if(getDoubleMatrixFromScilab(4, &x2_rows, &x2_cols, &varUB)) { return 1; } //Getting number of iterations if(getFixedSizeDoubleMatrixInList(5,2,temp1,temp2,&max_iter)) { return 1; } //Getting Cpu Time if(getFixedSizeDoubleMatrixInList(5,4,temp1,temp2,&cpu_time)) { return 1; } //Getting Tolerance Value if(getFixedSizeDoubleMatrixInList(5,6,temp1,temp2,&tol_val)) { return 1; } //Initialization of parameters nVars=x1_rows; nCons=0; // Starting Ipopt SmartPtr<minbndNLP> Prob = new minbndNLP(nVars,nCons,varLB,varUB); SmartPtr<IpoptApplication> app = IpoptApplicationFactory(); ////////// Managing the parameters ////////// app->Options()->SetNumericValue("tol", *tol_val); app->Options()->SetIntegerValue("max_iter", (int)*max_iter); app->Options()->SetNumericValue("max_cpu_time", *cpu_time); ///////// Initialize the IpoptApplication and process the options ///////// ApplicationReturnStatus status; status = app->Initialize(); if (status != Solve_Succeeded) { sciprint("\n*** Error during initialization!\n"); return (int) status; } // Ask Ipopt to solve the problem status = app->OptimizeTNLP((SmartPtr<TNLP>&)Prob); //Get the solve statistics cpuTime = app->Statistics()->TotalCPUTime(); app->Statistics()->NumberOfEvaluations(int_fobj_eval, int_constr_eval, int_fobj_grad_eval, int_constr_jac_eval, int_hess_eval); app->Statistics()->Infeasibilities(dual_inf, constr_viol, complementarity, kkt_error); rstatus = Prob->returnStatus(); ////////// Manage the output argument ////////// fX = Prob->getX(); ObjVal = Prob->getObjVal(); iteration = (double)app->Statistics()->IterationCount(); fobj_eval=(double)int_fobj_eval; fZl = Prob->getZl(); fZu = Prob->getZu(); if (returnDoubleMatrixToScilab(1, 1, nVars, fX)) { return 1; } if (returnDoubleMatrixToScilab(2, 1, 1, &ObjVal)) { return 1; } if (returnIntegerMatrixToScilab(3, 1, 1, &rstatus)) { return 1; } if (returnDoubleMatrixToScilab(4, 1, 1, &iteration)) { return 1; } if (returnDoubleMatrixToScilab(5, 1, 1, &cpuTime)) { return 1; } if (returnDoubleMatrixToScilab(6, 1, 1, &fobj_eval)) { return 1; } if (returnDoubleMatrixToScilab(7, 1, 1, &dual_inf)) { return 1; } if (returnDoubleMatrixToScilab(8, 1, nVars, fZl)) { return 1; } if (returnDoubleMatrixToScilab(9, 1, nVars, fZu)) { return 1; } return 0; }
int main(int argc, char**args) { using namespace Ipopt; SmartPtr<IpoptApplication> app = IpoptApplicationFactory(); app->RethrowNonIpoptException(false); // Check if executable is run only to print out options documentation if (argc == 2) { bool print_options = false; bool print_latex_options = false; if (!strcmp(args[1],"--print-options")) { print_options = true; } else if (!strcmp(args[1],"--print-latex-options")) { print_options = true; print_latex_options = true; } if (print_options) { SmartPtr<OptionsList> options = app->Options(); options->SetStringValue("print_options_documentation", "yes"); if (print_latex_options) { options->SetStringValue("print_options_latex_mode", "yes"); } app->Initialize(""); return 0; } } // Call Initialize the first time to create a journalist, but ignore // any options file ApplicationReturnStatus retval; retval = app->Initialize(""); if (retval != Solve_Succeeded) { printf("ampl_ipopt.cpp: Error in first Initialize!!!!\n"); exit(-100); } // Add the suffix handler for scaling SmartPtr<AmplSuffixHandler> suffix_handler = new AmplSuffixHandler(); suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Constraint_Source, AmplSuffixHandler::Number_Type); suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Objective_Source, AmplSuffixHandler::Number_Type); // Modified for warm-start from AMPL suffix_handler->AddAvailableSuffix("ipopt_zL_out", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); suffix_handler->AddAvailableSuffix("ipopt_zU_out", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); suffix_handler->AddAvailableSuffix("ipopt_zL_in", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); suffix_handler->AddAvailableSuffix("ipopt_zU_in", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); SmartPtr<TNLP> ampl_tnlp = new AmplTNLP(ConstPtr(app->Jnlst()), app->Options(), args, suffix_handler); // Call Initialize again to process output related options retval = app->Initialize(); if (retval != Solve_Succeeded) { printf("ampl_ipopt.cpp: Error in second Initialize!!!!\n"); exit(-101); } const int n_loops = 1; // make larger for profiling for (Index i=0; i<n_loops; i++) { retval = app->OptimizeTNLP(ampl_tnlp); } // finalize_solution method in AmplTNLP writes the solution file return 0; }
int main(int argv, char* argc[]) { mpi_check(MPI_Init(&argv, &argc)); // identify the process char hostname[256]; gethostname(hostname, sizeof(hostname)); printf("Process with PID %d on %s ready to run\n", getpid(), hostname); fflush(stdout); int mpi_rank, mpi_size; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); Index N = -1; Index NS = -1; if(argv == 3) { N = atoi(argc[1]); NS = atoi(argc[2]); } // if rank == MASTER if(mpi_rank == 0) { if (argv != 3) { cout << "Usage: $mpirun -n NP ./solve_problem N NS "; return 0; } // Create an instance of your nlp... SmartPtr<MittelmannBndryCntrlDiri1> tnlp = new MittelmannBndryCntrlDiri1(); if (N <= 0 || NS <= 0) { printf("Given problem size is invalid.\n"); return -3; } bool retval = tnlp->InitializeProblem(N, NS); if (!retval) { printf("Cannot initialize problem. Abort.\n"); return -4; } // Create an instance of the IpoptApplication // We are using the factory, since this allows us to compile this // example with an Ipopt Windows DLL SmartPtr<IpoptApplication> app = IpoptApplicationFactory(); app->Options()->SetNumericValue("tol", 1e-7); app->Options()->SetStringValue("mu_strategy", "adaptive"); app->Options()->SetStringValue("output_file", "ipopt.out"); app->Options()->SetIntegerValue("problem_dimension", N); app->Options()->SetIntegerValue("problem_scenarios", NS); // const std::string prefix = ""; Index nl; // cout << "Retval:" << app->Options()->GetIntegerValue("problem_dimension", nl, prefix) << endl; // cout << "problem_dimension: " << nl << endl; ApplicationReturnStatus status = app->Initialize(); if (status != Solve_Succeeded) { printf("\n\n*** Error during initialization!\n"); return (int) status; } // Set option to use internal scaling // DOES NOT WORK FOR VLUKL* PROBLEMS: // app->Options()->SetStringValueIfUnset("nlp_scaling_method", "user-scaling"); status = app->OptimizeTNLP(GetRawPtr(tnlp)); } else { // child process waits for master to initiate the solution phase int pardiso_mtype = -2; // symmetric H_i int schur_factorization = 1; //augmented factorization SchurSolve schurSolver = SchurSolve(pardiso_mtype, schur_factorization, MPI_COMM_WORLD); schurSolver.initSystem_OptimalControl(NULL, N, NS); while(1) { //do test on termination, set by master process int terminate = 0; MPI_Bcast(&terminate, 1, MPI_INT, 0, MPI_COMM_WORLD); if (terminate) break; //get flag new_matrix to child processes bool new_matrix; MPI_Bcast(&new_matrix, 1, MPI_C_BOOL, 0, MPI_COMM_WORLD); //update system if necessary if(new_matrix) { schurSolver.updateSystem(NULL); } int nrhs = 1; schurSolver.solveSystem(NULL, NULL, nrhs); } } mpi_check(MPI_Finalize()); return 0; }
int main(int argc, char* argv[]) { get_arguments (argc, argv); // figure out which chromosomes I want for (int i=0; i < num_chroms; i++) { chromosome[i] = 0; } char *token; //char locus_coord[] = "locus_coord.txt"; token = strtok(chrom_string,","); while (token != NULL) { int index = atoi(token) - 1; chromosome[index] = 1; token = strtok(NULL,","); } // the max_dist is per kb, so adjust it so that it depends on the resolution max_dist = max_dist * bp_per_locus / 1000.0; // same for min_dist min_dist = min_dist * bp_per_locus / 1000.0; // Create a new instance of your nlp GENOME *mygenome = new GENOME(bp_per_locus, min_dist, max_dist, interactions_filename, chromosome, add_rDNA, rDNA_interactions_filename, use_weights, unseen_interactions_filename, frequencies_distances_filename, structure_filename); // If a temporary pdb file exists, upload it and initialize the problem // there char temp_filename[1000]; sprintf(temp_filename, "%s.temp.txt", output_pdb); FILE* file = fopen(temp_filename, "r"); if(file == 0){ printf("No temporary file - starting optimization from scratch\n"); }else{ fclose(file); mygenome->read_txt_input(temp_filename); } if (strcmp (input_txt, "") != 0) { printf ("Reading the txt input\n"); mygenome->read_txt_input(input_txt); mygenome->print_pdb_genome(output_pdb); if(strcmp(locus_coord,"") != 0){ mygenome->print_1D_3D_genome(locus_coord); } return 1; } else if (strcmp (output_binary_diffusion, "") != 0) { mygenome->save_adjacency_matrix_for_diffusion( output_binary_diffusion, diffusion_operation_type); return 1; } else if (strcmp (output_cplex_input, "") != 0) // just write the .lp file for cplex { SmartPtr<genome_ipopt_nlp> mynlp = new genome_ipopt_nlp( mygenome, min_clash_dist, min_clash_dist_inter, output_pdb, sphere_radius, use_weights, bp_per_locus, rDNA_frequency_normalizer, weight_of_inter, weight_unseen, true, alpha, beta, locus_coord); mynlp->write_cplex_input (output_cplex_input); return 1; } else if (strcmp (input_cplex_output, "") != 0) // read the file in .sol format (cplex output) and write a pdb file { mygenome->read_cplex_output(input_cplex_output); mygenome->print_pdb_genome(output_pdb); if(strcmp (locus_coord,"") != 0){ mygenome->print_1D_3D_genome(locus_coord); } return 1; } //mygenome->save_interaction_adjacency_matrix (initial_interaction_matrix); //mygenome->print_pdb_genome (initial_pdb); // FIXME we haven't interfaced many of the options. SmartPtr<TNLP> mynlp = new genome_ipopt_nlp( mygenome, min_clash_dist, min_clash_dist_inter, output_pdb, sphere_radius, use_weights, bp_per_locus, rDNA_frequency_normalizer, weight_of_inter, weight_unseen, true, alpha, beta, locus_coord ); // Create a new instance of IpoptApplication // (use a SmartPtr, not raw) SmartPtr<IpoptApplication> app = new IpoptApplication(); // Change some options // Note: The following choices are only examples, they might not be // suitable for your optimization problem. app->Options()->SetNumericValue("tol", 1e-1); app->Options()->SetNumericValue("acceptable_tol", 1e-1); // I'm going to set the constraint violation to very very high. app->Options()->SetNumericValue("constr_viol_tol", 1e10); app->Options()->SetNumericValue("mu_init", 0.0001); // This is super high. It should not impact the results app->Options()->SetNumericValue("dual_inf_tol", 10000); app->Options()->SetNumericValue("compl_inf_tol", 1000000); // This should be zero. app->Options()->SetIntegerValue("acceptable_iter", 0); app->Options()->SetIntegerValue("max_iter", 100000); //app->Options()->SetStringValue("mu_strategy", "monotone"); app->Options()->SetStringValue("mu_strategy", "adaptive"); app->Options()->SetStringValue("output_file", logging_filename); app->Options()->SetStringValue("hessian_approximation", "limited-memory"); // The following overwrites the default name (ipopt.opt) of the // options file // app->Options()->SetStringValue("option_file_name", "hs071.opt"); // Intialize the IpoptApplication and process the options ApplicationReturnStatus status; status = app->Initialize(); if (status != Solve_Succeeded) { printf("\n\n*** Error during initialization!\n"); return (int) status; } // Ask Ipopt to solve the problem status = app->OptimizeTNLP(mynlp); if (status == Solve_Succeeded || status == Solved_To_Acceptable_Level) { printf("\n\n*** The problem solved!\n"); } else { printf("\n\n*** The problem FAILED!\n"); exit(1); } // As the SmartPtrs go out of scope, the reference count // will be decremented and the objects will automatically // be deleted. return 1; //(int) status; }