diff options
author | Harpreet | 2016-08-31 01:43:18 +0530 |
---|---|---|
committer | Harpreet | 2016-08-31 01:43:18 +0530 |
commit | 2269cb2d89c9e27b1edeb14849f201e90cbf89f7 (patch) | |
tree | 11aeb2a81fc9a0dcbe8aef079f4c4798a260b101 /sci_gateway/cpp/sci_QuadNLP.cpp | |
parent | 234aa4fb8bcf86c518444601903fcfee4c40f59a (diff) | |
download | FOSSEE-Optimization-toolbox-2269cb2d89c9e27b1edeb14849f201e90cbf89f7.tar.gz FOSSEE-Optimization-toolbox-2269cb2d89c9e27b1edeb14849f201e90cbf89f7.tar.bz2 FOSSEE-Optimization-toolbox-2269cb2d89c9e27b1edeb14849f201e90cbf89f7.zip |
Windows 32 bit bug fixed and third party updated
Diffstat (limited to 'sci_gateway/cpp/sci_QuadNLP.cpp')
-rw-r--r-- | sci_gateway/cpp/sci_QuadNLP.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/sci_gateway/cpp/sci_QuadNLP.cpp b/sci_gateway/cpp/sci_QuadNLP.cpp index 8ec6f40..15c16be 100644 --- a/sci_gateway/cpp/sci_QuadNLP.cpp +++ b/sci_gateway/cpp/sci_QuadNLP.cpp @@ -28,15 +28,15 @@ extern "C"{ #include "IpoptConfig.h" #endif -double x_static,i, *op_obj_x = NULL,*op_obj_value = NULL; - using namespace Ipopt; QuadNLP::~QuadNLP() - { - free(finalX_); - free(finalZl_); - free(finalZu_);} +{ + 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 QuadNLP::get_nlp_info(Index& n, Index& m, Index& nnz_jac_g, Index& nnz_h_lag, IndexStyleEnum& index_style){ @@ -196,25 +196,25 @@ void QuadNLP::finalize_solution(SolverReturn status, const IpoptData* ip_data, IpoptCalculatedQuantities* ip_cq){ - finalX_ = (double*)malloc(sizeof(double) * numVars_ * 1); + finalX_ = new double[n]; for (Index i=0; i<n; i++) { finalX_[i] = x[i]; } - finalZl_ = (double*)malloc(sizeof(double) * numVars_ * 1); + finalZl_ = new double[n]; for (Index i=0; i<n; i++) { finalZl_[i] = z_L[i]; } - finalZu_ = (double*)malloc(sizeof(double) * numVars_ * 1); + finalZu_ = new double[n]; for (Index i=0; i<n; i++) { finalZu_[i] = z_U[i]; } - finalLambda_ = (double*)malloc(sizeof(double) * numConstr_ * 1); + finalLambda_ = new double[m]; for (Index i=0; i<m; i++) { finalLambda_[i] = lambda[i]; @@ -224,22 +224,22 @@ void QuadNLP::finalize_solution(SolverReturn status, status_ = status; } - const double * QuadNLP::getX() + double * QuadNLP::getX() { return finalX_; } - const double * QuadNLP::getZl() + double * QuadNLP::getZl() { return finalZl_; } - const double * QuadNLP::getZu() + double * QuadNLP::getZu() { return finalZu_; } - const double * QuadNLP::getLambda() + double * QuadNLP::getLambda() { return finalLambda_; } |