From 2269cb2d89c9e27b1edeb14849f201e90cbf89f7 Mon Sep 17 00:00:00 2001 From: Harpreet Date: Wed, 31 Aug 2016 01:43:18 +0530 Subject: Windows 32 bit bug fixed and third party updated --- sci_gateway/cpp/LinCLP.hpp | 20 +++++++------- sci_gateway/cpp/Makelib.mak | 4 +-- sci_gateway/cpp/QuadNLP.hpp | 8 +++--- sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.so | Bin 183588 -> 183459 bytes sci_gateway/cpp/minbndNLP.hpp | 6 ++--- sci_gateway/cpp/minconNLP.hpp | 14 ++++------ sci_gateway/cpp/minuncNLP.hpp | 7 +++-- sci_gateway/cpp/read_mps.cpp | 16 ++++++----- sci_gateway/cpp/sci_LinProg.cpp | 16 ++++++----- sci_gateway/cpp/sci_QuadNLP.cpp | 28 +++++++++---------- sci_gateway/cpp/sci_iofunc.cpp | 13 ++++++--- sci_gateway/cpp/sci_iofunc.hpp | 13 ++++++--- sci_gateway/cpp/sci_ipoptfminbnd.cpp | 7 +++-- sci_gateway/cpp/sci_ipoptfmincon.cpp | 13 +++------ sci_gateway/cpp/sci_ipoptfminunc.cpp | 7 ++--- sci_gateway/cpp/sci_minbndNLP.cpp | 23 ++++++++-------- sci_gateway/cpp/sci_minconNLP.cpp | 31 ++++++++++------------ sci_gateway/cpp/sci_minuncNLP.cpp | 15 +++++------ 18 files changed, 123 insertions(+), 118 deletions(-) (limited to 'sci_gateway/cpp') 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 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/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 #include #include -#include - -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&)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