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_minconNLP.cpp | |
parent | 234aa4fb8bcf86c518444601903fcfee4c40f59a (diff) | |
download | symphony-2269cb2d89c9e27b1edeb14849f201e90cbf89f7.tar.gz symphony-2269cb2d89c9e27b1edeb14849f201e90cbf89f7.tar.bz2 symphony-2269cb2d89c9e27b1edeb14849f201e90cbf89f7.zip |
Windows 32 bit bug fixed and third party updated
Diffstat (limited to 'sci_gateway/cpp/sci_minconNLP.cpp')
-rw-r--r-- | sci_gateway/cpp/sci_minconNLP.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/sci_gateway/cpp/sci_minconNLP.cpp b/sci_gateway/cpp/sci_minconNLP.cpp index 71e6b53..ab15392 100644 --- a/sci_gateway/cpp/sci_minconNLP.cpp +++ b/sci_gateway/cpp/sci_minconNLP.cpp @@ -1,14 +1,13 @@ -// Copyright (C) 1815 - IIT Bombay - FOSSEE +// Copyright (C) 2015 - IIT Bombay - FOSSEE // -// Author: R.Vidyadhar & Vignesh Kannan -// Organization: FOSSEE, IIT Bombay -// Email: rvidhyadar@gmail.com & vignesh2496@gmail.com // This file must be used under the terms of the CeCILL. // This source file is licensed as described in the file COPYING, which // you should have received as part of this distribution. The terms // are also available at // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - +// Author: R.Vidyadhar & Vignesh Kannan +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in #include "minconNLP.hpp" #include "sci_iofunc.hpp" @@ -29,12 +28,10 @@ using namespace Ipopt; minconNLP::~minconNLP() { - free(finalX_); - free(finalGradient_); - free(finalHessian_); - free(finalZu_); - free(finalZl_); - free(finalLambda_); + 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 @@ -515,25 +512,25 @@ bool minconNLP::eval_h(Index n, const Number* x, bool new_x,Number obj_factor, I //returning the results void minconNLP::finalize_solution(SolverReturn status,Index n, const Number* x, const Number* z_L, const Number* z_U,Index m, const Number* g, const Number* lambda, Number obj_value,const IpoptData* ip_data,IpoptCalculatedQuantities* ip_cq) { - finalX_ = (double*)malloc(sizeof(double) * numVars_ * 1); - for (Index i=0; i<numVars_; i++) + 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]; |