From f455f9b3c105292ccba94f2b5fe0f57cfe4b799c Mon Sep 17 00:00:00 2001 From: Georgey Date: Wed, 15 Mar 2017 16:34:53 +0530 Subject: Added header files for Ipopt 3.12.7,minor modifications to symphony's output texts --- sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.so | Bin 183459 -> 183408 bytes sci_gateway/cpp/sci_ipoptfmincon.cpp | 7 +- sci_gateway/cpp/sci_minconNLP.cpp | 706 +++++++++++----------- sci_gateway/cpp/sci_sym_loadproblem.cpp | 2 +- sci_gateway/cpp/sci_sym_openclose.cpp | 2 + sci_gateway/cpp/sci_sym_set_variables.cpp | 2 +- sci_gateway/cpp/sci_sym_solve.cpp | 6 +- 7 files changed, 364 insertions(+), 361 deletions(-) (limited to 'sci_gateway/cpp') diff --git a/sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.so b/sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.so index ff447af..5a05bab 100755 Binary files a/sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.so and b/sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.so differ diff --git a/sci_gateway/cpp/sci_ipoptfmincon.cpp b/sci_gateway/cpp/sci_ipoptfmincon.cpp index 51f1cce..803d4f3 100644 --- a/sci_gateway/cpp/sci_ipoptfmincon.cpp +++ b/sci_gateway/cpp/sci_ipoptfmincon.cpp @@ -127,6 +127,7 @@ int sci_solveminconp(char *fname) nVars = x0_cols; nCons = A_rows + Aeq_rows + nonlinCon; + // Starting Ipopt @@ -138,7 +139,7 @@ int sci_solveminconp(char *fname) app->Options()->SetNumericValue("tol", 1e-6); app->Options()->SetIntegerValue("max_iter", (int)*max_iter); app->Options()->SetNumericValue("max_cpu_time", *cpu_time); -// app->Options()->SetStringValue("hessian_approximation", "limited-memory"); + app->Options()->SetStringValue("hessian_approximation", "limited-memory"); ///////// Initialize the IpoptApplication and process the options ///////// ApplicationReturnStatus status; @@ -148,7 +149,7 @@ int sci_solveminconp(char *fname) sciprint("\n*** Error during initialization!\n"); return (int) status; } - + // Ask Ipopt to solve the problem status = app->OptimizeTNLP((SmartPtr&)Prob); //Get the solve statistics @@ -157,7 +158,7 @@ int sci_solveminconp(char *fname) app->Statistics()->Infeasibilities(dual_inf, constr_viol, complementarity, kkt_error); rstatus = Prob->returnStatus(); fobj_eval=(double)int_fobj_eval; - + ////////// Manage the output argument ////////// fX = Prob->getX(); diff --git a/sci_gateway/cpp/sci_minconNLP.cpp b/sci_gateway/cpp/sci_minconNLP.cpp index ab15392..e800221 100644 --- a/sci_gateway/cpp/sci_minconNLP.cpp +++ b/sci_gateway/cpp/sci_minconNLP.cpp @@ -23,23 +23,23 @@ extern "C" #include #include -using namespace std; -using namespace Ipopt; + using namespace std; + using namespace Ipopt; -minconNLP::~minconNLP() -{ - if(finalX_) delete[] finalX_; - if(finalZl_) delete[] finalZl_; - if(finalZu_) delete[] finalZu_; - if(finalLambda_) delete[] finalLambda_; -} + minconNLP::~minconNLP() + { + if(finalX_) delete[] finalX_; + if(finalZl_) delete[] finalZl_; + if(finalZu_) delete[] finalZu_; + if(finalLambda_) delete[] finalLambda_; + } //get NLP info such as number of variables,constraints,no.of elements in jacobian and hessian to allocate memory -bool minconNLP::get_nlp_info(Index& n, Index& m, Index& nnz_jac_g, Index& nnz_h_lag, IndexStyleEnum& index_style) -{ - finalGradient_ = (double*)malloc(sizeof(double) * numVars_ * 1); - finalHessian_ = (double*)malloc(sizeof(double) * numVars_ * numVars_); - + bool minconNLP::get_nlp_info(Index& n, Index& m, Index& nnz_jac_g, Index& nnz_h_lag, IndexStyleEnum& index_style) + { + finalGradient_ = (double*)malloc(sizeof(double) * numVars_ * 1); + finalHessian_ = (double*)malloc(sizeof(double) * numVars_ * numVars_); + n=numVars_; // Number of variables m=numConstr_; // Number of constraints @@ -63,9 +63,9 @@ bool minconNLP::get_bounds_info(Index n, Number* x_l, Number* x_u, Index m, Numb } if(m==0) - { + { g_l=NULL; - g_u=NULL; + g_u=NULL; } else @@ -79,7 +79,7 @@ bool minconNLP::get_bounds_info(Index n, Number* x_l, Number* x_u, Index m, Numb g_u[c]=0; c++; } - + //bounds of non-linear equality constraints for(i=0;i= 0.0 ) + // sciprint("\nNote: There is no limit on time.\n"); + sciprint("\nNote: Time limit has been set to %lf.\n",time_limit); status=process_ret_val(sym_solve(global_sym_env));// Call function } else { -- cgit