summaryrefslogtreecommitdiff
path: root/sci_gateway
diff options
context:
space:
mode:
authorHarpreet2016-08-31 01:43:18 +0530
committerHarpreet2016-08-31 01:43:18 +0530
commit2269cb2d89c9e27b1edeb14849f201e90cbf89f7 (patch)
tree11aeb2a81fc9a0dcbe8aef079f4c4798a260b101 /sci_gateway
parent234aa4fb8bcf86c518444601903fcfee4c40f59a (diff)
downloadFOSSEE-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')
-rw-r--r--sci_gateway/cpp/LinCLP.hpp20
-rw-r--r--sci_gateway/cpp/Makelib.mak4
-rw-r--r--sci_gateway/cpp/QuadNLP.hpp8
-rwxr-xr-xsci_gateway/cpp/libFOSSEE_Optimization_Toolbox.sobin183588 -> 183459 bytes
-rw-r--r--sci_gateway/cpp/minbndNLP.hpp6
-rw-r--r--sci_gateway/cpp/minconNLP.hpp14
-rw-r--r--sci_gateway/cpp/minuncNLP.hpp7
-rw-r--r--sci_gateway/cpp/read_mps.cpp16
-rw-r--r--sci_gateway/cpp/sci_LinProg.cpp16
-rw-r--r--sci_gateway/cpp/sci_QuadNLP.cpp28
-rw-r--r--sci_gateway/cpp/sci_iofunc.cpp13
-rw-r--r--sci_gateway/cpp/sci_iofunc.hpp13
-rw-r--r--sci_gateway/cpp/sci_ipoptfminbnd.cpp7
-rw-r--r--sci_gateway/cpp/sci_ipoptfmincon.cpp13
-rw-r--r--sci_gateway/cpp/sci_ipoptfminunc.cpp7
-rw-r--r--sci_gateway/cpp/sci_minbndNLP.cpp23
-rw-r--r--sci_gateway/cpp/sci_minconNLP.cpp31
-rw-r--r--sci_gateway/cpp/sci_minuncNLP.cpp15
18 files changed, 123 insertions, 118 deletions
diff --git a/sci_gateway/cpp/LinCLP.hpp b/sci_gateway/cpp/LinCLP.hpp
index bd08505..42d9acc 100644
--- a/sci_gateway/cpp/LinCLP.hpp
+++ b/sci_gateway/cpp/LinCLP.hpp
@@ -1,13 +1,13 @@
-/*
- * Linear Solver Toolbox for Scilab using CLP library
- * Authors :
- Guru Pradeep Reddy
- Bhanu Priya Sayal
-
-* Optimizing (minimizing) the linear objective function having any number of
- variables and linear constraints(equality/inequality).
- *
-*/
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// 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: Guru Pradeep Reddy Bhanu Priya Sayal
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
#ifndef __LinCLP_HPP__
#define __LinCLP_HPP__
diff --git a/sci_gateway/cpp/Makelib.mak b/sci_gateway/cpp/Makelib.mak
index ebf94b1..03a0fe6 100644
--- a/sci_gateway/cpp/Makelib.mak
+++ b/sci_gateway/cpp/Makelib.mak
@@ -60,11 +60,11 @@ OTHERLIBS =
# ------------------------------------------------------
#CC =
# ------------------------------------------------------
-CFLAGS = $(CC_OPTIONS) -D__SCILAB_TOOLBOX__ -DFORDLL -D__USE_DEPRECATED_STACK_FUNCTIONS__ -w -I C:\Users\harpreet\Desktop\symphony-work\symphony\sci_gateway\cpp\ -I C:\Users\harpreet\Desktop\symphony-work\symphony\sci_gateway\cpp\\..\..\thirdparty\windows\include\coin
+CFLAGS = $(CC_OPTIONS) -D__SCILAB_TOOLBOX__ -DFORDLL -D__USE_DEPRECATED_STACK_FUNCTIONS__ -w -I C:\Users\FOSSEE\Desktop\build\FOSSEE-Optimization-Toolbox-src\sci_gateway\cpp\ -I C:\Users\FOSSEE\Desktop\build\FOSSEE-Optimization-Toolbox-src\sci_gateway\cpp\\..\..\thirdparty\windows\include\coin
# ------------------------------------------------------
FFLAGS = $(FC_OPTIONS) -DFORDLL
# ------------------------------------------------------
-EXTRA_LDFLAGS = C:\Users\harpreet\Desktop\symphony-work\symphony\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x64\libClp.lib C:\Users\harpreet\Desktop\symphony-work\symphony\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x64\libCgl.lib C:\Users\harpreet\Desktop\symphony-work\symphony\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x64\libOsi.lib C:\Users\harpreet\Desktop\symphony-work\symphony\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x64\libOsiClp.lib C:\Users\harpreet\Desktop\symphony-work\symphony\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x64\libCoinUtils.lib C:\Users\harpreet\Desktop\symphony-work\symphony\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x64\libSymphony.lib C:\Users\harpreet\Desktop\symphony-work\symphony\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x64\IpOptFSS.lib C:\Users\harpreet\Desktop\symphony-work\symphony\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x64\IpOpt-vc10.lib
+EXTRA_LDFLAGS = C:\Users\FOSSEE\Desktop\build\FOSSEE-Optimization-Toolbox-src\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x86\libClp.lib C:\Users\FOSSEE\Desktop\build\FOSSEE-Optimization-Toolbox-src\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x86\libCgl.lib C:\Users\FOSSEE\Desktop\build\FOSSEE-Optimization-Toolbox-src\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x86\libOsi.lib C:\Users\FOSSEE\Desktop\build\FOSSEE-Optimization-Toolbox-src\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x86\libOsiClp.lib C:\Users\FOSSEE\Desktop\build\FOSSEE-Optimization-Toolbox-src\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x86\libCoinUtils.lib C:\Users\FOSSEE\Desktop\build\FOSSEE-Optimization-Toolbox-src\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x86\libSymphony.lib C:\Users\FOSSEE\Desktop\build\FOSSEE-Optimization-Toolbox-src\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x86\IpOptFSS.lib C:\Users\FOSSEE\Desktop\build\FOSSEE-Optimization-Toolbox-src\sci_gateway\cpp\\..\..\thirdparty\windows\lib\x86\IpOpt-vc10.lib
# ------------------------------------------------------
!include $(SCIDIR)\modules\dynamic_link\src\scripts\Makedll.incl
# ------------------------------------------------------
diff --git a/sci_gateway/cpp/QuadNLP.hpp b/sci_gateway/cpp/QuadNLP.hpp
index 4e0da42..d7e7da4 100644
--- a/sci_gateway/cpp/QuadNLP.hpp
+++ b/sci_gateway/cpp/QuadNLP.hpp
@@ -106,16 +106,16 @@ class QuadNLP : public TNLP
const IpoptData* ip_data,
IpoptCalculatedQuantities* ip_cq);
- const double * getX(); //Returns a pointer to a matrix of size of 1*numVar
+ double * getX(); //Returns a pointer to a matrix of size of 1*numVar
// with final value for the primal variables.
- const double * getZu(); //Returns a pointer to a matrix of size of 1*numVars
+ double * getZu(); //Returns a pointer to a matrix of size of 1*numVars
// with final values for the upper bound multipliers
- const double * getZl(); //Returns a pointer to a matrix of size of 1*numVars
+ double * getZl(); //Returns a pointer to a matrix of size of 1*numVars
// with final values for the upper bound multipliers
- const double * getLambda(); //Returns a pointer to a matrix of size of 1*numConstr
+ double * getLambda(); //Returns a pointer to a matrix of size of 1*numConstr
// with final values for the constraint multipliers
diff --git a/sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.so b/sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.so
index 78cf4da..ff447af 100755
--- a/sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.so
+++ b/sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.so
Binary files differ
diff --git a/sci_gateway/cpp/minbndNLP.hpp b/sci_gateway/cpp/minbndNLP.hpp
index 684d905..5fa975a 100644
--- a/sci_gateway/cpp/minbndNLP.hpp
+++ b/sci_gateway/cpp/minbndNLP.hpp
@@ -1,13 +1,13 @@
// 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
#ifndef __minbndNLP_HPP__
diff --git a/sci_gateway/cpp/minconNLP.hpp b/sci_gateway/cpp/minconNLP.hpp
index b768ec5..8775019 100644
--- a/sci_gateway/cpp/minconNLP.hpp
+++ b/sci_gateway/cpp/minconNLP.hpp
@@ -1,14 +1,13 @@
// 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
#ifndef __minconNLP_HPP__
#define __minconNLP_HPP__
@@ -86,18 +85,15 @@ class minconNLP : public TNLP
int status_; //Solver return status
-
+ public:
minconNLP(const minconNLP&);
minconNLP& operator=(const minconNLP&);
- public:
-
/** user defined constructor */
minconNLP(Index nV, Index nC, Number *x0 ,Number *A, Number *b, Number* Aeq, Number *beq, Index Arows, Index Acols, Index brows, Index bcols, Index Aeqrows, Index Aeqcols, Index beqrows, Index beqcols, Number* LB, Number* UB, Number nlC, Number nlIC) : numVars_(nV), numConstr_(nC), varGuess_(x0), A_(A), b_(b), Aeq_(Aeq), beq_(beq), Arows_(Arows), Acols_(Acols), brows_(brows), bcols_(bcols), Aeqrows_(Aeqrows), Aeqcols_(Aeqcols), beqrows_(beqrows), beqcols_(beqcols), varLB_(LB), varUB_(UB), nonlinCon_(nlC), nonlinIneqCon_(nlIC), finalX_(0), finalZl_(0), finalZu_(0), finalGradient_(0), finalHessian_(0), finalObjVal_(1e20){ }
- /** default destructor */
virtual ~minconNLP();
-
+
/** Method to return some info about the nlp */
virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
Index& nnz_h_lag, IndexStyleEnum& index_style);
diff --git a/sci_gateway/cpp/minuncNLP.hpp b/sci_gateway/cpp/minuncNLP.hpp
index fba38f7..b34e81f 100644
--- a/sci_gateway/cpp/minuncNLP.hpp
+++ b/sci_gateway/cpp/minuncNLP.hpp
@@ -1,14 +1,13 @@
// 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
#ifndef __minuncNLP_HPP__
#define __minuncNLP_HPP__
diff --git a/sci_gateway/cpp/read_mps.cpp b/sci_gateway/cpp/read_mps.cpp
index 79a78c4..6add291 100644
--- a/sci_gateway/cpp/read_mps.cpp
+++ b/sci_gateway/cpp/read_mps.cpp
@@ -1,9 +1,13 @@
-/*
- * Linear Solver Toolbox for Scilab using CLP library
- * Authors :
- Guru Pradeep Reddy
- Bhanu Priya Sayal
-*/
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// 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: Guru Pradeep Reddy Bhanu Priya Sayal
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
#include "sci_iofunc.hpp"
#include "OsiClpSolverInterface.hpp"
diff --git a/sci_gateway/cpp/sci_LinProg.cpp b/sci_gateway/cpp/sci_LinProg.cpp
index 6be41cd..f0f35fe 100644
--- a/sci_gateway/cpp/sci_LinProg.cpp
+++ b/sci_gateway/cpp/sci_LinProg.cpp
@@ -1,9 +1,13 @@
-/*
- * Linear Solver Toolbox for Scilab using CLP library
- * Authors :
- Guru Pradeep Reddy
- Bhanu Priya Sayal
-*/
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// 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: Guru Pradeep Reddy Bhanu Priya Sayal
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
#include "sci_iofunc.hpp"
#include"OsiSolverInterface.hpp"
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_;
}
diff --git a/sci_gateway/cpp/sci_iofunc.cpp b/sci_gateway/cpp/sci_iofunc.cpp
index 978a017..8168743 100644
--- a/sci_gateway/cpp/sci_iofunc.cpp
+++ b/sci_gateway/cpp/sci_iofunc.cpp
@@ -1,6 +1,13 @@
-// Symphony Toolbox for Scilab
-// (Definition of) Functions for input and output from Scilab
-// By Keyur Joshi
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// 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: Harpreet Singh and Keyur Joshi
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
#include "api_scilab.h"
#include "Scierror.h"
diff --git a/sci_gateway/cpp/sci_iofunc.hpp b/sci_gateway/cpp/sci_iofunc.hpp
index 287002a..92f45fe 100644
--- a/sci_gateway/cpp/sci_iofunc.hpp
+++ b/sci_gateway/cpp/sci_iofunc.hpp
@@ -1,6 +1,13 @@
-// Symphony Toolbox for Scilab
-// (Declaration of) Functions for input and output from Scilab
-// By Keyur Joshi
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// 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: Harpreet Singh and Keyur Joshi
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
#ifndef SCI_IOFUNCHEADER
#define SCI_IOFUNCHEADER
diff --git a/sci_gateway/cpp/sci_ipoptfminbnd.cpp b/sci_gateway/cpp/sci_ipoptfminbnd.cpp
index b06c741..4755d82 100644
--- a/sci_gateway/cpp/sci_ipoptfminbnd.cpp
+++ b/sci_gateway/cpp/sci_ipoptfminbnd.cpp
@@ -1,14 +1,13 @@
// 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 "sci_iofunc.hpp"
#include "IpIpoptApplication.hpp"
diff --git a/sci_gateway/cpp/sci_ipoptfmincon.cpp b/sci_gateway/cpp/sci_ipoptfmincon.cpp
index 4f9ea71..51f1cce 100644
--- a/sci_gateway/cpp/sci_ipoptfmincon.cpp
+++ b/sci_gateway/cpp/sci_ipoptfmincon.cpp
@@ -1,14 +1,13 @@
// 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 "sci_iofunc.hpp"
#include "IpIpoptApplication.hpp"
@@ -22,9 +21,6 @@ extern "C"
#include <BOOL.h>
#include <localization.h>
#include <sciprint.h>
-#include <iostream>
-
-using namespace std;
int sci_solveminconp(char *fname)
{
@@ -155,7 +151,6 @@ int sci_solveminconp(char *fname)
// 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);
@@ -237,7 +232,7 @@ int sci_solveminconp(char *fname)
// As the SmartPtrs go out of scope, the reference count
// will be decremented and the objects will automatically
// be deleted.*/
-
+
return 0;
}
}
diff --git a/sci_gateway/cpp/sci_ipoptfminunc.cpp b/sci_gateway/cpp/sci_ipoptfminunc.cpp
index 1d74815..9f4c21f 100644
--- a/sci_gateway/cpp/sci_ipoptfminunc.cpp
+++ b/sci_gateway/cpp/sci_ipoptfminunc.cpp
@@ -1,13 +1,14 @@
// 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 "sci_iofunc.hpp"
diff --git a/sci_gateway/cpp/sci_minbndNLP.cpp b/sci_gateway/cpp/sci_minbndNLP.cpp
index 481a796..0fa7ef2 100644
--- a/sci_gateway/cpp/sci_minbndNLP.cpp
+++ b/sci_gateway/cpp/sci_minbndNLP.cpp
@@ -1,14 +1,13 @@
// 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 "minbndNLP.hpp"
#include "sci_iofunc.hpp"
@@ -28,9 +27,9 @@ using namespace Ipopt;
minbndNLP::~minbndNLP()
{
- free(finalX_);
- free(finalZu_);
- free(finalZl_);
+ if(finalX_) delete[] finalX_;
+ if(finalZl_) delete[] finalZl_;
+ if(finalZu_) delete[] finalZu_;
}
//get NLP info such as number of variables,constraints,no.of elements in jacobian and hessian to allocate memory
@@ -290,19 +289,19 @@ bool minbndNLP::eval_h(Index n, const Number* x, bool new_x,Number obj_factor, I
void minbndNLP::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];
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];
diff --git a/sci_gateway/cpp/sci_minuncNLP.cpp b/sci_gateway/cpp/sci_minuncNLP.cpp
index fe4c0e5..96fa0df 100644
--- a/sci_gateway/cpp/sci_minuncNLP.cpp
+++ b/sci_gateway/cpp/sci_minuncNLP.cpp
@@ -1,14 +1,13 @@
// 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 "minuncNLP.hpp"
#include "sci_iofunc.hpp"
@@ -29,9 +28,7 @@ using namespace Ipopt;
minuncNLP::~minuncNLP()
{
- free(finalX_);
- free(finalGradient_);
- free(finalHessian_);
+ if(finalX_) delete[] finalX_;
}
//get NLP info such as number of variables,constraints,no.of elements in jacobian and hessian to allocate memory
@@ -327,8 +324,8 @@ bool minuncNLP::eval_h(Index n, const Number* x, bool new_x,Number obj_factor, I
void minuncNLP::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];
}