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 --- etc/FOSSEE_Optimization_Toolbox.start | 5 +- help/en_US/fmincon.xml | 4 +- help/en_US/fminimax.xml | 10 +- help/en_US/master_help.xml | 288 ++-- help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS | Bin 7632 -> 9489 bytes .../scilab_en_US_help/JavaHelpSearch/DOCS.TAB | 10 +- .../en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS | Bin 278 -> 362 bytes .../scilab_en_US_help/JavaHelpSearch/POSITIONS | Bin 44194 -> 60747 bytes help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA | 2 +- help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP | Bin 18432 -> 18432 bytes help/en_US/scilab_en_US_help/fgoalattain.html | 10 +- help/en_US/scilab_en_US_help/fminbnd.html | 6 +- help/en_US/scilab_en_US_help/fmincon.html | 10 +- help/en_US/scilab_en_US_help/fminimax.html | 16 +- help/en_US/scilab_en_US_help/fminunc.html | 6 +- help/en_US/scilab_en_US_help/index.html | 4 +- help/en_US/scilab_en_US_help/jhelpmap.jhm | 4 +- help/en_US/scilab_en_US_help/jhelptoc.xml | 4 +- help/en_US/scilab_en_US_help/linprog.html | 6 +- help/en_US/scilab_en_US_help/lsqlin.html | 6 +- help/en_US/scilab_en_US_help/lsqnonlin.html | 6 +- help/en_US/scilab_en_US_help/lsqnonneg.html | 6 +- help/en_US/scilab_en_US_help/qpipopt.html | 6 +- help/en_US/scilab_en_US_help/qpipoptmat.html | 6 +- .../section_031bbc67ce78762a40093bfdff4eaa3b.html | 358 +++++ .../section_2de38e189eb88e4cd1c78c8c7dee62fe.html | 285 ++++ .../section_316c7f5a42ba69316753082a567f2a1a.html | 285 ++++ .../section_31dab4715f0fe64415f49528ca3498bb.html | 285 ++++ .../section_33d4a5e121711ed9e58409f81a1bfe85.html | 358 +++++ .../section_3906586e7fe02c8c09617f7b5dce55cb.html | 358 +++++ .../section_40fbe48ff9e8d4b52071944f4b8cf947.html | 285 ++++ .../section_77ccf0809f74fd4d440a542ef18ef2ec.html | 358 +++++ .../section_792c22f5418bda4e6ac39553ab56cb9d.html | 358 +++++ .../section_79a16baf1a78e371ce44a155ba5e7737.html | 285 ++++ .../section_9d3ea7cdaaa8f0e19d7f4d2e68bb2ca6.html | 358 +++++ .../section_9eb7b65f35f3a8016fa9ca1117dafc99.html | 285 ++++ .../section_a74d6f4b13f6dde64de3fc3ca270e955.html | 358 +++++ .../section_b8aeecafdbffda60ffabf7dd0d73f023.html | 285 ++++ .../section_f1d257bd5e602360b522f16db37c4d79.html | 285 ++++ .../section_fe07f0c0dadf6c8d23d83e40a792f73e.html | 358 +++++ help/en_US/scilab_en_US_help/sym_addConstr.html | 10 +- help/en_US/scilab_en_US_help/sym_addVar.html | 6 +- help/en_US/scilab_en_US_help/sym_close.html | 6 +- .../en_US/scilab_en_US_help/sym_deleteConstrs.html | 6 +- help/en_US/scilab_en_US_help/sym_deleteVars.html | 6 +- .../scilab_en_US_help/sym_getConstrActivity.html | 6 +- .../scilab_en_US_help/sym_getConstrLower.html | 6 +- .../scilab_en_US_help/sym_getConstrRange.html | 6 +- .../scilab_en_US_help/sym_getConstrSense.html | 6 +- .../scilab_en_US_help/sym_getConstrUpper.html | 6 +- help/en_US/scilab_en_US_help/sym_getDblParam.html | 6 +- help/en_US/scilab_en_US_help/sym_getInfinity.html | 6 +- help/en_US/scilab_en_US_help/sym_getIntParam.html | 6 +- help/en_US/scilab_en_US_help/sym_getIterCount.html | 6 +- help/en_US/scilab_en_US_help/sym_getMatrix.html | 6 +- help/en_US/scilab_en_US_help/sym_getNumConstr.html | 6 +- .../scilab_en_US_help/sym_getNumElements.html | 6 +- help/en_US/scilab_en_US_help/sym_getNumVar.html | 6 +- help/en_US/scilab_en_US_help/sym_getObjCoeff.html | 6 +- help/en_US/scilab_en_US_help/sym_getObjSense.html | 6 +- help/en_US/scilab_en_US_help/sym_getObjVal.html | 6 +- .../scilab_en_US_help/sym_getPrimalBound.html | 6 +- help/en_US/scilab_en_US_help/sym_getRhs.html | 6 +- help/en_US/scilab_en_US_help/sym_getStatus.html | 6 +- help/en_US/scilab_en_US_help/sym_getStrParam.html | 6 +- help/en_US/scilab_en_US_help/sym_getVarLower.html | 6 +- help/en_US/scilab_en_US_help/sym_getVarSoln.html | 6 +- help/en_US/scilab_en_US_help/sym_getVarUpper.html | 6 +- help/en_US/scilab_en_US_help/sym_isAbandoned.html | 6 +- help/en_US/scilab_en_US_help/sym_isBinary.html | 6 +- help/en_US/scilab_en_US_help/sym_isContinuous.html | 6 +- help/en_US/scilab_en_US_help/sym_isEnvActive.html | 6 +- help/en_US/scilab_en_US_help/sym_isInfeasible.html | 6 +- help/en_US/scilab_en_US_help/sym_isInteger.html | 6 +- .../scilab_en_US_help/sym_isIterLimitReached.html | 6 +- help/en_US/scilab_en_US_help/sym_isOptimal.html | 6 +- .../scilab_en_US_help/sym_isTargetGapAchieved.html | 6 +- .../scilab_en_US_help/sym_isTimeLimitReached.html | 6 +- help/en_US/scilab_en_US_help/sym_loadMPS.html | 6 +- help/en_US/scilab_en_US_help/sym_loadProblem.html | 6 +- .../scilab_en_US_help/sym_loadProblemBasic.html | 6 +- help/en_US/scilab_en_US_help/sym_open.html | 6 +- help/en_US/scilab_en_US_help/sym_resetParams.html | 6 +- .../scilab_en_US_help/sym_setConstrLower.html | 6 +- .../en_US/scilab_en_US_help/sym_setConstrType.html | 6 +- .../scilab_en_US_help/sym_setConstrUpper.html | 6 +- .../en_US/scilab_en_US_help/sym_setContinuous.html | 6 +- help/en_US/scilab_en_US_help/sym_setDblParam.html | 6 +- help/en_US/scilab_en_US_help/sym_setIntParam.html | 6 +- help/en_US/scilab_en_US_help/sym_setInteger.html | 6 +- help/en_US/scilab_en_US_help/sym_setObjCoeff.html | 6 +- help/en_US/scilab_en_US_help/sym_setObjSense.html | 6 +- .../scilab_en_US_help/sym_setPrimalBound.html | 6 +- help/en_US/scilab_en_US_help/sym_setStrParam.html | 6 +- help/en_US/scilab_en_US_help/sym_setVarLower.html | 6 +- help/en_US/scilab_en_US_help/sym_setVarSoln.html | 6 +- help/en_US/scilab_en_US_help/sym_setVarUpper.html | 6 +- help/en_US/scilab_en_US_help/sym_solve.html | 6 +- help/en_US/scilab_en_US_help/symphony.html | 6 +- help/en_US/scilab_en_US_help/symphonymat.html | 10 +- jar/scilab_en_US_help.jar | Bin 249349 -> 287985 bytes macros/Checkdims.bin | Bin 8188 -> 8188 bytes macros/Checklhs.bin | Bin 10312 -> 10312 bytes macros/Checkrhs.bin | Bin 12852 -> 12852 bytes macros/Checktype.bin | Bin 9156 -> 9156 bytes macros/Checkvector.bin | Bin 9696 -> 9696 bytes macros/fgoalattain.bin | Bin 76660 -> 76660 bytes macros/fminbnd.bin | Bin 64156 -> 64156 bytes macros/fmincon.bin | Bin 156076 -> 156144 bytes macros/fmincon.sci | 4 +- macros/fminimax.bin | Bin 86512 -> 86532 bytes macros/fminimax.sci | 10 +- macros/fminunc.bin | Bin 69644 -> 69644 bytes macros/lib | Bin 912 -> 996 bytes macros/linprog.bin | Bin 30012 -> 30012 bytes macros/lsqlin.bin | Bin 64528 -> 64528 bytes macros/lsqnonneg.bin | Bin 33808 -> 33808 bytes macros/matrix_linprog.bin | Bin 30584 -> 30584 bytes macros/mps_linprog.bin | Bin 10064 -> 10064 bytes macros/names | 1 - macros/qpipopt.bin | Bin 63432 -> 63432 bytes macros/qpipoptmat.bin | Bin 65684 -> 65684 bytes macros/setOptions.bin | Bin 3040 -> 3040 bytes macros/symphony_call.bin | Bin 4580 -> 4580 bytes 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 +- thirdparty/linux/lib/x64/libcoinblas.so.1.4.4 | Bin 163772 -> 163744 bytes thirdparty/linux/lib/x64/libcoinlapack.so.1.5.4 | Bin 583015 -> 583015 bytes thirdparty/linux/lib/x64/libcoinmumps.so.1.5.4 | Bin 1639965 -> 1639895 bytes thirdparty/linux/lib/x64/libipopt.so.1.10.4 | Bin 2568699 -> 2568699 bytes thirdparty/linux/lib/x86/libcoinblas.so.1.4.4 | Bin 108160 -> 104253 bytes thirdparty/linux/lib/x86/libcoinlapack.so.1.5.4 | Bin 541747 -> 517318 bytes thirdparty/linux/lib/x86/libcoinmumps.so.1.5.4 | Bin 1620183 -> 1569698 bytes thirdparty/linux/lib/x86/libipopt.so.1 | 2 +- thirdparty/linux/lib/x86/libipopt.so.1.10.5 | Bin 0 -> 2473947 bytes thirdparty/windows/bin/x64/IpOpt-vc10.dll | Bin 0 -> 2078720 bytes thirdparty/windows/bin/x64/IpOptFSS.dll | Bin 0 -> 8349696 bytes thirdparty/windows/bin/x64/Ipopt-vc8.dll | Bin 0 -> 2774528 bytes thirdparty/windows/bin/x86/IpOpt-vc10.dll | Bin 0 -> 1674752 bytes thirdparty/windows/bin/x86/IpOptFSS.dll | Bin 0 -> 5062656 bytes thirdparty/windows/bin/x86/Ipopt-vc8.dll | Bin 0 -> 1622016 bytes thirdparty/windows/include/coin/IpAlgTypes.hpp | 129 +- .../windows/include/coin/IpCachedResults.hpp | 1560 ++++++++++---------- thirdparty/windows/include/coin/IpDebug.hpp | 292 ++-- thirdparty/windows/include/coin/IpException.hpp | 294 ++-- .../windows/include/coin/IpIpoptApplication.hpp | 483 +++--- .../include/coin/IpIpoptCalculatedQuantities.hpp | 1493 +++++++++---------- thirdparty/windows/include/coin/IpJournalist.hpp | 984 ++++++------ thirdparty/windows/include/coin/IpMatrix.hpp | 686 ++++----- thirdparty/windows/include/coin/IpNLP.hpp | 486 +++--- thirdparty/windows/include/coin/IpObserver.hpp | 724 ++++----- thirdparty/windows/include/coin/IpOptionsList.hpp | 578 ++++---- thirdparty/windows/include/coin/IpReferenced.hpp | 507 +++---- thirdparty/windows/include/coin/IpRegOptions.hpp | 1309 ++++++++-------- thirdparty/windows/include/coin/IpReturnCodes.h | 36 +- thirdparty/windows/include/coin/IpReturnCodes.hpp | 42 +- thirdparty/windows/include/coin/IpReturnCodes.inc | 140 +- .../windows/include/coin/IpReturnCodes_inc.h | 92 +- thirdparty/windows/include/coin/IpSmartPtr.hpp | 1404 +++++++++--------- .../windows/include/coin/IpSolveStatistics.hpp | 286 ++-- thirdparty/windows/include/coin/IpStdCInterface.h | 506 ++++--- thirdparty/windows/include/coin/IpSymMatrix.hpp | 321 ++-- thirdparty/windows/include/coin/IpTNLP.hpp | 580 ++++---- thirdparty/windows/include/coin/IpTNLPReducer.hpp | 360 ++--- thirdparty/windows/include/coin/IpTaggedObject.hpp | 308 ++-- thirdparty/windows/include/coin/IpTimedTask.hpp | 260 ++-- thirdparty/windows/include/coin/IpUtils.hpp | 253 ++-- thirdparty/windows/include/coin/IpVector.hpp | 1511 +++++++++---------- thirdparty/windows/include/coin/IpoptConfig.h | 147 +- thirdparty/windows/include/coin/config_ipopt.h | 224 +-- .../windows/include/coin/config_ipopt_default.h | 17 + 187 files changed, 13684 insertions(+), 8513 deletions(-) create mode 100644 help/en_US/scilab_en_US_help/section_031bbc67ce78762a40093bfdff4eaa3b.html create mode 100644 help/en_US/scilab_en_US_help/section_2de38e189eb88e4cd1c78c8c7dee62fe.html create mode 100644 help/en_US/scilab_en_US_help/section_316c7f5a42ba69316753082a567f2a1a.html create mode 100644 help/en_US/scilab_en_US_help/section_31dab4715f0fe64415f49528ca3498bb.html create mode 100644 help/en_US/scilab_en_US_help/section_33d4a5e121711ed9e58409f81a1bfe85.html create mode 100644 help/en_US/scilab_en_US_help/section_3906586e7fe02c8c09617f7b5dce55cb.html create mode 100644 help/en_US/scilab_en_US_help/section_40fbe48ff9e8d4b52071944f4b8cf947.html create mode 100644 help/en_US/scilab_en_US_help/section_77ccf0809f74fd4d440a542ef18ef2ec.html create mode 100644 help/en_US/scilab_en_US_help/section_792c22f5418bda4e6ac39553ab56cb9d.html create mode 100644 help/en_US/scilab_en_US_help/section_79a16baf1a78e371ce44a155ba5e7737.html create mode 100644 help/en_US/scilab_en_US_help/section_9d3ea7cdaaa8f0e19d7f4d2e68bb2ca6.html create mode 100644 help/en_US/scilab_en_US_help/section_9eb7b65f35f3a8016fa9ca1117dafc99.html create mode 100644 help/en_US/scilab_en_US_help/section_a74d6f4b13f6dde64de3fc3ca270e955.html create mode 100644 help/en_US/scilab_en_US_help/section_b8aeecafdbffda60ffabf7dd0d73f023.html create mode 100644 help/en_US/scilab_en_US_help/section_f1d257bd5e602360b522f16db37c4d79.html create mode 100644 help/en_US/scilab_en_US_help/section_fe07f0c0dadf6c8d23d83e40a792f73e.html create mode 100755 thirdparty/linux/lib/x86/libipopt.so.1.10.5 create mode 100644 thirdparty/windows/bin/x64/IpOpt-vc10.dll create mode 100644 thirdparty/windows/bin/x64/IpOptFSS.dll create mode 100644 thirdparty/windows/bin/x64/Ipopt-vc8.dll create mode 100644 thirdparty/windows/bin/x86/IpOpt-vc10.dll create mode 100644 thirdparty/windows/bin/x86/IpOptFSS.dll create mode 100644 thirdparty/windows/bin/x86/Ipopt-vc8.dll create mode 100644 thirdparty/windows/include/coin/config_ipopt_default.h diff --git a/etc/FOSSEE_Optimization_Toolbox.start b/etc/FOSSEE_Optimization_Toolbox.start index 5ab588a..799e815 100644 --- a/etc/FOSSEE_Optimization_Toolbox.start +++ b/etc/FOSSEE_Optimization_Toolbox.start @@ -11,6 +11,9 @@ mprintf("Start FOSSEE Optimization Toolbox\n"); +[a, opt] = getversion(); +Version = opt(2); + etc_tlbx = get_absolute_file_path("FOSSEE_Optimization_Toolbox.start"); etc_tlbx = getshortpathname(etc_tlbx); root_tlbx = strncpy( etc_tlbx, length(etc_tlbx)-length("\etc\") ); @@ -30,7 +33,7 @@ mprintf("\tLoad gateways\n"); Version = opt(2); ilib_verbose(0); if getos()=="Windows" then - lib_path = root_tlbx + "/thirdparty/windows/lib/" + Version; + lib_path = root_tlbx + "/thirdparty/windows/bin/" + Version; link(lib_path+filesep()+"IpOptFSS.dll"); link(lib_path+filesep()+"IpOpt-vc10.dll"); else diff --git a/help/en_US/fmincon.xml b/help/en_US/fmincon.xml index a6bef9f..91569a2 100644 --- a/help/en_US/fmincon.xml +++ b/help/en_US/fmincon.xml @@ -315,7 +315,9 @@ y= [x(2),x(1)+x(3),x(2)]; endfunction //Hessian of the Lagrange Function function y= lHess(x,obj,lambda) -y= obj*[0,1,0;1,0,1;0,1,0] + lambda(1)*[2,0,0;0,0,0;0,0,0] + lambda(2)*[2,0,0;0,2,0;0,0,0] +lambda(3)*[0,0,0;0,0,0;0,0,2] + lambda(4)*[6*x(1 ),0,0;0,0,0;0,0,0] + lambda(5)*[0,0,0;0,2,0;0,0,2]; +y= obj*[0,1,0;1,0,1;0,1,0] + lambda(1)*[2,0,0;0,0,0;0,0,0] + .. +lambda(2)*[2,0,0;0,2,0;0,0,0] +lambda(3)*[0,0,0;0,0,0;0,0,2] + .. +lambda(4)*[6*x(1),0,0;0,0,0;0,0,0] + lambda(5)*[0,0,0;0,2,0;0,0,2]; endfunction //Gradient of Non-Linear Constraints function [cg,ceqg] = cGrad(x) diff --git a/help/en_US/fminimax.xml b/help/en_US/fminimax.xml index efe4812..e733a3d 100644 --- a/help/en_US/fminimax.xml +++ b/help/en_US/fminimax.xml @@ -30,11 +30,11 @@ xopt = fminimax(fun,x0,A,b,Aeq,beq,lb,ub) xopt = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfun) xopt = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfun,options) - [xopt, fval] = fmincon(.....) - [xopt, fval, maxfval]= fmincon(.....) - [xopt, fval, maxfval, exitflag]= fmincon(.....) - [xopt, fval, maxfval, exitflag, output]= fmincon(.....) - [xopt, fval, maxfval, exitflag, output, lambda]= fmincon(.....) + [xopt, fval] = fminimax(.....) + [xopt, fval, maxfval]= fminimax(.....) + [xopt, fval, maxfval, exitflag]= fminimax(.....) + [xopt, fval, maxfval, exitflag, output]= fminimax(.....) + [xopt, fval, maxfval, exitflag, output, lambda]= fminimax(.....) diff --git a/help/en_US/master_help.xml b/help/en_US/master_help.xml index 48de693..9ee0e95 100644 --- a/help/en_US/master_help.xml +++ b/help/en_US/master_help.xml @@ -1,77 +1,77 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]> FOSSEE Optimization Toolbox - + FOSSEE Optimization Toolbox -&a745e19a6383796e6f5680cdcc44cfcce; -&a2b24cb19de46f878f11e6be9eb411170; -&a52664d077cac340a0384efe1ac107088; -&a0184dce5b9269d9795f0858d46c1c6f0; -&a14f1077f437dbe35eb1cac51fed7a9fc; -&aa809ed678033fc05c9b60a71de55b2ce; -&a3d4ec65684b561d91f7a255acd23f51c; -&aa63ebf0c6a638d0a3a932f61b6b4cc92; -&aa4a031935f5eed6cfc8fc4a49823b00b; -&a6b85f6e0c98751f20b68663a23cb4cd2; -&a8549a3935858ed104f4749ca2243456a; -&aca972f273143ecb39f56b42e4723ac67; -&a9910ada35b57b0581e8a77d145abac4a; - +&a92eced2aa34d57e217f07f2fabc26015; +&af80e0067cc98fa7c43cd2eba2f35c3ed; +&a509a9124674982a1290c749742e9e967; +&ac53013fb2994321eb9111fe3659619da; +&a39dbc3631556ef691d9c72fa40eedb23; +&a026dada486834a1daad95c67e01b47c8; +&a2c9be5aa4d1584f00755b3f1e2646be0; +&a34c8973744bf6bb1d379121abf614ab1; +&a91da8531563ac42d888f1a374eb06bcf; +&a04ba8859261000cce094f4c6a2a7debb; +&acb9324f64e9a65fb87ce330b5f7adfac; +&a7b01b92c2c653f07ac6e8fc0c1ec3fa9; +&a91dadea5918828de94a4845c2ad3cbe5; + Symphony Native Functions -&acc223314e8a8bc290a13618df33a6237; -&a5e032b3334f53385f0ce250f0d5c18f2; -&a11ac5af5f92741f96e56398fe6113c1a; -&a54f913b8b4e581654c3f9d37a7f0353a; -&aa30f7f7c36bd510b4f02727f52f4a3ce; -&a1f3452caf3162b6385df305f81346e5b; -&a3b149fd278245d4b3a24e4517225c98b; -&a6e5609fb4e5eebcf24b457f44e0fdae3; -&aa893b53c826a7def860105c158f070f8; -&a06bad82642d672e569c4b95454548dc4; -&aa5d59eb05be10280b50c527e88194603; -&a65cdfe78fc72edc8c5a47ad2bfe65892; -&a26a6886e109925cf0cc77c6cc7cc5bbb; -&aecee265206afdf2b5baf3e6f0ce05b2a; -&a559f913f0e9f21d38c9c27a33a9953ae; -&a3e540ecd4a9a3e666b31579fa5662aba; -&adb9eed3182459e3dce170977880cc253; -&a6ce3ca192828a09725815663579482db; -&a338f3184d5c61f0f7de92b171be041d1; -&af15d4928d3cbab7d87e64eb2b52a1496; -&a5cacaf92073795f5fd6c7cb6084c4015; -&a2aee40916b0f8c5631a8808aaf9da74e; -&a89689c9684bb1222009a56e0ee157ad4; -&a7fea9b7273bacb6e59272590a9ef8690; -&a14f8d21effef06b5b04029cc11d54b55; -&a46ee22cafdff1a8bcf08c9fd522ab5b8; -&aca3cb89179616e3be06b228b87f32ddb; -&ad6f09bc2a57af9aa5a557497c6bddbc3; -&a7cf13c8ec3cbc1862da713ab233e0f2a; -&a6a1928ddadf9dbd1f71b463c55ae9a7c; -&a8db20054b5db402260af3fc2bbcbbc02; -&aa495e78c64e2a62b8cfceb6d3e0dd306; -&a8b17974e4691a1119aa9189d5d21af50; -&abf0fa3e575e638636e94ae387f7f4465; -&a68289eac582fd1515c510bd447640fea; -&a3e4b8cb708b6af8648f58c658c54a466; -&a0c555f679ba4b9b3f0c128fba8c97784; -&a149fad015c8f9764fb817f2f32b6433a; -&a58e4ad13d7f92aa2106f346e6f667cef; -&a6d3922ed2f332c444391d0b3bfe149a5; -&ac0309772a676ae0f19c4906587629055; -&af1c8a28c8b6a57e72bfadc71f30e391b; -&a6c72196376a25e3ad51c8918e6ac00be; -&a9c990f2279c1b39e9ff9161319700972; -&a8e7ffd33fb83a6c6438da917911f5378; -&ae35adb60ff83c89fc44b30fda7c87af4; -&a10ea3c81046dff7b2c8ae794f470c7b9; -&af90e3534d92ac40286440b627aee484b; -&a5fa728194634dbc83868f69db2dcb00b; -&ac00d47c17e27b147886626cb5a5b9b21; -&a495915b72119ba0fbfa1a3574c89a579; -&af551a253e20452196acaf8e4f8097d1e; -&a69dcdf35892e94bf931551457037cf7c; -&a1bf9d00f2bdb2ccf20bb88fd425ae817; -&af2559ac6a3ee305a9d34197886b7d9f1; -&a69ab58762cd50faa3908e15b52605000; -&a33e3ef3ff532c54b58f3ed5c2c0b3154; -&ad6943c0d89d69c96ade13f4b338e5ed8; +&a299b635b31e2db70864d304bb5bceaec; +&a3c37159c7ab704bd66abf5648f295468; +&a085eae9f22effcadae84f3a0e8e2fc75; +&a570e4c44a691678f230892fe02ca2b51; +&acae11d784b796c42c7af62d71d03bf57; +&a7e224d80b9ac6726352e5230a0908db9; +&a088faceaed3d1bc6a75143bd16aae9e8; +&a29b8c6fa5ef0455b5cd6c096ab02394e; +&ac65519a5c3a12f415702f36d56c06b7a; +&aee04edd2012fe6b8befe0f131481652b; +&a2c9633d776f1ad4163beb33f0641d12a; +&a94736872415541e800b4cac737552cd1; +&a1bc19dc158a31636a939b2432c8a756b; +&ac2e23ef5f086c6453ecabe7a751b54c2; +&abcd5cea99a5a2d7dcf083cf71cadcdc2; +&a8971ebf56653b9c834f7fddb337fcf5f; +&a6fe61e93e31da551b2f5b4de11f1de76; +&a101e2ec4202f07d6e865a0e3dacec8ff; +&a601c04c4055b06419e9053e32fa7d634; +&a0ff380cbe9c313ce15abf3d4d7e936d6; +&a3372a734bcc94354b2828efc1d6a656b; +&aa598e28250e5b02ca42d75d425f4cb1d; +&aeed0c1022d63f46f70b51de305af7216; +&a8a0b36f0d54c5eb6a72c1faf3c83a337; +&abcffa91be0617e9225553ba3bff73bc9; +&a803047e8a099a6922fd3f8ad3465cc20; +&acc519135c27808c7384b63a5d02ce151; +&acec448eb5171fee866bad26b90c4d940; +&aace91ff92c71938d3a078c25f14bcd12; +&a08fa5121c2a1da6a3403c685a4440045; +&afc88c6731d2a13689d0386323dabaf1f; +&abbd5e696c29a743c5e8b2919850023d9; +&ad42100b84e76d682d84f78e47074ce8f; +&a207bfa75b9fecbe13ee7c72de67d3e84; +&a2b8e2f18c416c9b940d0727b56280a64; +&a903f3bd7f43b818c64c93de95f4a77d4; +&ac92a4e41e3a85aea1ebd7d34b93847cd; +&ac7f125c90e7b2a8ef81f2146a8412b86; +&a8ea073f61c1f35277fca99adeb5ddfdd; +&a4080158aa253bb7f481329789c4694bf; +&ae70309215de55c8b5303ddac915e748b; +&afe518887e8a4b614af0c4f083853c3d9; +&ac0da615fcbc12006669e51203f21e0ca; +&a84c5e30ad3344cd01bcc8a2defcc9302; +&a3c1fb2ff727602439f279a49ab2c4f93; +&af30ba120252b44132a7e6f980d278e35; +&a74de3ec262039e36129db2247cd5a95c; +&a02950dff19641d3ab4775804986a2082; +&a26995f0438c2be3d6825d7bc87dca338; +&a07ff0bb9910cdd63e5f08fb85234a363; +&a6093e215e37e9307c9d0bc568c56192e; +&aec62fa64d07444036a1bc13d175cad3c; +&a5432a14d8d225d4a5ceb66505cc3787e; +&a67afd21ee0b9a70b1b895139c2f14be1; +&aa1119c9d7197ec0756f502283db9ede4; +&ab3460c49b7e2246f67cfecc58c0c2549; +&a4cc74dec0f5c92cbe95dfb00f3add455; +&a96423c1495815ea0b826925862c2d698; diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS index 236a815..b43f2ae 100644 Binary files a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS and b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS differ diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB index 2133bb0..35ed0b4 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB @@ -1,4 +1,6 @@ -eџџџџџџџџџџџџuџџџџџ§зџџџџї_џџџйџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџі_uџџџџџі_џї_џнџџџџџџџџџџџџџџџџйџџџџџџнџџџџџџџџџџџџџџџџџџџџџџнџџџџџџџџџйџџџџнџџџџ§—ѓд“FФ}з4ŸЬ%зџuџџџ4`GЦ„џџџџџџџџџџ§—џџџџџџџџџџі\вЬ-ѓK_џџџџџџџџџџџџџџџџџџив—џџџџџџџџџй4ЕџџѓIмбБD Ќ* Ј* рЈРи* 0И6 -Nƒ~ЂXърЌ3; ƒbO rЯ  Њƒ Ќ1 -Х№нƒ!qтХа1 в‹ ТТС`Ь"Ž ТжЫ:‰iŽŠ00‚ƒ‡K ‚aЈH`_й1 Ъ B* Р*0Hw š<1 ХK Ў8ЁaЈ2 -ЈXj•ЉDџ<ЉDЦЁ1“Ša1ЈТЦЊЈOџџѓ‡Фџ,СФ&ЦќТџ4gё3Ц…†E ѓЫџќ0Ь,hO‹0Пџџџџџџџџџџџџџџџџџџџџџџџџџ0ПџџџџЬ/џџџџџџџџџџџџџџџќвџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџЭ/џџџџЭ/џџџџџџџџџџџ4Пџџџџџџџџџџџџ4Пџџ4`Oў‹5ёŸ4]?МeХw_*(ТЁ‘#)б“Ѓ AЦъЦ!œR$RЁЕЉЦЦsˆџѓђeџџёјЅчЁœOЬ0Г џЧЫЬ,ђёRЦџњйv••ЉZ_к]ЊЊЈТЅiYYY—iкЊЅjе”ZRŽWLbЃЊЋЉJ0Њ1ДъŠ0ЈќЁ‘(шЊЊЈСMєdЊЊЊЈdWa<ШПЬ,ТќТќТЭ/0Г*ЊЊЂЬКdыЂЬ/ќШПџџџ0ПџќТџ3/ЬК/ѓ8МЪЊ‹џќвѓ(ПЬ/џџЬ/џЬ/џџЬ‹џџ2,ЪЊЊЊЊЊЊЈГ(Пџѓ ќТџџџѓ џџџџџџџџџџџџі \ No newline at end of file +eџџџџџџџџџџџџuџuџџџџї_џџџџџџџџџнџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ§—џџџџџџџџџџџџџџџџџџџџџџџuuџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџeнџџџ§зџќТџџџџџѓIџџ0Ÿџџџџџџџі]езї_Э'џџџ<Ÿ8Ÿџџџџџ}FDзџќтЦE _џџџџџџџџџџџџџџџџџџџџџџџЯ'џџџџџі_џџЭ'џџџќтv_џsЩџЯ'§—Чwѕџџџџџџџџџ_џџu9€ G8Dj„FХЦ…Xt\oГ"M ƒ†4.У†Ц 8l*ТъЁ;-je%Э +У‘p˜t9 J *s‚K ƒpЅƒ€ˆt€рH) I4%ХV Ф(ƒ, Р,pШ,ЩqŸ†|Xx9 +EЁ—Pд,$RУpЇЦ}…аg RёТsIУ@Ђџ0р)џ д, Ÿ + pа)џ`Р*_`а)йeџѓ‰ќ_ Тqв +—„ЭŠ1ŠЂЈє,ф(з*Œ*ЊЊ0Ѓ2ЈbƒЃŠ<Њ0Ѓ(2 +„Ѓ№ЦџtЛйjъПыџяџќ/ ~юЊМ/ (/У Ћъџ№ПУ dйqЫO†q]зrJЊЊЊЊЉ’Њhd[JЊ*ЃpR*ЊЁСHbЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЎЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊЊъЊЊЊЊdЊЊЊЊЊЊЊЊЊЊЊКЊЊЊЊЊЊЊЊЊЊЊЊКЊЊ†E*КЪ0ЁЪЂќк,ЪЊ…ЦattЊ~LbвЊЊ™*Š4ЈЪ(вЮ[/ЮЊЎЄЫ0П2ъ†(LЩтЬ/ЬЊЊЊ,Ъ,СЁHМЪЊЇЊИГY"ЭЫ0dOЬЊЫ0МШГ ќвџѓ 3ЎЊЈГ*,ЪЊЊЊКЂЬЊЊЊ/ѓ ќТџџџќТќТџџџџќЪЊЊЈГ џџџџџџџЬ/џџќЪ/џџџџџџџџџџџџџі \ No newline at end of file diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS b/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS index 8728452..ba26c01 100644 Binary files a/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS and b/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS differ diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS b/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS index bfc07ce..cd3a00e 100644 Binary files a/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS and b/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS differ diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA b/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA index d34e905..51ab351 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA @@ -1,2 +1,2 @@ JavaSearch 1.0 -TMAP bs=2048 rt=1 fl=-1 id1=1523 id2=1 +TMAP bs=2048 rt=1 fl=-1 id1=1539 id2=1 diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP b/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP index 882bad7..cc3bed1 100644 Binary files a/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP and b/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP differ diff --git a/help/en_US/scilab_en_US_help/fgoalattain.html b/help/en_US/scilab_en_US_help/fgoalattain.html index 2981e47..6f9a43a 100644 --- a/help/en_US/scilab_en_US_help/fgoalattain.html +++ b/help/en_US/scilab_en_US_help/fgoalattain.html @@ -12,11 +12,11 @@
- << FOSSEE Optimization Toolbox + << FOSSEE Optimization Toolbox - FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fgoalattain + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fgoalattain

fgoalattain

@@ -169,11 +169,11 @@ It has type "struct" and contains the following fields.
Report an issue
- << FOSSEE Optimization Toolbox + << FOSSEE Optimization Toolbox - FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox diff --git a/help/en_US/scilab_en_US_help/fminbnd.html b/help/en_US/scilab_en_US_help/fminbnd.html index 4ac4a98..d60efaa 100644 --- a/help/en_US/scilab_en_US_help/fminbnd.html +++ b/help/en_US/scilab_en_US_help/fminbnd.html @@ -16,7 +16,7 @@ - FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fminbnd + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fminbnd

fminbnd

@@ -163,7 +163,7 @@ It has type "struct" and contains the following fields.
- FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox diff --git a/help/en_US/scilab_en_US_help/fmincon.html b/help/en_US/scilab_en_US_help/fmincon.html index 5d4a558..5dc1d2b 100644 --- a/help/en_US/scilab_en_US_help/fmincon.html +++ b/help/en_US/scilab_en_US_help/fmincon.html @@ -16,7 +16,7 @@ - FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fmincon + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fmincon

fmincon

@@ -267,7 +267,9 @@ It has type "struct" and contains the following fields. endfunction //Hessian of the Lagrange Function function y=lHess(x, obj, lambda) -y= obj*[0,1,0;1,0,1;0,1,0] + lambda(1)*[2,0,0;0,0,0;0,0,0] + lambda(2)*[2,0,0;0,2,0;0,0,0] +lambda(3)*[0,0,0;0,0,0;0,0,2] + lambda(4)*[6*x(1 ),0,0;0,0,0;0,0,0] + lambda(5)*[0,0,0;0,2,0;0,0,2]; +y= obj*[0,1,0;1,0,1;0,1,0] + lambda(1)*[2,0,0;0,0,0;0,0,0] + .. +lambda(2)*[2,0,0;0,2,0;0,0,0] +lambda(3)*[0,0,0;0,0,0;0,0,2] + .. +lambda(4)*[6*x(1),0,0;0,0,0;0,0,0] + lambda(5)*[0,0,0;0,2,0;0,0,2]; endfunction //Gradient of Non-Linear Constraints function [cg, ceqg]=cGrad(x) @@ -293,7 +295,7 @@ It has type "struct" and contains the following fields.
- FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox diff --git a/help/en_US/scilab_en_US_help/fminimax.html b/help/en_US/scilab_en_US_help/fminimax.html index a701aa7..22b6ad9 100644 --- a/help/en_US/scilab_en_US_help/fminimax.html +++ b/help/en_US/scilab_en_US_help/fminimax.html @@ -16,7 +16,7 @@ - FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fminimax + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fminimax

fminimax

@@ -43,11 +43,11 @@ xopt = fminimax(fun,x0,A,b,Aeq,beq,lb,ub) xopt = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfun) xopt = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfun,options) -[xopt, fval] = fmincon(.....) -[xopt, fval, maxfval]= fmincon(.....) -[xopt, fval, maxfval, exitflag]= fmincon(.....) -[xopt, fval, maxfval, exitflag, output]= fmincon(.....) -[xopt, fval, maxfval, exitflag, output, lambda]= fmincon(.....)
+[xopt, fval] = fminimax(.....) +[xopt, fval, maxfval]= fminimax(.....) +[xopt, fval, maxfval, exitflag]= fminimax(.....) +[xopt, fval, maxfval, exitflag, output]= fminimax(.....) +[xopt, fval, maxfval, exitflag, output, lambda]= fminimax(.....)

Parameters

fun: @@ -223,7 +223,7 @@ It has type "struct" and contains the following fields.
- FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox diff --git a/help/en_US/scilab_en_US_help/fminunc.html b/help/en_US/scilab_en_US_help/fminunc.html index e6ec051..d5f0786 100644 --- a/help/en_US/scilab_en_US_help/fminunc.html +++ b/help/en_US/scilab_en_US_help/fminunc.html @@ -16,7 +16,7 @@ - FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fminunc + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fminunc

fminunc

@@ -167,7 +167,7 @@ It has type "struct" and contains the following fields.
- FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox diff --git a/help/en_US/scilab_en_US_help/index.html b/help/en_US/scilab_en_US_help/index.html index d257dff..59a4ed9 100644 --- a/help/en_US/scilab_en_US_help/index.html +++ b/help/en_US/scilab_en_US_help/index.html @@ -31,7 +31,7 @@

FOSSEE Optimization Toolbox

    -
  • FOSSEE Optimization Toolbox +
  • FOSSEE Optimization Toolbox
    • fgoalattainSolves a multiobjective goal attainment problem
    • @@ -106,7 +106,7 @@
    • symphonymatSolves a mixed integer linear programming constrained optimization problem in intlinprog format.
    • -
    • Symphony Native Functions +
    • Symphony Native Functions
      • sym_addConstrAdd a new constraint
      • diff --git a/help/en_US/scilab_en_US_help/jhelpmap.jhm b/help/en_US/scilab_en_US_help/jhelpmap.jhm index ff67fca..eb373d9 100644 --- a/help/en_US/scilab_en_US_help/jhelpmap.jhm +++ b/help/en_US/scilab_en_US_help/jhelpmap.jhm @@ -2,7 +2,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/help/en_US/scilab_en_US_help/jhelptoc.xml b/help/en_US/scilab_en_US_help/jhelptoc.xml index 6e158e1..c769e27 100644 --- a/help/en_US/scilab_en_US_help/jhelptoc.xml +++ b/help/en_US/scilab_en_US_help/jhelptoc.xml @@ -2,7 +2,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/help/en_US/scilab_en_US_help/linprog.html b/help/en_US/scilab_en_US_help/linprog.html index 157265a..0ecb1ba 100644 --- a/help/en_US/scilab_en_US_help/linprog.html +++ b/help/en_US/scilab_en_US_help/linprog.html @@ -16,7 +16,7 @@
- FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > linprog + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > linprog

linprog

@@ -178,7 +178,7 @@ It has type "struct" and contains the following fields.
- FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox diff --git a/help/en_US/scilab_en_US_help/lsqlin.html b/help/en_US/scilab_en_US_help/lsqlin.html index 2030acd..5a26c54 100644 --- a/help/en_US/scilab_en_US_help/lsqlin.html +++ b/help/en_US/scilab_en_US_help/lsqlin.html @@ -16,7 +16,7 @@ - FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > lsqlin + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > lsqlin

lsqlin

@@ -161,7 +161,7 @@ It has type "struct" and contains the following fields.
- FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox diff --git a/help/en_US/scilab_en_US_help/lsqnonlin.html b/help/en_US/scilab_en_US_help/lsqnonlin.html index fb058f4..f2c32ce 100644 --- a/help/en_US/scilab_en_US_help/lsqnonlin.html +++ b/help/en_US/scilab_en_US_help/lsqnonlin.html @@ -16,7 +16,7 @@ - FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > lsqnonlin + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > lsqnonlin

lsqnonlin

@@ -167,7 +167,7 @@ It has type "struct" and contains the following fields.
- FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox diff --git a/help/en_US/scilab_en_US_help/lsqnonneg.html b/help/en_US/scilab_en_US_help/lsqnonneg.html index 760cc74..5cd01df 100644 --- a/help/en_US/scilab_en_US_help/lsqnonneg.html +++ b/help/en_US/scilab_en_US_help/lsqnonneg.html @@ -16,7 +16,7 @@ - FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > lsqnonneg + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > lsqnonneg

lsqnonneg

@@ -115,7 +115,7 @@ It has type "struct" and contains the following fields.
- FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox diff --git a/help/en_US/scilab_en_US_help/qpipopt.html b/help/en_US/scilab_en_US_help/qpipopt.html index 1a6911b..f134d7a 100644 --- a/help/en_US/scilab_en_US_help/qpipopt.html +++ b/help/en_US/scilab_en_US_help/qpipopt.html @@ -16,7 +16,7 @@ - FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > qpipopt + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > qpipopt

qpipopt

@@ -161,7 +161,7 @@ It has type "struct" and contains the following fields.
- FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox diff --git a/help/en_US/scilab_en_US_help/qpipoptmat.html b/help/en_US/scilab_en_US_help/qpipoptmat.html index f5498bf..cd9a0ad 100644 --- a/help/en_US/scilab_en_US_help/qpipoptmat.html +++ b/help/en_US/scilab_en_US_help/qpipoptmat.html @@ -16,7 +16,7 @@ - FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > qpipoptmat + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > qpipoptmat

qpipoptmat

@@ -157,7 +157,7 @@ It has type "struct" and contains the following fields.
- FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox diff --git a/help/en_US/scilab_en_US_help/section_031bbc67ce78762a40093bfdff4eaa3b.html b/help/en_US/scilab_en_US_help/section_031bbc67ce78762a40093bfdff4eaa3b.html new file mode 100644 index 0000000..70267f5 --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_031bbc67ce78762a40093bfdff4eaa3b.html @@ -0,0 +1,358 @@ + + + + + + +
+ + + + +
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox + +

+

FOSSEE Optimization Toolbox

+
  • fgoalattainSolves a multiobjective goal attainment problem
  • + + + + + +
  • fminbndSolves a multi-variable optimization problem on a bounded interval
  • + + + + + +
  • fminconSolves a multi-variable constrainted optimization problem
  • + + + + + +
  • fminimaxSolves minimax constraint problem
  • + + + + + +
  • fminuncSolves a multi-variable unconstrainted optimization problem
  • + + + + + +
  • linprogSolves a linear programming problem.
  • + + + + + +
  • lsqlinSolves a linear quadratic problem.
  • + + + + + +
  • lsqnonlinSolves a non linear data fitting problems.
  • + + + + + +
  • lsqnonnegSolves nonnegative least-squares curve fitting problems.
  • + + + + + +
  • qpipoptSolves a linear quadratic problem.
  • + + + + + +
  • qpipoptmatSolves a linear quadratic problem.
  • + + + + + +
  • symphonySolves a mixed integer linear programming constrained optimization problem.
  • + + + + + +
  • symphonymatSolves a mixed integer linear programming constrained optimization problem in intlinprog format.
  • + +
  • Symphony Native Functions +
+
+ +
+ + + + + + +
Report an issue
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_2de38e189eb88e4cd1c78c8c7dee62fe.html b/help/en_US/scilab_en_US_help/section_2de38e189eb88e4cd1c78c8c7dee62fe.html new file mode 100644 index 0000000..ffe9359 --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_2de38e189eb88e4cd1c78c8c7dee62fe.html @@ -0,0 +1,285 @@ + + + + + + +
+ + + + +
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions + +

+

Symphony Native Functions

+ +
+ +
+ + + + + + +
Report an issue
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_316c7f5a42ba69316753082a567f2a1a.html b/help/en_US/scilab_en_US_help/section_316c7f5a42ba69316753082a567f2a1a.html new file mode 100644 index 0000000..3fdb9b5 --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_316c7f5a42ba69316753082a567f2a1a.html @@ -0,0 +1,285 @@ + + + + + + +
+ + + + +
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions + +

+

Symphony Native Functions

+ +
+ +
+ + + + + + +
Report an issue
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_31dab4715f0fe64415f49528ca3498bb.html b/help/en_US/scilab_en_US_help/section_31dab4715f0fe64415f49528ca3498bb.html new file mode 100644 index 0000000..a6ca8d8 --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_31dab4715f0fe64415f49528ca3498bb.html @@ -0,0 +1,285 @@ + + + + + + +
+ + + + +
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions + +

+

Symphony Native Functions

+ +
+ +
+ + + + + + +
Report an issue
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_33d4a5e121711ed9e58409f81a1bfe85.html b/help/en_US/scilab_en_US_help/section_33d4a5e121711ed9e58409f81a1bfe85.html new file mode 100644 index 0000000..3eba290 --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_33d4a5e121711ed9e58409f81a1bfe85.html @@ -0,0 +1,358 @@ + + + + + + +
+ + + + +
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox + +

+

FOSSEE Optimization Toolbox

+
  • fgoalattainSolves a multiobjective goal attainment problem
  • + + + + + +
  • fminbndSolves a multi-variable optimization problem on a bounded interval
  • + + + + + +
  • fminconSolves a multi-variable constrainted optimization problem
  • + + + + + +
  • fminimaxSolves minimax constraint problem
  • + + + + + +
  • fminuncSolves a multi-variable unconstrainted optimization problem
  • + + + + + +
  • linprogSolves a linear programming problem.
  • + + + + + +
  • lsqlinSolves a linear quadratic problem.
  • + + + + + +
  • lsqnonlinSolves a non linear data fitting problems.
  • + + + + + +
  • lsqnonnegSolves nonnegative least-squares curve fitting problems.
  • + + + + + +
  • qpipoptSolves a linear quadratic problem.
  • + + + + + +
  • qpipoptmatSolves a linear quadratic problem.
  • + + + + + +
  • symphonySolves a mixed integer linear programming constrained optimization problem.
  • + + + + + +
  • symphonymatSolves a mixed integer linear programming constrained optimization problem in intlinprog format.
  • + +
  • Symphony Native Functions +
+
+ +
+ + + + + + +
Report an issue
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_3906586e7fe02c8c09617f7b5dce55cb.html b/help/en_US/scilab_en_US_help/section_3906586e7fe02c8c09617f7b5dce55cb.html new file mode 100644 index 0000000..3818f81 --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_3906586e7fe02c8c09617f7b5dce55cb.html @@ -0,0 +1,358 @@ + + + + + + +
+ + + + +
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox + +

+

FOSSEE Optimization Toolbox

+
  • fgoalattainSolves a multiobjective goal attainment problem
  • + + + + + +
  • fminbndSolves a multi-variable optimization problem on a bounded interval
  • + + + + + +
  • fminconSolves a multi-variable constrainted optimization problem
  • + + + + + +
  • fminimaxSolves minimax constraint problem
  • + + + + + +
  • fminuncSolves a multi-variable unconstrainted optimization problem
  • + + + + + +
  • linprogSolves a linear programming problem.
  • + + + + + +
  • lsqlinSolves a linear quadratic problem.
  • + + + + + +
  • lsqnonlinSolves a non linear data fitting problems.
  • + + + + + +
  • lsqnonnegSolves nonnegative least-squares curve fitting problems.
  • + + + + + +
  • qpipoptSolves a linear quadratic problem.
  • + + + + + +
  • qpipoptmatSolves a linear quadratic problem.
  • + + + + + +
  • symphonySolves a mixed integer linear programming constrained optimization problem.
  • + + + + + +
  • symphonymatSolves a mixed integer linear programming constrained optimization problem in intlinprog format.
  • + +
  • Symphony Native Functions +
+
+ +
+ + + + + + +
Report an issue
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_40fbe48ff9e8d4b52071944f4b8cf947.html b/help/en_US/scilab_en_US_help/section_40fbe48ff9e8d4b52071944f4b8cf947.html new file mode 100644 index 0000000..912ad97 --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_40fbe48ff9e8d4b52071944f4b8cf947.html @@ -0,0 +1,285 @@ + + + + + + +
+ + + + +
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions + +

+

Symphony Native Functions

+ +
+ +
+ + + + + + +
Report an issue
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_77ccf0809f74fd4d440a542ef18ef2ec.html b/help/en_US/scilab_en_US_help/section_77ccf0809f74fd4d440a542ef18ef2ec.html new file mode 100644 index 0000000..1c64670 --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_77ccf0809f74fd4d440a542ef18ef2ec.html @@ -0,0 +1,358 @@ + + + + + + +
+ + + + +
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox + +

+

FOSSEE Optimization Toolbox

+
  • fgoalattainSolves a multiobjective goal attainment problem
  • + + + + + +
  • fminbndSolves a multi-variable optimization problem on a bounded interval
  • + + + + + +
  • fminconSolves a multi-variable constrainted optimization problem
  • + + + + + +
  • fminimaxSolves minimax constraint problem
  • + + + + + +
  • fminuncSolves a multi-variable unconstrainted optimization problem
  • + + + + + +
  • linprogSolves a linear programming problem.
  • + + + + + +
  • lsqlinSolves a linear quadratic problem.
  • + + + + + +
  • lsqnonlinSolves a non linear data fitting problems.
  • + + + + + +
  • lsqnonnegSolves nonnegative least-squares curve fitting problems.
  • + + + + + +
  • qpipoptSolves a linear quadratic problem.
  • + + + + + +
  • qpipoptmatSolves a linear quadratic problem.
  • + + + + + +
  • symphonySolves a mixed integer linear programming constrained optimization problem.
  • + + + + + +
  • symphonymatSolves a mixed integer linear programming constrained optimization problem in intlinprog format.
  • + +
  • Symphony Native Functions +
+
+ +
+ + + + + + +
Report an issue
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_792c22f5418bda4e6ac39553ab56cb9d.html b/help/en_US/scilab_en_US_help/section_792c22f5418bda4e6ac39553ab56cb9d.html new file mode 100644 index 0000000..ecf9cfc --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_792c22f5418bda4e6ac39553ab56cb9d.html @@ -0,0 +1,358 @@ + + + + + + +
+ + + + +
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox + +

+

FOSSEE Optimization Toolbox

+
  • fgoalattainSolves a multiobjective goal attainment problem
  • + + + + + +
  • fminbndSolves a multi-variable optimization problem on a bounded interval
  • + + + + + +
  • fminconSolves a multi-variable constrainted optimization problem
  • + + + + + +
  • fminimaxSolves minimax constraint problem
  • + + + + + +
  • fminuncSolves a multi-variable unconstrainted optimization problem
  • + + + + + +
  • linprogSolves a linear programming problem.
  • + + + + + +
  • lsqlinSolves a linear quadratic problem.
  • + + + + + +
  • lsqnonlinSolves a non linear data fitting problems.
  • + + + + + +
  • lsqnonnegSolves nonnegative least-squares curve fitting problems.
  • + + + + + +
  • qpipoptSolves a linear quadratic problem.
  • + + + + + +
  • qpipoptmatSolves a linear quadratic problem.
  • + + + + + +
  • symphonySolves a mixed integer linear programming constrained optimization problem.
  • + + + + + +
  • symphonymatSolves a mixed integer linear programming constrained optimization problem in intlinprog format.
  • + +
  • Symphony Native Functions +
+
+ +
+ + + + + + +
Report an issue
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_79a16baf1a78e371ce44a155ba5e7737.html b/help/en_US/scilab_en_US_help/section_79a16baf1a78e371ce44a155ba5e7737.html new file mode 100644 index 0000000..a1046d7 --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_79a16baf1a78e371ce44a155ba5e7737.html @@ -0,0 +1,285 @@ + + + + + + +
+ + + + +
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions + +

+

Symphony Native Functions

+ +
+ +
+ + + + + + +
Report an issue
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_9d3ea7cdaaa8f0e19d7f4d2e68bb2ca6.html b/help/en_US/scilab_en_US_help/section_9d3ea7cdaaa8f0e19d7f4d2e68bb2ca6.html new file mode 100644 index 0000000..dc6507b --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_9d3ea7cdaaa8f0e19d7f4d2e68bb2ca6.html @@ -0,0 +1,358 @@ + + + + + + +
+ + + + +
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox + +

+

FOSSEE Optimization Toolbox

+
  • fgoalattainSolves a multiobjective goal attainment problem
  • + + + + + +
  • fminbndSolves a multi-variable optimization problem on a bounded interval
  • + + + + + +
  • fminconSolves a multi-variable constrainted optimization problem
  • + + + + + +
  • fminimaxSolves minimax constraint problem
  • + + + + + +
  • fminuncSolves a multi-variable unconstrainted optimization problem
  • + + + + + +
  • linprogSolves a linear programming problem.
  • + + + + + +
  • lsqlinSolves a linear quadratic problem.
  • + + + + + +
  • lsqnonlinSolves a non linear data fitting problems.
  • + + + + + +
  • lsqnonnegSolves nonnegative least-squares curve fitting problems.
  • + + + + + +
  • qpipoptSolves a linear quadratic problem.
  • + + + + + +
  • qpipoptmatSolves a linear quadratic problem.
  • + + + + + +
  • symphonySolves a mixed integer linear programming constrained optimization problem.
  • + + + + + +
  • symphonymatSolves a mixed integer linear programming constrained optimization problem in intlinprog format.
  • + +
  • Symphony Native Functions +
+
+ +
+ + + + + + +
Report an issue
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_9eb7b65f35f3a8016fa9ca1117dafc99.html b/help/en_US/scilab_en_US_help/section_9eb7b65f35f3a8016fa9ca1117dafc99.html new file mode 100644 index 0000000..8ad50c0 --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_9eb7b65f35f3a8016fa9ca1117dafc99.html @@ -0,0 +1,285 @@ + + + + + + +
+ + + + +
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions + +

+

Symphony Native Functions

+ +
+ +
+ + + + + + +
Report an issue
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_a74d6f4b13f6dde64de3fc3ca270e955.html b/help/en_US/scilab_en_US_help/section_a74d6f4b13f6dde64de3fc3ca270e955.html new file mode 100644 index 0000000..273e6c8 --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_a74d6f4b13f6dde64de3fc3ca270e955.html @@ -0,0 +1,358 @@ + + + + + + +
+ + + + +
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox + +

+

FOSSEE Optimization Toolbox

+
  • fgoalattainSolves a multiobjective goal attainment problem
  • + + + + + +
  • fminbndSolves a multi-variable optimization problem on a bounded interval
  • + + + + + +
  • fminconSolves a multi-variable constrainted optimization problem
  • + + + + + +
  • fminimaxSolves minimax constraint problem
  • + + + + + +
  • fminuncSolves a multi-variable unconstrainted optimization problem
  • + + + + + +
  • linprogSolves a linear programming problem.
  • + + + + + +
  • lsqlinSolves a linear quadratic problem.
  • + + + + + +
  • lsqnonlinSolves a non linear data fitting problems.
  • + + + + + +
  • lsqnonnegSolves nonnegative least-squares curve fitting problems.
  • + + + + + +
  • qpipoptSolves a linear quadratic problem.
  • + + + + + +
  • qpipoptmatSolves a linear quadratic problem.
  • + + + + + +
  • symphonySolves a mixed integer linear programming constrained optimization problem.
  • + + + + + +
  • symphonymatSolves a mixed integer linear programming constrained optimization problem in intlinprog format.
  • + +
  • Symphony Native Functions +
+
+ +
+ + + + + + +
Report an issue
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_b8aeecafdbffda60ffabf7dd0d73f023.html b/help/en_US/scilab_en_US_help/section_b8aeecafdbffda60ffabf7dd0d73f023.html new file mode 100644 index 0000000..174dd20 --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_b8aeecafdbffda60ffabf7dd0d73f023.html @@ -0,0 +1,285 @@ + + + + + + +
+ + + + +
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions + +

+

Symphony Native Functions

+ +
+ +
+ + + + + + +
Report an issue
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_f1d257bd5e602360b522f16db37c4d79.html b/help/en_US/scilab_en_US_help/section_f1d257bd5e602360b522f16db37c4d79.html new file mode 100644 index 0000000..e05054a --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_f1d257bd5e602360b522f16db37c4d79.html @@ -0,0 +1,285 @@ + + + + + + +
+ + + + +
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions + +

+

Symphony Native Functions

+ +
+ +
+ + + + + + +
Report an issue
+ << symphonymat + + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/section_fe07f0c0dadf6c8d23d83e40a792f73e.html b/help/en_US/scilab_en_US_help/section_fe07f0c0dadf6c8d23d83e40a792f73e.html new file mode 100644 index 0000000..93e4ddf --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_fe07f0c0dadf6c8d23d83e40a792f73e.html @@ -0,0 +1,358 @@ + + + + + + +
+ + + + +
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + + + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox + +

+

FOSSEE Optimization Toolbox

+
  • fgoalattainSolves a multiobjective goal attainment problem
  • + + + + + +
  • fminbndSolves a multi-variable optimization problem on a bounded interval
  • + + + + + +
  • fminconSolves a multi-variable constrainted optimization problem
  • + + + + + +
  • fminimaxSolves minimax constraint problem
  • + + + + + +
  • fminuncSolves a multi-variable unconstrainted optimization problem
  • + + + + + +
  • linprogSolves a linear programming problem.
  • + + + + + +
  • lsqlinSolves a linear quadratic problem.
  • + + + + + +
  • lsqnonlinSolves a non linear data fitting problems.
  • + + + + + +
  • lsqnonnegSolves nonnegative least-squares curve fitting problems.
  • + + + + + +
  • qpipoptSolves a linear quadratic problem.
  • + + + + + +
  • qpipoptmatSolves a linear quadratic problem.
  • + + + + + +
  • symphonySolves a mixed integer linear programming constrained optimization problem.
  • + + + + + +
  • symphonymatSolves a mixed integer linear programming constrained optimization problem in intlinprog format.
  • + +
  • Symphony Native Functions +
+
+ +
+ + + + + + +
Report an issue
+ + + FOSSEE Optimization Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/sym_addConstr.html b/help/en_US/scilab_en_US_help/sym_addConstr.html index 230d2f8..ca681d5 100644 --- a/help/en_US/scilab_en_US_help/sym_addConstr.html +++ b/help/en_US/scilab_en_US_help/sym_addConstr.html @@ -12,11 +12,11 @@
- << Symphony Native Functions + << Symphony Native Functions - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_addConstr + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_addConstr

sym_addConstr

@@ -73,11 +73,11 @@
Report an issue
- << Symphony Native Functions + << Symphony Native Functions - Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_addVar.html b/help/en_US/scilab_en_US_help/sym_addVar.html index 29cb8c6..f74db8c 100644 --- a/help/en_US/scilab_en_US_help/sym_addVar.html +++ b/help/en_US/scilab_en_US_help/sym_addVar.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_addVar + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_addVar

sym_addVar

@@ -79,7 +79,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_close.html b/help/en_US/scilab_en_US_help/sym_close.html index c78dd36..c21dc6e 100644 --- a/help/en_US/scilab_en_US_help/sym_close.html +++ b/help/en_US/scilab_en_US_help/sym_close.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_close + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_close

sym_close

@@ -70,7 +70,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_deleteConstrs.html b/help/en_US/scilab_en_US_help/sym_deleteConstrs.html index 6f269ef..88a7b3d 100644 --- a/help/en_US/scilab_en_US_help/sym_deleteConstrs.html +++ b/help/en_US/scilab_en_US_help/sym_deleteConstrs.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_deleteConstrs + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_deleteConstrs

sym_deleteConstrs

@@ -67,7 +67,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_deleteVars.html b/help/en_US/scilab_en_US_help/sym_deleteVars.html index 37d9dcb..77aaad6 100644 --- a/help/en_US/scilab_en_US_help/sym_deleteVars.html +++ b/help/en_US/scilab_en_US_help/sym_deleteVars.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_deleteVars + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_deleteVars

sym_deleteVars

@@ -67,7 +67,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getConstrActivity.html b/help/en_US/scilab_en_US_help/sym_getConstrActivity.html index 01f5b1e..cb1cb1c 100644 --- a/help/en_US/scilab_en_US_help/sym_getConstrActivity.html +++ b/help/en_US/scilab_en_US_help/sym_getConstrActivity.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getConstrActivity + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getConstrActivity

sym_getConstrActivity

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getConstrLower.html b/help/en_US/scilab_en_US_help/sym_getConstrLower.html index 12e89e0..929471f 100644 --- a/help/en_US/scilab_en_US_help/sym_getConstrLower.html +++ b/help/en_US/scilab_en_US_help/sym_getConstrLower.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getConstrLower + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getConstrLower

sym_getConstrLower

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getConstrRange.html b/help/en_US/scilab_en_US_help/sym_getConstrRange.html index 214e500..971a9d2 100644 --- a/help/en_US/scilab_en_US_help/sym_getConstrRange.html +++ b/help/en_US/scilab_en_US_help/sym_getConstrRange.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getConstrRange + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getConstrRange

sym_getConstrRange

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getConstrSense.html b/help/en_US/scilab_en_US_help/sym_getConstrSense.html index e0802be..0f49a90 100644 --- a/help/en_US/scilab_en_US_help/sym_getConstrSense.html +++ b/help/en_US/scilab_en_US_help/sym_getConstrSense.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getConstrSense + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getConstrSense

sym_getConstrSense

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getConstrUpper.html b/help/en_US/scilab_en_US_help/sym_getConstrUpper.html index df3f2eb..f40b107 100644 --- a/help/en_US/scilab_en_US_help/sym_getConstrUpper.html +++ b/help/en_US/scilab_en_US_help/sym_getConstrUpper.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getConstrUpper + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getConstrUpper

sym_getConstrUpper

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getDblParam.html b/help/en_US/scilab_en_US_help/sym_getDblParam.html index 39c59e2..3e2d38b 100644 --- a/help/en_US/scilab_en_US_help/sym_getDblParam.html +++ b/help/en_US/scilab_en_US_help/sym_getDblParam.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getDblParam + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getDblParam

sym_getDblParam

@@ -67,7 +67,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getInfinity.html b/help/en_US/scilab_en_US_help/sym_getInfinity.html index 29696da..bef10ab 100644 --- a/help/en_US/scilab_en_US_help/sym_getInfinity.html +++ b/help/en_US/scilab_en_US_help/sym_getInfinity.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getInfinity + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getInfinity

sym_getInfinity

@@ -68,7 +68,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getIntParam.html b/help/en_US/scilab_en_US_help/sym_getIntParam.html index 55dc0eb..4fed98a 100644 --- a/help/en_US/scilab_en_US_help/sym_getIntParam.html +++ b/help/en_US/scilab_en_US_help/sym_getIntParam.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getIntParam + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getIntParam

sym_getIntParam

@@ -67,7 +67,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getIterCount.html b/help/en_US/scilab_en_US_help/sym_getIterCount.html index ee3757b..9b2775d 100644 --- a/help/en_US/scilab_en_US_help/sym_getIterCount.html +++ b/help/en_US/scilab_en_US_help/sym_getIterCount.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getIterCount + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getIterCount

sym_getIterCount

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getMatrix.html b/help/en_US/scilab_en_US_help/sym_getMatrix.html index 9f0f608..60a81e1 100644 --- a/help/en_US/scilab_en_US_help/sym_getMatrix.html +++ b/help/en_US/scilab_en_US_help/sym_getMatrix.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getMatrix + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getMatrix

sym_getMatrix

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getNumConstr.html b/help/en_US/scilab_en_US_help/sym_getNumConstr.html index 7b54f83..55187b3 100644 --- a/help/en_US/scilab_en_US_help/sym_getNumConstr.html +++ b/help/en_US/scilab_en_US_help/sym_getNumConstr.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getNumConstr + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getNumConstr

sym_getNumConstr

@@ -68,7 +68,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getNumElements.html b/help/en_US/scilab_en_US_help/sym_getNumElements.html index 8f59387..5d3d4a2 100644 --- a/help/en_US/scilab_en_US_help/sym_getNumElements.html +++ b/help/en_US/scilab_en_US_help/sym_getNumElements.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getNumElements + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getNumElements

sym_getNumElements

@@ -68,7 +68,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getNumVar.html b/help/en_US/scilab_en_US_help/sym_getNumVar.html index f5ba3f6..8c4d1b7 100644 --- a/help/en_US/scilab_en_US_help/sym_getNumVar.html +++ b/help/en_US/scilab_en_US_help/sym_getNumVar.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getNumVar + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getNumVar

sym_getNumVar

@@ -68,7 +68,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getObjCoeff.html b/help/en_US/scilab_en_US_help/sym_getObjCoeff.html index 2178b5d..61d0a50 100644 --- a/help/en_US/scilab_en_US_help/sym_getObjCoeff.html +++ b/help/en_US/scilab_en_US_help/sym_getObjCoeff.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getObjCoeff + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getObjCoeff

sym_getObjCoeff

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getObjSense.html b/help/en_US/scilab_en_US_help/sym_getObjSense.html index 9137bdc..9d238be 100644 --- a/help/en_US/scilab_en_US_help/sym_getObjSense.html +++ b/help/en_US/scilab_en_US_help/sym_getObjSense.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getObjSense + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getObjSense

sym_getObjSense

@@ -68,7 +68,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getObjVal.html b/help/en_US/scilab_en_US_help/sym_getObjVal.html index 712c695..f2c42e7 100644 --- a/help/en_US/scilab_en_US_help/sym_getObjVal.html +++ b/help/en_US/scilab_en_US_help/sym_getObjVal.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getObjVal + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getObjVal

sym_getObjVal

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getPrimalBound.html b/help/en_US/scilab_en_US_help/sym_getPrimalBound.html index eef1de0..20b8703 100644 --- a/help/en_US/scilab_en_US_help/sym_getPrimalBound.html +++ b/help/en_US/scilab_en_US_help/sym_getPrimalBound.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getPrimalBound + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getPrimalBound

sym_getPrimalBound

@@ -68,7 +68,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getRhs.html b/help/en_US/scilab_en_US_help/sym_getRhs.html index 3b4eb7f..e0a856b 100644 --- a/help/en_US/scilab_en_US_help/sym_getRhs.html +++ b/help/en_US/scilab_en_US_help/sym_getRhs.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getRhs + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getRhs

sym_getRhs

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getStatus.html b/help/en_US/scilab_en_US_help/sym_getStatus.html index 8880566..c86bef7 100644 --- a/help/en_US/scilab_en_US_help/sym_getStatus.html +++ b/help/en_US/scilab_en_US_help/sym_getStatus.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getStatus + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getStatus

sym_getStatus

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getStrParam.html b/help/en_US/scilab_en_US_help/sym_getStrParam.html index f3d3671..1d1c6f8 100644 --- a/help/en_US/scilab_en_US_help/sym_getStrParam.html +++ b/help/en_US/scilab_en_US_help/sym_getStrParam.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getStrParam + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getStrParam

sym_getStrParam

@@ -67,7 +67,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getVarLower.html b/help/en_US/scilab_en_US_help/sym_getVarLower.html index 7804681..1027813 100644 --- a/help/en_US/scilab_en_US_help/sym_getVarLower.html +++ b/help/en_US/scilab_en_US_help/sym_getVarLower.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getVarLower + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getVarLower

sym_getVarLower

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getVarSoln.html b/help/en_US/scilab_en_US_help/sym_getVarSoln.html index 3b6b932..e11f68e 100644 --- a/help/en_US/scilab_en_US_help/sym_getVarSoln.html +++ b/help/en_US/scilab_en_US_help/sym_getVarSoln.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getVarSoln + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getVarSoln

sym_getVarSoln

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_getVarUpper.html b/help/en_US/scilab_en_US_help/sym_getVarUpper.html index bc8d0ca..9125c66 100644 --- a/help/en_US/scilab_en_US_help/sym_getVarUpper.html +++ b/help/en_US/scilab_en_US_help/sym_getVarUpper.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getVarUpper + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_getVarUpper

sym_getVarUpper

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_isAbandoned.html b/help/en_US/scilab_en_US_help/sym_isAbandoned.html index 7f22d84..fa75c3e 100644 --- a/help/en_US/scilab_en_US_help/sym_isAbandoned.html +++ b/help/en_US/scilab_en_US_help/sym_isAbandoned.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isAbandoned + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isAbandoned

sym_isAbandoned

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_isBinary.html b/help/en_US/scilab_en_US_help/sym_isBinary.html index 904c383..946ec7e 100644 --- a/help/en_US/scilab_en_US_help/sym_isBinary.html +++ b/help/en_US/scilab_en_US_help/sym_isBinary.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isBinary + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isBinary

sym_isBinary

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_isContinuous.html b/help/en_US/scilab_en_US_help/sym_isContinuous.html index 22d6f4d..1ba5429 100644 --- a/help/en_US/scilab_en_US_help/sym_isContinuous.html +++ b/help/en_US/scilab_en_US_help/sym_isContinuous.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isContinuous + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isContinuous

sym_isContinuous

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_isEnvActive.html b/help/en_US/scilab_en_US_help/sym_isEnvActive.html index 4997879..e80859d 100644 --- a/help/en_US/scilab_en_US_help/sym_isEnvActive.html +++ b/help/en_US/scilab_en_US_help/sym_isEnvActive.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isEnvActive + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isEnvActive

sym_isEnvActive

@@ -68,7 +68,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_isInfeasible.html b/help/en_US/scilab_en_US_help/sym_isInfeasible.html index 2ea8048..f657cca 100644 --- a/help/en_US/scilab_en_US_help/sym_isInfeasible.html +++ b/help/en_US/scilab_en_US_help/sym_isInfeasible.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isInfeasible + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isInfeasible

sym_isInfeasible

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_isInteger.html b/help/en_US/scilab_en_US_help/sym_isInteger.html index 3843b5b..31c9707 100644 --- a/help/en_US/scilab_en_US_help/sym_isInteger.html +++ b/help/en_US/scilab_en_US_help/sym_isInteger.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isInteger + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isInteger

sym_isInteger

@@ -63,7 +63,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_isIterLimitReached.html b/help/en_US/scilab_en_US_help/sym_isIterLimitReached.html index 7081962..d10bf5b 100644 --- a/help/en_US/scilab_en_US_help/sym_isIterLimitReached.html +++ b/help/en_US/scilab_en_US_help/sym_isIterLimitReached.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isIterLimitReached + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isIterLimitReached

sym_isIterLimitReached

@@ -70,7 +70,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_isOptimal.html b/help/en_US/scilab_en_US_help/sym_isOptimal.html index 929b01b..9db45b0 100644 --- a/help/en_US/scilab_en_US_help/sym_isOptimal.html +++ b/help/en_US/scilab_en_US_help/sym_isOptimal.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isOptimal + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isOptimal

sym_isOptimal

@@ -70,7 +70,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_isTargetGapAchieved.html b/help/en_US/scilab_en_US_help/sym_isTargetGapAchieved.html index 91d5a7f..1f24750 100644 --- a/help/en_US/scilab_en_US_help/sym_isTargetGapAchieved.html +++ b/help/en_US/scilab_en_US_help/sym_isTargetGapAchieved.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isTargetGapAchieved + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isTargetGapAchieved

sym_isTargetGapAchieved

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_isTimeLimitReached.html b/help/en_US/scilab_en_US_help/sym_isTimeLimitReached.html index ce96eae..bac9d72 100644 --- a/help/en_US/scilab_en_US_help/sym_isTimeLimitReached.html +++ b/help/en_US/scilab_en_US_help/sym_isTimeLimitReached.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isTimeLimitReached + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_isTimeLimitReached

sym_isTimeLimitReached

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_loadMPS.html b/help/en_US/scilab_en_US_help/sym_loadMPS.html index 4046026..40920b0 100644 --- a/help/en_US/scilab_en_US_help/sym_loadMPS.html +++ b/help/en_US/scilab_en_US_help/sym_loadMPS.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_loadMPS + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_loadMPS

sym_loadMPS

@@ -68,7 +68,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_loadProblem.html b/help/en_US/scilab_en_US_help/sym_loadProblem.html index 7e29c9b..51ef7a1 100644 --- a/help/en_US/scilab_en_US_help/sym_loadProblem.html +++ b/help/en_US/scilab_en_US_help/sym_loadProblem.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_loadProblem + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_loadProblem

sym_loadProblem

@@ -88,7 +88,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_loadProblemBasic.html b/help/en_US/scilab_en_US_help/sym_loadProblemBasic.html index 23f690e..be22b57 100644 --- a/help/en_US/scilab_en_US_help/sym_loadProblemBasic.html +++ b/help/en_US/scilab_en_US_help/sym_loadProblemBasic.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_loadProblemBasic + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_loadProblemBasic

sym_loadProblemBasic

@@ -89,7 +89,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_open.html b/help/en_US/scilab_en_US_help/sym_open.html index 7347781..05eb30a 100644 --- a/help/en_US/scilab_en_US_help/sym_open.html +++ b/help/en_US/scilab_en_US_help/sym_open.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_open + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_open

sym_open

@@ -70,7 +70,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_resetParams.html b/help/en_US/scilab_en_US_help/sym_resetParams.html index a28d629..60e9a7f 100644 --- a/help/en_US/scilab_en_US_help/sym_resetParams.html +++ b/help/en_US/scilab_en_US_help/sym_resetParams.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_resetParams + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_resetParams

sym_resetParams

@@ -66,7 +66,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_setConstrLower.html b/help/en_US/scilab_en_US_help/sym_setConstrLower.html index 937983f..5821391 100644 --- a/help/en_US/scilab_en_US_help/sym_setConstrLower.html +++ b/help/en_US/scilab_en_US_help/sym_setConstrLower.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setConstrLower + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setConstrLower

sym_setConstrLower

@@ -71,7 +71,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_setConstrType.html b/help/en_US/scilab_en_US_help/sym_setConstrType.html index 3ad6e86..e10c1b7 100644 --- a/help/en_US/scilab_en_US_help/sym_setConstrType.html +++ b/help/en_US/scilab_en_US_help/sym_setConstrType.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setConstrType + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setConstrType

sym_setConstrType

@@ -77,7 +77,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_setConstrUpper.html b/help/en_US/scilab_en_US_help/sym_setConstrUpper.html index 11086a0..327360c 100644 --- a/help/en_US/scilab_en_US_help/sym_setConstrUpper.html +++ b/help/en_US/scilab_en_US_help/sym_setConstrUpper.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setConstrUpper + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setConstrUpper

sym_setConstrUpper

@@ -71,7 +71,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_setContinuous.html b/help/en_US/scilab_en_US_help/sym_setContinuous.html index d794b27..260c828 100644 --- a/help/en_US/scilab_en_US_help/sym_setContinuous.html +++ b/help/en_US/scilab_en_US_help/sym_setContinuous.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setContinuous + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setContinuous

sym_setContinuous

@@ -67,7 +67,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_setDblParam.html b/help/en_US/scilab_en_US_help/sym_setDblParam.html index e35cb84..79bea38 100644 --- a/help/en_US/scilab_en_US_help/sym_setDblParam.html +++ b/help/en_US/scilab_en_US_help/sym_setDblParam.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setDblParam + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setDblParam

sym_setDblParam

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_setIntParam.html b/help/en_US/scilab_en_US_help/sym_setIntParam.html index 0f9b8ce..085cd2d 100644 --- a/help/en_US/scilab_en_US_help/sym_setIntParam.html +++ b/help/en_US/scilab_en_US_help/sym_setIntParam.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setIntParam + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setIntParam

sym_setIntParam

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_setInteger.html b/help/en_US/scilab_en_US_help/sym_setInteger.html index 4402005..9ace0fa 100644 --- a/help/en_US/scilab_en_US_help/sym_setInteger.html +++ b/help/en_US/scilab_en_US_help/sym_setInteger.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setInteger + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setInteger

sym_setInteger

@@ -67,7 +67,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_setObjCoeff.html b/help/en_US/scilab_en_US_help/sym_setObjCoeff.html index b8fa629..8bb0771 100644 --- a/help/en_US/scilab_en_US_help/sym_setObjCoeff.html +++ b/help/en_US/scilab_en_US_help/sym_setObjCoeff.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setObjCoeff + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setObjCoeff

sym_setObjCoeff

@@ -71,7 +71,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_setObjSense.html b/help/en_US/scilab_en_US_help/sym_setObjSense.html index 69b7093..a85340e 100644 --- a/help/en_US/scilab_en_US_help/sym_setObjSense.html +++ b/help/en_US/scilab_en_US_help/sym_setObjSense.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setObjSense + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setObjSense

sym_setObjSense

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_setPrimalBound.html b/help/en_US/scilab_en_US_help/sym_setPrimalBound.html index 3040f55..4e5fda2 100644 --- a/help/en_US/scilab_en_US_help/sym_setPrimalBound.html +++ b/help/en_US/scilab_en_US_help/sym_setPrimalBound.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setPrimalBound + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setPrimalBound

sym_setPrimalBound

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_setStrParam.html b/help/en_US/scilab_en_US_help/sym_setStrParam.html index 2fa67ca..2b5ff96 100644 --- a/help/en_US/scilab_en_US_help/sym_setStrParam.html +++ b/help/en_US/scilab_en_US_help/sym_setStrParam.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setStrParam + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setStrParam

sym_setStrParam

@@ -69,7 +69,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_setVarLower.html b/help/en_US/scilab_en_US_help/sym_setVarLower.html index 2b977d2..7d24dfe 100644 --- a/help/en_US/scilab_en_US_help/sym_setVarLower.html +++ b/help/en_US/scilab_en_US_help/sym_setVarLower.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setVarLower + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setVarLower

sym_setVarLower

@@ -71,7 +71,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_setVarSoln.html b/help/en_US/scilab_en_US_help/sym_setVarSoln.html index f8c73c7..f70f048 100644 --- a/help/en_US/scilab_en_US_help/sym_setVarSoln.html +++ b/help/en_US/scilab_en_US_help/sym_setVarSoln.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setVarSoln + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setVarSoln

sym_setVarSoln

@@ -70,7 +70,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_setVarUpper.html b/help/en_US/scilab_en_US_help/sym_setVarUpper.html index 16659ce..40bf06d 100644 --- a/help/en_US/scilab_en_US_help/sym_setVarUpper.html +++ b/help/en_US/scilab_en_US_help/sym_setVarUpper.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setVarUpper + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_setVarUpper

sym_setVarUpper

@@ -71,7 +71,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/sym_solve.html b/help/en_US/scilab_en_US_help/sym_solve.html index 67e43f5..1d603f5 100644 --- a/help/en_US/scilab_en_US_help/sym_solve.html +++ b/help/en_US/scilab_en_US_help/sym_solve.html @@ -16,7 +16,7 @@ - Symphony Native Functions + Symphony Native Functions @@ -28,7 +28,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_solve + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_solve

sym_solve

@@ -68,7 +68,7 @@
- Symphony Native Functions + Symphony Native Functions diff --git a/help/en_US/scilab_en_US_help/symphony.html b/help/en_US/scilab_en_US_help/symphony.html index 8b87039..4b7eaba 100644 --- a/help/en_US/scilab_en_US_help/symphony.html +++ b/help/en_US/scilab_en_US_help/symphony.html @@ -16,7 +16,7 @@ - FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox @@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > symphony + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > symphony

symphony

@@ -210,7 +210,7 @@ It has type "struct" and contains the following fields.
- FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox diff --git a/help/en_US/scilab_en_US_help/symphonymat.html b/help/en_US/scilab_en_US_help/symphonymat.html index b11afc6..58e5070 100644 --- a/help/en_US/scilab_en_US_help/symphonymat.html +++ b/help/en_US/scilab_en_US_help/symphonymat.html @@ -16,11 +16,11 @@ - FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox - Symphony Native Functions >> + Symphony Native Functions >>
@@ -29,7 +29,7 @@ - FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > symphonymat + FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > symphonymat

symphonymat

@@ -199,11 +199,11 @@ It has type "struct" and contains the following fields.
- FOSSEE Optimization Toolbox + FOSSEE Optimization Toolbox - Symphony Native Functions >> + Symphony Native Functions >>
diff --git a/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar index 01dc38a..6203802 100644 Binary files a/jar/scilab_en_US_help.jar and b/jar/scilab_en_US_help.jar differ diff --git a/macros/Checkdims.bin b/macros/Checkdims.bin index 8df0367..40e385a 100644 Binary files a/macros/Checkdims.bin and b/macros/Checkdims.bin differ diff --git a/macros/Checklhs.bin b/macros/Checklhs.bin index 34561dc..7156107 100644 Binary files a/macros/Checklhs.bin and b/macros/Checklhs.bin differ diff --git a/macros/Checkrhs.bin b/macros/Checkrhs.bin index 2ec00b7..2c45876 100644 Binary files a/macros/Checkrhs.bin and b/macros/Checkrhs.bin differ diff --git a/macros/Checktype.bin b/macros/Checktype.bin index a43e55c..bbe1585 100644 Binary files a/macros/Checktype.bin and b/macros/Checktype.bin differ diff --git a/macros/Checkvector.bin b/macros/Checkvector.bin index 9a6bfdc..dfe03ab 100644 Binary files a/macros/Checkvector.bin and b/macros/Checkvector.bin differ diff --git a/macros/fgoalattain.bin b/macros/fgoalattain.bin index c329f4a..faa0821 100644 Binary files a/macros/fgoalattain.bin and b/macros/fgoalattain.bin differ diff --git a/macros/fminbnd.bin b/macros/fminbnd.bin index c9ddb2e..24cd387 100644 Binary files a/macros/fminbnd.bin and b/macros/fminbnd.bin differ diff --git a/macros/fmincon.bin b/macros/fmincon.bin index dacdfd9..dfd67b4 100644 Binary files a/macros/fmincon.bin and b/macros/fmincon.bin differ diff --git a/macros/fmincon.sci b/macros/fmincon.sci index a92faf1..3f65464 100644 --- a/macros/fmincon.sci +++ b/macros/fmincon.sci @@ -250,7 +250,9 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin // endfunction // //Hessian of the Lagrange Function // function y= lHess(x,obj,lambda) - // y= obj*[0,1,0;1,0,1;0,1,0] + lambda(1)*[2,0,0;0,0,0;0,0,0] + lambda(2)*[2,0,0;0,2,0;0,0,0] +lambda(3)*[0,0,0;0,0,0;0,0,2] + lambda(4)*[6*x(1 ),0,0;0,0,0;0,0,0] + lambda(5)*[0,0,0;0,2,0;0,0,2]; + // y= obj*[0,1,0;1,0,1;0,1,0] + lambda(1)*[2,0,0;0,0,0;0,0,0] + .. + // lambda(2)*[2,0,0;0,2,0;0,0,0] +lambda(3)*[0,0,0;0,0,0;0,0,2] + .. + // lambda(4)*[6*x(1),0,0;0,0,0;0,0,0] + lambda(5)*[0,0,0;0,2,0;0,0,2]; // endfunction // //Gradient of Non-Linear Constraints // function [cg,ceqg] = cGrad(x) diff --git a/macros/fminimax.bin b/macros/fminimax.bin index 9704302..c023720 100644 Binary files a/macros/fminimax.bin and b/macros/fminimax.bin differ diff --git a/macros/fminimax.sci b/macros/fminimax.sci index c775b1b..b649640 100644 --- a/macros/fminimax.sci +++ b/macros/fminimax.sci @@ -19,11 +19,11 @@ function [x,fval,maxfval,exitflag,output,lambda] = fminimax(varargin) // xopt = fminimax(fun,x0,A,b,Aeq,beq,lb,ub) // xopt = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfun) // xopt = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfun,options) - // [xopt, fval] = fmincon(.....) - // [xopt, fval, maxfval]= fmincon(.....) - // [xopt, fval, maxfval, exitflag]= fmincon(.....) - // [xopt, fval, maxfval, exitflag, output]= fmincon(.....) - // [xopt, fval, maxfval, exitflag, output, lambda]= fmincon(.....) + // [xopt, fval] = fminimax(.....) + // [xopt, fval, maxfval]= fminimax(.....) + // [xopt, fval, maxfval, exitflag]= fminimax(.....) + // [xopt, fval, maxfval, exitflag, output]= fminimax(.....) + // [xopt, fval, maxfval, exitflag, output, lambda]= fminimax(.....) // // Parameters // fun: The function to be minimized. fun is a function that accepts a vector x and returns a vector F, the objective functions evaluated at x. diff --git a/macros/fminunc.bin b/macros/fminunc.bin index ab53755..b5dee4a 100644 Binary files a/macros/fminunc.bin and b/macros/fminunc.bin differ diff --git a/macros/lib b/macros/lib index 1c23fc4..f2d0c92 100644 Binary files a/macros/lib and b/macros/lib differ diff --git a/macros/linprog.bin b/macros/linprog.bin index 7ba3ab3..1d3a5aa 100644 Binary files a/macros/linprog.bin and b/macros/linprog.bin differ diff --git a/macros/lsqlin.bin b/macros/lsqlin.bin index 56c1e69..7baf7be 100644 Binary files a/macros/lsqlin.bin and b/macros/lsqlin.bin differ diff --git a/macros/lsqnonneg.bin b/macros/lsqnonneg.bin index 17b5808..32620d0 100644 Binary files a/macros/lsqnonneg.bin and b/macros/lsqnonneg.bin differ diff --git a/macros/matrix_linprog.bin b/macros/matrix_linprog.bin index 2b4af21..a51bc14 100644 Binary files a/macros/matrix_linprog.bin and b/macros/matrix_linprog.bin differ diff --git a/macros/mps_linprog.bin b/macros/mps_linprog.bin index f45ed06..c0d2e3e 100644 Binary files a/macros/mps_linprog.bin and b/macros/mps_linprog.bin differ diff --git a/macros/names b/macros/names index 2f20196..21c7d4e 100644 --- a/macros/names +++ b/macros/names @@ -9,7 +9,6 @@ fmincon fminimax fminunc fseminf -intlinprog linprog lsqlin lsqnonlin diff --git a/macros/qpipopt.bin b/macros/qpipopt.bin index d33679e..e2ba3de 100644 Binary files a/macros/qpipopt.bin and b/macros/qpipopt.bin differ diff --git a/macros/qpipoptmat.bin b/macros/qpipoptmat.bin index 0bd1c14..b9c741f 100644 Binary files a/macros/qpipoptmat.bin and b/macros/qpipoptmat.bin differ diff --git a/macros/setOptions.bin b/macros/setOptions.bin index 8953829..8d23e73 100644 Binary files a/macros/setOptions.bin and b/macros/setOptions.bin differ diff --git a/macros/symphony_call.bin b/macros/symphony_call.bin index 57ce782..a883f05 100644 Binary files a/macros/symphony_call.bin and b/macros/symphony_call.bin differ 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 -#include -#include - -namespace Ipopt - //#define IP_DEBUG_CACHE -#if COIN_IPOPT_CHECKLEVEL > 2 -# define IP_DEBUG_CACHE -#endif -#ifdef IP_DEBUG_CACHE -# include "IpDebug.hpp" -#endif -{ - - // Forward Declarations - - template - class DependentResult; - - // AW: I'm taking this out, since this is by far the most used - // class. We should keep it as simple as possible. - // /** Cache Priority Enum */ - // enum CachePriority - // { - // CP_Lowest, - // CP_Standard, - // CP_Trial, - // CP_Iterate - // }; - - /** Templated class for Chached Results. This class stores up to a - * given number of "results", entities that are stored here - * together with identifies, that can be used to later retrieve the - * information again. - * - * Typically, T is a SmartPtr for some calculated quantity that - * should be stored (such as a Vector). The identifiers (or - * dependencies) are a (possibly varying) number of Tags from - * TaggedObjects, and a number of Numbers. Results are added to - * the cache using the AddCachedResults methods, and the can be - * retrieved with the GetCachedResults methods. The second set of - * methods checks whether a result has been cached for the given - * identifiers. If a corresponding results is found, a copy of it - * is returned and the method evaluates to true, otherwise it - * evaluates to false. - * - * Note that cached results can become "stale", namely when a - * TaggedObject that is used to identify this CachedResult is - * changed. When this happens, the cached result can never be - * asked for again, so that there is no point in storing it any - * longer. For this purpose, a cached result, which is stored as a - * DependentResult, inherits off an Observer. This Observer - * retrieves notification whenever a TaggedObject dependency has - * changed. Stale results are later removed from the cache. - */ - template - class CachedResults - { - public: -#ifdef IP_DEBUG_CACHE - /** (Only if compiled in DEBUG mode): debug verbosity level */ - static const Index dbg_verbosity; -#endif - - /** @name Constructors and Destructors. */ - //@{ - /** Constructor, where max_cache_size is the maximal number of - * results that should be cached. If max_cache_size is negative, - * we allow an infinite abount of cache. - */ - CachedResults(Int max_cache_size); - - /** Destructor */ - virtual ~CachedResults(); - //@} - - /** @name Generic methods for adding and retrieving cached results. */ - //@{ - /** Generic method for adding a result to the cache, given a - * std::vector of TaggesObjects and a std::vector of Numbers. - */ - void AddCachedResult(const T& result, - const std::vector& dependents, - const std::vector& scalar_dependents); - - /** Generic method for retrieving a cached results, given the - * dependencies as a std::vector of TaggesObjects and a - * std::vector of Numbers. - */ - bool GetCachedResult(T& retResult, - const std::vector& dependents, - const std::vector& scalar_dependents) const; - - /** Method for adding a result, providing only a std::vector of - * TaggedObjects. - */ - void AddCachedResult(const T& result, - const std::vector& dependents); - - /** Method for retrieving a cached result, providing only a - * std::vector of TaggedObjects. - */ - bool GetCachedResult(T& retResult, - const std::vector& dependents) const; - //@} - - /** @name Pointer-based methods for adding and retrieving cached - * results, providing dependencies explicitly. - */ - //@{ - /** Method for adding a result to the cache, proving one - * dependency as a TaggedObject explicitly. - */ - void AddCachedResult1Dep(const T& result, - const TaggedObject* dependent1); - - /** Method for retrieving a cached result, proving one dependency - * as a TaggedObject explicitly. - */ - bool GetCachedResult1Dep(T& retResult, const TaggedObject* dependent1); - - /** Method for adding a result to the cache, proving two - * dependencies as a TaggedObject explicitly. - */ - void AddCachedResult2Dep(const T& result, - const TaggedObject* dependent1, - const TaggedObject* dependent2); - - /** Method for retrieving a cached result, proving two - * dependencies as a TaggedObject explicitly. - */ - bool GetCachedResult2Dep(T& retResult, - const TaggedObject* dependent1, - const TaggedObject* dependent2); - - /** Method for adding a result to the cache, proving three - * dependencies as a TaggedObject explicitly. - */ - void AddCachedResult3Dep(const T& result, - const TaggedObject* dependent1, - const TaggedObject* dependent2, - const TaggedObject* dependent3); - - /** Method for retrieving a cached result, proving three - * dependencies as a TaggedObject explicitly. - */ - bool GetCachedResult3Dep(T& retResult, - const TaggedObject* dependent1, - const TaggedObject* dependent2, - const TaggedObject* dependent3); - - /** @name Pointer-free version of the Add and Get methods */ - //@{ - bool GetCachedResult1Dep(T& retResult, const TaggedObject& dependent1) - { - return GetCachedResult1Dep(retResult, &dependent1); - } - bool GetCachedResult2Dep(T& retResult, - const TaggedObject& dependent1, - const TaggedObject& dependent2) - { - return GetCachedResult2Dep(retResult, &dependent1, &dependent2); - } - bool GetCachedResult3Dep(T& retResult, - const TaggedObject& dependent1, - const TaggedObject& dependent2, - const TaggedObject& dependent3) - { - return GetCachedResult3Dep(retResult, &dependent1, &dependent2, &dependent3); - } - void AddCachedResult1Dep(const T& result, - const TaggedObject& dependent1) - { - AddCachedResult1Dep(result, &dependent1); - } - void AddCachedResult2Dep(const T& result, - const TaggedObject& dependent1, - const TaggedObject& dependent2) - { - AddCachedResult2Dep(result, &dependent1, &dependent2); - } - void AddCachedResult3Dep(const T& result, - const TaggedObject& dependent1, - const TaggedObject& dependent2, - const TaggedObject& dependent3) - { - AddCachedResult3Dep(result, &dependent1, &dependent2, &dependent3); - } - //@} - - /** Invalidates the result for given dependecies. Sets the stale - * flag for the corresponding cached result to true if it is - * found. Returns true, if the result was found. */ - bool InvalidateResult(const std::vector& dependents, - const std::vector& scalar_dependents); - - /** Invalidates all cached results */ - void Clear(); - - /** Invalidate all cached results and changes max_cache_size */ - void Clear(Int max_cache_size); - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - CachedResults(); - - /** Copy Constructor */ - CachedResults(const CachedResults&); - - /** Overloaded Equals Operator */ - void operator=(const CachedResults&); - //@} - - /** maximum number of cached results */ - Int max_cache_size_; - - /** list of currently cached results. */ - mutable std::list*>* cached_results_; - - /** internal method for removing stale DependentResults from the - * list. It is called at the beginning of every - * GetDependentResult method. - */ - void CleanupInvalidatedResults() const; - - /** Print list of currently cached results */ - void DebugPrintCachedResults() const; - }; - - /** Templated class which stores one entry for the CachedResult - * class. It stores the result (of type T), together with its - * dependencies (vector of TaggedObjects and vector of Numbers). - * It also stores a priority. - */ - template - class DependentResult : public Observer - { - public: - -#ifdef IP_DEBUG_CACHE - - static const Index dbg_verbosity; -#endif - - /** @name Constructor, Destructors */ - //@{ - /** Constructor, given all information about the result. */ - DependentResult(const T& result, const std::vector& dependents, - const std::vector& scalar_dependents); - - /** Destructor. */ - ~DependentResult(); - //@} - - /** @name Accessor method. */ - //@{ - /** This returns true, if the DependentResult is no longer valid. */ - bool IsStale() const; - - /** Invalidates the cached result. */ - void Invalidate(); - - /** Returns the cached result. */ - const T& GetResult() const; - //@} - - /** This method returns true if the dependencies provided to this - * function are identical to the ones stored with the - * DependentResult. - */ - bool DependentsIdentical(const std::vector& dependents, - const std::vector& scalar_dependents) const; - - /** Print information about this DependentResults. */ - void DebugPrint() const; - - protected: - /** This method is overloading the pure virtual method from the - * Observer base class. This method is called when a Subject - * registered for this Observer sends a notification. In this - * particular case, if this method is called with - * notify_type==NT_Changed or NT_BeingDeleted, then this results - * is marked as stale. - */ - virtual void RecieveNotification(NotifyType notify_type, const Subject* subject); - - private: - - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - DependentResult(); - - /** Copy Constructor */ - DependentResult(const DependentResult&); - - /** Overloaded Equals Operator */ - void operator=(const DependentResult&); - //@} - - /** Flag indicating, if the cached result is still valid. A - result becomes invalid, if the RecieveNotification method is - called with NT_Changed */ - bool stale_; - /** The value of the dependent results */ - const T result_; - /** Dependencies in form of TaggedObjects */ - std::vector dependent_tags_; - /** Dependencies in form a Numbers */ - std::vector scalar_dependents_; - }; - -#ifdef IP_DEBUG_CACHE - - template - const Index CachedResults::dbg_verbosity = 0; - - template - const Index DependentResult::dbg_verbosity = 0; -#endif - - template - DependentResult::DependentResult( - const T& result, - const std::vector& dependents, - const std::vector& scalar_dependents) - : - stale_(false), - result_(result), - dependent_tags_(dependents.size()), - scalar_dependents_(scalar_dependents) - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("DependentResult::DependentResult()", dbg_verbosity); -#endif - - for (Index i=0; i<(Index)dependents.size(); i++) { - if (dependents[i]) { - // Call the RequestAttach method of the Observer base class. - // This will add this dependent result in the Observer list - // for the Subject dependents[i]. As a consequence, the - // RecieveNotification method of this DependentResult will be - // called with notify_type=NT_Changed, whenever the - // TaggedResult dependents[i] is changed (i.e. its HasChanged - // method is called). - RequestAttach(NT_Changed, dependents[i]); - dependent_tags_[i] = dependents[i]->GetTag(); - } - else { - dependent_tags_[i] = 0; - } - } - } - - template - DependentResult::~DependentResult() - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("DependentResult::~DependentResult()", dbg_verbosity); - //DBG_ASSERT(stale_ == true); -#endif - // Nothing to be done here, destructor - // of T should sufficiently remove - // any memory, etc. - } - - template - bool DependentResult::IsStale() const - { - return stale_; - } - - template - void DependentResult::Invalidate() - { - stale_ = true; - } - - template - void DependentResult::RecieveNotification(NotifyType notify_type, const Subject* subject) - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("DependentResult::RecieveNotification", dbg_verbosity); -#endif - - if (notify_type == NT_Changed || notify_type==NT_BeingDestroyed) { - stale_ = true; - // technically, I could unregister the notifications here, but they - // aren't really hurting anything - } - } - - template - bool DependentResult::DependentsIdentical(const std::vector& dependents, - const std::vector& scalar_dependents) const - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("DependentResult::DependentsIdentical", dbg_verbosity); - DBG_ASSERT(stale_ == false); - DBG_ASSERT(dependents.size() == dependent_tags_.size()); -#endif - - bool retVal = true; - - if (dependents.size() != dependent_tags_.size() - || scalar_dependents.size() != scalar_dependents_.size()) { - retVal = false; - } - else { - for (Index i=0; i<(Index)dependents.size(); i++) { - if ( (dependents[i] && dependents[i]->GetTag() != dependent_tags_[i]) - || (!dependents[i] && dependent_tags_[i] != 0) ) { - retVal = false; - break; - } - } - if (retVal) { - for (Index i=0; i<(Index)scalar_dependents.size(); i++) { - if (scalar_dependents[i] != scalar_dependents_[i]) { - retVal = false; - break; - } - } - } - } - - return retVal; - } - - template - const T& DependentResult::GetResult() const - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("DependentResult::GetResult()", dbg_verbosity); - DBG_ASSERT(stale_ == false); -#endif - - return result_; - } - - template - void DependentResult::DebugPrint() const - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("DependentResult::DebugPrint", dbg_verbosity); -#endif - - } - - template - CachedResults::CachedResults(Int max_cache_size) - : - max_cache_size_(max_cache_size), - cached_results_(NULL) - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("CachedResults::CachedResults", dbg_verbosity); -#endif - - } - - template - CachedResults::~CachedResults() - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("CachedResults::!CachedResults()", dbg_verbosity); -#endif - - if (cached_results_) { - for (typename std::list< DependentResult* >::iterator iter = cached_results_-> - begin(); - iter != cached_results_->end(); - iter++) { - delete *iter; - } - delete cached_results_; - } - /* - while (!cached_results_.empty()) { - DependentResult* result = cached_results_.back(); - cached_results_.pop_back(); - delete result; - } - */ - } - - template - void CachedResults::AddCachedResult(const T& result, - const std::vector& dependents, - const std::vector& scalar_dependents) - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("CachedResults::AddCachedResult", dbg_verbosity); -#endif - - CleanupInvalidatedResults(); - - // insert the new one here - DependentResult* newResult = new DependentResult(result, dependents, scalar_dependents); - if (!cached_results_) { - cached_results_ = new std::list*>; - } - cached_results_->push_front(newResult); - - // keep the list small enough - if (max_cache_size_ >= 0) { // if negative, allow infinite cache - // non-negative - limit size of list to max_cache_size - DBG_ASSERT((Int)cached_results_->size()<=max_cache_size_+1); - if ((Int)cached_results_->size() > max_cache_size_) { - delete cached_results_->back(); - cached_results_->pop_back(); - } - } - -#ifdef IP_DEBUG_CACHE - DBG_EXEC(2, DebugPrintCachedResults()); -#endif - - } - - template - void CachedResults::AddCachedResult(const T& result, - const std::vector& dependents) - { - std::vector scalar_dependents; - AddCachedResult(result, dependents, scalar_dependents); - } - - template - bool CachedResults::GetCachedResult(T& retResult, const std::vector& dependents, - const std::vector& scalar_dependents) const - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("CachedResults::GetCachedResult", dbg_verbosity); -#endif - - if (!cached_results_) - return false; - - CleanupInvalidatedResults(); - - bool retValue = false; - typename std::list< DependentResult* >::const_iterator iter; - for (iter = cached_results_->begin(); iter != cached_results_->end(); iter++) { - if ((*iter)->DependentsIdentical(dependents, scalar_dependents)) { - retResult = (*iter)->GetResult(); - retValue = true; - break; - } - } - -#ifdef IP_DEBUG_CACHE - DBG_EXEC(2, DebugPrintCachedResults()); -#endif - - return retValue; - } - - template - bool CachedResults::GetCachedResult( - T& retResult, const std::vector& dependents) const - { - std::vector scalar_dependents; - return GetCachedResult(retResult, dependents, scalar_dependents); - } - - template - void CachedResults::AddCachedResult1Dep(const T& result, - const TaggedObject* dependent1) - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("CachedResults::AddCachedResult1Dep", dbg_verbosity); -#endif - - std::vector dependents(1); - dependents[0] = dependent1; - - AddCachedResult(result, dependents); - } - - template - bool CachedResults::GetCachedResult1Dep(T& retResult, const TaggedObject* dependent1) - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("CachedResults::GetCachedResult1Dep", dbg_verbosity); -#endif - - std::vector dependents(1); - dependents[0] = dependent1; - - return GetCachedResult(retResult, dependents); - } - - template - void CachedResults::AddCachedResult2Dep(const T& result, const TaggedObject* dependent1, - const TaggedObject* dependent2) - - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("CachedResults::AddCachedResult2dDep", dbg_verbosity); -#endif - - std::vector dependents(2); - dependents[0] = dependent1; - dependents[1] = dependent2; - - AddCachedResult(result, dependents); - } - - template - bool CachedResults::GetCachedResult2Dep(T& retResult, const TaggedObject* dependent1, const TaggedObject* dependent2) - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("CachedResults::GetCachedResult2Dep", dbg_verbosity); -#endif - - std::vector dependents(2); - dependents[0] = dependent1; - dependents[1] = dependent2; - - return GetCachedResult(retResult, dependents); - } - - template - void CachedResults::AddCachedResult3Dep(const T& result, const TaggedObject* dependent1, - const TaggedObject* dependent2, - const TaggedObject* dependent3) - - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("CachedResults::AddCachedResult2dDep", dbg_verbosity); -#endif - - std::vector dependents(3); - dependents[0] = dependent1; - dependents[1] = dependent2; - dependents[2] = dependent3; - - AddCachedResult(result, dependents); - } - - template - bool CachedResults::GetCachedResult3Dep(T& retResult, const TaggedObject* dependent1, - const TaggedObject* dependent2, - const TaggedObject* dependent3) - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("CachedResults::GetCachedResult2Dep", dbg_verbosity); -#endif - - std::vector dependents(3); - dependents[0] = dependent1; - dependents[1] = dependent2; - dependents[2] = dependent3; - - return GetCachedResult(retResult, dependents); - } - - template - bool CachedResults::InvalidateResult(const std::vector& dependents, - const std::vector& scalar_dependents) - { - if (!cached_results_) - return false; - - CleanupInvalidatedResults(); - - bool retValue = false; - typename std::list< DependentResult* >::const_iterator iter; - for (iter = cached_results_->begin(); iter != cached_results_->end(); - iter++) { - if ((*iter)->DependentsIdentical(dependents, scalar_dependents)) { - (*iter)->Invalidate(); - retValue = true; - break; - } - } - - return retValue; - } - - template - void CachedResults::Clear() - { - if (!cached_results_) - return; - - typename std::list< DependentResult* >::const_iterator iter; - for (iter = cached_results_->begin(); iter != cached_results_->end(); - iter++) { - (*iter)->Invalidate(); - } - - CleanupInvalidatedResults(); - } - - template - void CachedResults::Clear(Int max_cache_size) - { - Clear(); - max_cache_size_ = max_cache_size; - } - - template - void CachedResults::CleanupInvalidatedResults() const - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("CachedResults::CleanupInvalidatedResults", dbg_verbosity); -#endif - - if (!cached_results_) - return; - - typename std::list< DependentResult* >::iterator iter; - iter = cached_results_->begin(); - while (iter != cached_results_->end()) { - if ((*iter)->IsStale()) { - typename std::list< DependentResult* >::iterator - iter_to_remove = iter; - iter++; - DependentResult* result_to_delete = (*iter_to_remove); - cached_results_->erase(iter_to_remove); - delete result_to_delete; - } - else { - iter++; - } - } - } - - template - void CachedResults::DebugPrintCachedResults() const - { -#ifdef IP_DEBUG_CACHE - DBG_START_METH("CachedResults::DebugPrintCachedResults", dbg_verbosity); - if (DBG_VERBOSITY()>=2 ) { - if (!chached_results_) { - DBG_PRINT((2," DependentResult:0x%x\n", (*iter))); - } - else { - typename std::list< DependentResult* >::const_iterator iter; - DBG_PRINT((2,"Current set of cached results:\n")); - for (iter = cached_results_->begin(); iter != cached_results_->end(); iter++) { - DBG_PRINT((2," DependentResult:0x%x\n", (*iter))); - } - } - } -#endif - - } - -} // namespace Ipopt - -#endif +// Copyright (C) 2004, 2011 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpCachedResults.hpp 2276 2013-05-05 12:33:44Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPCACHEDRESULTS_HPP__ +#define __IPCACHEDRESULTS_HPP__ + +#include "IpTaggedObject.hpp" +#include "IpObserver.hpp" +#include +#include +#include + +namespace Ipopt +{ + +#if COIN_IPOPT_CHECKLEVEL > 2 +# define IP_DEBUG_CACHE +#endif +#ifdef IP_DEBUG_CACHE +# include "IpDebug.hpp" +#endif + + // Forward Declarations + + template + class DependentResult; + + // AW: I'm taking this out, since this is by far the most used + // class. We should keep it as simple as possible. + // /** Cache Priority Enum */ + // enum CachePriority + // { + // CP_Lowest, + // CP_Standard, + // CP_Trial, + // CP_Iterate + // }; + + /** Templated class for Cached Results. This class stores up to a + * given number of "results", entities that are stored here + * together with identifiers, that can be used to later retrieve the + * information again. + * + * Typically, T is a SmartPtr for some calculated quantity that + * should be stored (such as a Vector). The identifiers (or + * dependencies) are a (possibly varying) number of Tags from + * TaggedObjects, and a number of Numbers. Results are added to + * the cache using the AddCachedResults methods, and the can be + * retrieved with the GetCachedResults methods. The second set of + * methods checks whether a result has been cached for the given + * identifiers. If a corresponding result is found, a copy of it + * is returned and the method evaluates to true, otherwise it + * evaluates to false. + * + * Note that cached results can become "stale", namely when a + * TaggedObject that is used to identify this CachedResult is + * changed. When this happens, the cached result can never be + * asked for again, so that there is no point in storing it any + * longer. For this purpose, a cached result, which is stored as a + * DependentResult, inherits off an Observer. This Observer + * retrieves notification whenever a TaggedObject dependency has + * changed. Stale results are later removed from the cache. + */ + template + class CachedResults + { + public: +#ifdef IP_DEBUG_CACHE + /** (Only if compiled in DEBUG mode): debug verbosity level */ + static const Index dbg_verbosity; +#endif + + /** @name Constructors and Destructors. */ + //@{ + /** Constructor, where max_cache_size is the maximal number of + * results that should be cached. If max_cache_size is negative, + * we allow an infinite amount of cache. + */ + CachedResults(Int max_cache_size); + + /** Destructor */ + virtual ~CachedResults(); + //@} + + /** @name Generic methods for adding and retrieving cached results. */ + //@{ + /** Generic method for adding a result to the cache, given a + * std::vector of TaggesObjects and a std::vector of Numbers. + */ + void AddCachedResult(const T& result, + const std::vector& dependents, + const std::vector& scalar_dependents); + + /** Generic method for retrieving a cached results, given the + * dependencies as a std::vector of TaggesObjects and a + * std::vector of Numbers. + */ + bool GetCachedResult(T& retResult, + const std::vector& dependents, + const std::vector& scalar_dependents) const; + + /** Method for adding a result, providing only a std::vector of + * TaggedObjects. + */ + void AddCachedResult(const T& result, + const std::vector& dependents); + + /** Method for retrieving a cached result, providing only a + * std::vector of TaggedObjects. + */ + bool GetCachedResult(T& retResult, + const std::vector& dependents) const; + //@} + + /** @name Pointer-based methods for adding and retrieving cached + * results, providing dependencies explicitly. + */ + //@{ + /** Method for adding a result to the cache, proving one + * dependency as a TaggedObject explicitly. + */ + void AddCachedResult1Dep(const T& result, + const TaggedObject* dependent1); + + /** Method for retrieving a cached result, proving one dependency + * as a TaggedObject explicitly. + */ + bool GetCachedResult1Dep(T& retResult, const TaggedObject* dependent1); + + /** Method for adding a result to the cache, proving two + * dependencies as a TaggedObject explicitly. + */ + void AddCachedResult2Dep(const T& result, + const TaggedObject* dependent1, + const TaggedObject* dependent2); + + /** Method for retrieving a cached result, proving two + * dependencies as a TaggedObject explicitly. + */ + bool GetCachedResult2Dep(T& retResult, + const TaggedObject* dependent1, + const TaggedObject* dependent2); + + /** Method for adding a result to the cache, proving three + * dependencies as a TaggedObject explicitly. + */ + void AddCachedResult3Dep(const T& result, + const TaggedObject* dependent1, + const TaggedObject* dependent2, + const TaggedObject* dependent3); + + /** Method for retrieving a cached result, proving three + * dependencies as a TaggedObject explicitly. + */ + bool GetCachedResult3Dep(T& retResult, + const TaggedObject* dependent1, + const TaggedObject* dependent2, + const TaggedObject* dependent3); + + /** @name Pointer-free version of the Add and Get methods */ + //@{ + bool GetCachedResult1Dep(T& retResult, const TaggedObject& dependent1) + { + return GetCachedResult1Dep(retResult, &dependent1); + } + bool GetCachedResult2Dep(T& retResult, + const TaggedObject& dependent1, + const TaggedObject& dependent2) + { + return GetCachedResult2Dep(retResult, &dependent1, &dependent2); + } + bool GetCachedResult3Dep(T& retResult, + const TaggedObject& dependent1, + const TaggedObject& dependent2, + const TaggedObject& dependent3) + { + return GetCachedResult3Dep(retResult, &dependent1, &dependent2, &dependent3); + } + void AddCachedResult1Dep(const T& result, + const TaggedObject& dependent1) + { + AddCachedResult1Dep(result, &dependent1); + } + void AddCachedResult2Dep(const T& result, + const TaggedObject& dependent1, + const TaggedObject& dependent2) + { + AddCachedResult2Dep(result, &dependent1, &dependent2); + } + void AddCachedResult3Dep(const T& result, + const TaggedObject& dependent1, + const TaggedObject& dependent2, + const TaggedObject& dependent3) + { + AddCachedResult3Dep(result, &dependent1, &dependent2, &dependent3); + } + //@} + + /** Invalidates the result for given dependencies. Sets the stale + * flag for the corresponding cached result to true if it is + * found. Returns true, if the result was found. */ + bool InvalidateResult(const std::vector& dependents, + const std::vector& scalar_dependents); + + /** Invalidates all cached results */ + void Clear(); + + /** Invalidate all cached results and changes max_cache_size */ + void Clear(Int max_cache_size); + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + CachedResults(); + + /** Copy Constructor */ + CachedResults(const CachedResults&); + + /** Overloaded Equals Operator */ + void operator=(const CachedResults&); + //@} + + /** maximum number of cached results */ + Int max_cache_size_; + + /** list of currently cached results. */ + mutable std::list*>* cached_results_; + + /** internal method for removing stale DependentResults from the + * list. It is called at the beginning of every + * GetDependentResult method. + */ + void CleanupInvalidatedResults() const; + + /** Print list of currently cached results */ + void DebugPrintCachedResults() const; + }; + + /** Templated class which stores one entry for the CachedResult + * class. It stores the result (of type T), together with its + * dependencies (vector of TaggedObjects and vector of Numbers). + * It also stores a priority. + */ + template + class DependentResult : public Observer + { + public: + +#ifdef IP_DEBUG_CACHE + static const Index dbg_verbosity; +#endif + + /** @name Constructor, Destructors */ + //@{ + /** Constructor, given all information about the result. */ + DependentResult(const T& result, const std::vector& dependents, + const std::vector& scalar_dependents); + + /** Destructor. */ + ~DependentResult(); + //@} + + /** @name Accessor method. */ + //@{ + /** This returns true, if the DependentResult is no longer valid. */ + bool IsStale() const; + + /** Invalidates the cached result. */ + void Invalidate(); + + /** Returns the cached result. */ + const T& GetResult() const; + //@} + + /** This method returns true if the dependencies provided to this + * function are identical to the ones stored with the + * DependentResult. + */ + bool DependentsIdentical(const std::vector& dependents, + const std::vector& scalar_dependents) const; + + /** Print information about this DependentResults. */ + void DebugPrint() const; + + protected: + /** This method is overloading the pure virtual method from the + * Observer base class. This method is called when a Subject + * registered for this Observer sends a notification. In this + * particular case, if this method is called with + * notify_type==NT_Changed or NT_BeingDeleted, then this results + * is marked as stale. + */ + virtual void RecieveNotification(NotifyType notify_type, const Subject* subject); + + private: + + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + DependentResult(); + + /** Copy Constructor */ + DependentResult(const DependentResult&); + + /** Overloaded Equals Operator */ + void operator=(const DependentResult&); + //@} + + /** Flag indicating, if the cached result is still valid. A + result becomes invalid, if the RecieveNotification method is + called with NT_Changed */ + bool stale_; + /** The value of the dependent results */ + const T result_; + /** Dependencies in form of TaggedObjects */ + std::vector dependent_tags_; + /** Dependencies in form a Numbers */ + std::vector scalar_dependents_; + }; + +#ifdef IP_DEBUG_CACHE + template + const Index CachedResults::dbg_verbosity = 0; + + template + const Index DependentResult::dbg_verbosity = 0; +#endif + + template + DependentResult::DependentResult( + const T& result, + const std::vector& dependents, + const std::vector& scalar_dependents) + : + stale_(false), + result_(result), + dependent_tags_(dependents.size()), + scalar_dependents_(scalar_dependents) + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("DependentResult::DependentResult()", dbg_verbosity); +#endif + + for (Index i=0; i<(Index)dependents.size(); i++) { + if (dependents[i]) { + // Call the RequestAttach method of the Observer base class. + // This will add this dependent result in the Observer list + // for the Subject dependents[i]. As a consequence, the + // RecieveNotification method of this DependentResult will be + // called with notify_type=NT_Changed, whenever the + // TaggedResult dependents[i] is changed (i.e. its HasChanged + // method is called). + RequestAttach(NT_Changed, dependents[i]); + dependent_tags_[i] = dependents[i]->GetTag(); + } + else { + dependent_tags_[i] = TaggedObject::Tag(); + } + } + } + + template + DependentResult::~DependentResult() + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("DependentResult::~DependentResult()", dbg_verbosity); + //DBG_ASSERT(stale_ == true); +#endif + // Nothing to be done here, destructor + // of T should sufficiently remove + // any memory, etc. + } + + template + bool DependentResult::IsStale() const + { + return stale_; + } + + template + void DependentResult::Invalidate() + { + stale_ = true; + } + + template + void DependentResult::RecieveNotification(NotifyType notify_type, const Subject* subject) + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("DependentResult::RecieveNotification", dbg_verbosity); +#endif + + if (notify_type == NT_Changed || notify_type==NT_BeingDestroyed) { + stale_ = true; + // technically, I could unregister the notifications here, but they + // aren't really hurting anything + } + } + + template + bool DependentResult::DependentsIdentical(const std::vector& dependents, + const std::vector& scalar_dependents) const + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("DependentResult::DependentsIdentical", dbg_verbosity); + DBG_ASSERT(stale_ == false); + DBG_ASSERT(dependents.size() == dependent_tags_.size()); +#endif + + bool retVal = true; + + if (dependents.size() != dependent_tags_.size() + || scalar_dependents.size() != scalar_dependents_.size()) { + retVal = false; + } + else { + for (Index i=0; i<(Index)dependents.size(); i++) { + if ( (dependents[i] && dependents[i]->GetTag() != dependent_tags_[i]) + || (!dependents[i] && dependent_tags_[i] != TaggedObject::Tag()) ) { + retVal = false; + break; + } + } + if (retVal) { + for (Index i=0; i<(Index)scalar_dependents.size(); i++) { + if (scalar_dependents[i] != scalar_dependents_[i]) { + retVal = false; + break; + } + } + } + } + + return retVal; + } + + template + const T& DependentResult::GetResult() const + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("DependentResult::GetResult()", dbg_verbosity); + DBG_ASSERT(stale_ == false); +#endif + + return result_; + } + + template + void DependentResult::DebugPrint() const + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("DependentResult::DebugPrint", dbg_verbosity); +#endif + + } + + template + CachedResults::CachedResults(Int max_cache_size) + : + max_cache_size_(max_cache_size), + cached_results_(NULL) + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("CachedResults::CachedResults", dbg_verbosity); +#endif + + } + + template + CachedResults::~CachedResults() + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("CachedResults::!CachedResults()", dbg_verbosity); +#endif + + if (cached_results_) { + for (typename std::list< DependentResult* >::iterator iter = cached_results_-> + begin(); + iter != cached_results_->end(); + iter++) { + delete *iter; + } + delete cached_results_; + } + /* + while (!cached_results_.empty()) { + DependentResult* result = cached_results_.back(); + cached_results_.pop_back(); + delete result; + } + */ + } + + template + void CachedResults::AddCachedResult(const T& result, + const std::vector& dependents, + const std::vector& scalar_dependents) + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("CachedResults::AddCachedResult", dbg_verbosity); +#endif + + CleanupInvalidatedResults(); + + // insert the new one here + DependentResult* newResult = new DependentResult(result, dependents, scalar_dependents); + if (!cached_results_) { + cached_results_ = new std::list*>; + } + cached_results_->push_front(newResult); + + // keep the list small enough + if (max_cache_size_ >= 0) { // if negative, allow infinite cache + // non-negative - limit size of list to max_cache_size + DBG_ASSERT((Int)cached_results_->size()<=max_cache_size_+1); + if ((Int)cached_results_->size() > max_cache_size_) { + delete cached_results_->back(); + cached_results_->pop_back(); + } + } + +#ifdef IP_DEBUG_CACHE + DBG_EXEC(2, DebugPrintCachedResults()); +#endif + + } + + template + void CachedResults::AddCachedResult(const T& result, + const std::vector& dependents) + { + std::vector scalar_dependents; + AddCachedResult(result, dependents, scalar_dependents); + } + + template + bool CachedResults::GetCachedResult(T& retResult, const std::vector& dependents, + const std::vector& scalar_dependents) const + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("CachedResults::GetCachedResult", dbg_verbosity); +#endif + + if (!cached_results_) + return false; + + CleanupInvalidatedResults(); + + bool retValue = false; + typename std::list< DependentResult* >::const_iterator iter; + for (iter = cached_results_->begin(); iter != cached_results_->end(); iter++) { + if ((*iter)->DependentsIdentical(dependents, scalar_dependents)) { + retResult = (*iter)->GetResult(); + retValue = true; + break; + } + } + +#ifdef IP_DEBUG_CACHE + DBG_EXEC(2, DebugPrintCachedResults()); +#endif + + return retValue; + } + + template + bool CachedResults::GetCachedResult( + T& retResult, const std::vector& dependents) const + { + std::vector scalar_dependents; + return GetCachedResult(retResult, dependents, scalar_dependents); + } + + template + void CachedResults::AddCachedResult1Dep(const T& result, + const TaggedObject* dependent1) + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("CachedResults::AddCachedResult1Dep", dbg_verbosity); +#endif + + std::vector dependents(1); + dependents[0] = dependent1; + + AddCachedResult(result, dependents); + } + + template + bool CachedResults::GetCachedResult1Dep(T& retResult, const TaggedObject* dependent1) + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("CachedResults::GetCachedResult1Dep", dbg_verbosity); +#endif + + std::vector dependents(1); + dependents[0] = dependent1; + + return GetCachedResult(retResult, dependents); + } + + template + void CachedResults::AddCachedResult2Dep(const T& result, const TaggedObject* dependent1, + const TaggedObject* dependent2) + + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("CachedResults::AddCachedResult2dDep", dbg_verbosity); +#endif + + std::vector dependents(2); + dependents[0] = dependent1; + dependents[1] = dependent2; + + AddCachedResult(result, dependents); + } + + template + bool CachedResults::GetCachedResult2Dep(T& retResult, const TaggedObject* dependent1, const TaggedObject* dependent2) + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("CachedResults::GetCachedResult2Dep", dbg_verbosity); +#endif + + std::vector dependents(2); + dependents[0] = dependent1; + dependents[1] = dependent2; + + return GetCachedResult(retResult, dependents); + } + + template + void CachedResults::AddCachedResult3Dep(const T& result, const TaggedObject* dependent1, + const TaggedObject* dependent2, + const TaggedObject* dependent3) + + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("CachedResults::AddCachedResult2dDep", dbg_verbosity); +#endif + + std::vector dependents(3); + dependents[0] = dependent1; + dependents[1] = dependent2; + dependents[2] = dependent3; + + AddCachedResult(result, dependents); + } + + template + bool CachedResults::GetCachedResult3Dep(T& retResult, const TaggedObject* dependent1, + const TaggedObject* dependent2, + const TaggedObject* dependent3) + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("CachedResults::GetCachedResult2Dep", dbg_verbosity); +#endif + + std::vector dependents(3); + dependents[0] = dependent1; + dependents[1] = dependent2; + dependents[2] = dependent3; + + return GetCachedResult(retResult, dependents); + } + + template + bool CachedResults::InvalidateResult(const std::vector& dependents, + const std::vector& scalar_dependents) + { + if (!cached_results_) + return false; + + CleanupInvalidatedResults(); + + bool retValue = false; + typename std::list< DependentResult* >::const_iterator iter; + for (iter = cached_results_->begin(); iter != cached_results_->end(); + iter++) { + if ((*iter)->DependentsIdentical(dependents, scalar_dependents)) { + (*iter)->Invalidate(); + retValue = true; + break; + } + } + + return retValue; + } + + template + void CachedResults::Clear() + { + if (!cached_results_) + return; + + typename std::list< DependentResult* >::const_iterator iter; + for (iter = cached_results_->begin(); iter != cached_results_->end(); + iter++) { + (*iter)->Invalidate(); + } + + CleanupInvalidatedResults(); + } + + template + void CachedResults::Clear(Int max_cache_size) + { + Clear(); + max_cache_size_ = max_cache_size; + } + + template + void CachedResults::CleanupInvalidatedResults() const + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("CachedResults::CleanupInvalidatedResults", dbg_verbosity); +#endif + + if (!cached_results_) + return; + + typename std::list< DependentResult* >::iterator iter; + iter = cached_results_->begin(); + while (iter != cached_results_->end()) { + if ((*iter)->IsStale()) { + typename std::list< DependentResult* >::iterator + iter_to_remove = iter; + iter++; + DependentResult* result_to_delete = (*iter_to_remove); + cached_results_->erase(iter_to_remove); + delete result_to_delete; + } + else { + iter++; + } + } + } + + template + void CachedResults::DebugPrintCachedResults() const + { +#ifdef IP_DEBUG_CACHE + DBG_START_METH("CachedResults::DebugPrintCachedResults", dbg_verbosity); + if (DBG_VERBOSITY()>=2 ) { + if (!cached_results_) { + DBG_PRINT((2,"Currentlt no cached results:\n")); + } + else { + typename std::list< DependentResult* >::const_iterator iter; + DBG_PRINT((2,"Current set of cached results:\n")); + for (iter = cached_results_->begin(); iter != cached_results_->end(); iter++) { + DBG_PRINT((2," DependentResult:0x%x\n", (*iter))); + } + } + } +#endif + + } + +} // namespace Ipopt + +#endif diff --git a/thirdparty/windows/include/coin/IpDebug.hpp b/thirdparty/windows/include/coin/IpDebug.hpp index 9716f5d..f117c89 100644 --- a/thirdparty/windows/include/coin/IpDebug.hpp +++ b/thirdparty/windows/include/coin/IpDebug.hpp @@ -1,142 +1,150 @@ -// Copyright (C) 2004, 2007 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpDebug.hpp 1000 2007-06-16 06:52:34Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPDEBUG_HPP__ -#define __IPDEBUG_HPP__ - -#include "IpoptConfig.h" -#include "IpTypes.hpp" - -#ifdef HAVE_CASSERT -# include -#else -# ifdef HAVE_ASSERT_H -# include -# else -# error "don't have header file for assert" -# endif -#endif - -#if COIN_IPOPT_CHECKLEVEL > 0 -# ifdef NDEBUG -# undef NDEBUG -# endif -# define DBG_ASSERT(test) assert(test) -# define DBG_ASSERT_EXCEPTION(__condition, __except_type, __msg) \ - ASSERT_EXCEPTION( (__condition), __except_type, __msg); -# define DBG_DO(__cmd) __cmd -#else -# define DBG_ASSERT(test) -# define DBG_ASSERT_EXCEPTION(__condition, __except_type, __msg) -# define DBG_DO(__cmd) -#endif - -#if COIN_IPOPT_VERBOSITY < 1 -# define DBG_START_FUN(__func_name, __verbose_level) -# define DBG_START_METH(__func_name, __verbose_level) -# define DBG_PRINT(__printf_args) -# define DBG_PRINT_VECTOR(__verbose_level, __vec_name, __vec) -# define DBG_PRINT_MATRIX(__verbose_level, __mat_name, __mat) -# define DBG_EXEC(__verbosity, __cmd) -# define DBG_VERBOSITY() 0 -#else -#include - -namespace Ipopt -{ - // forward definition - class Journalist; - - /** Class that lives throughout the execution of a method or - * function for which debug output is to be generated. The output - * is sent to the unique debug journalist that is set with - * SetJournalist at the beginning of program execution. */ - class DebugJournalistWrapper - { - public: - /** @name Constructors/Destructors. */ - //@{ - DebugJournalistWrapper(std::string func_name, Index verbose_level); - DebugJournalistWrapper(std::string func_name, Index verbose_level, - const void* const method_owner); - ~DebugJournalistWrapper(); - //@} - - /** @name accessor methods */ - //@{ - Index Verbosity() - { - return verbose_level_; - } - const Journalist* Jnlst() - { - return jrnl_; - } - Index IndentationLevel() - { - return indentation_level_; - } - //@} - - /** Printing */ - void DebugPrintf(Index verbosity, const char* pformat, ...); - - /* Method for initialization of the static GLOBAL journalist, - * through with all debug printout is to be written. This needs - * to be set before any debug printout can be done. */ - static void SetJournalist(Journalist* jrnl); - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** default constructor */ - DebugJournalistWrapper(); - - /** copy contructor */ - DebugJournalistWrapper(const DebugJournalistWrapper&); - - /** Overloaded Equals Operator */ - DebugJournalistWrapper& operator=(const DebugJournalistWrapper&); - //@} - - static Index indentation_level_; - std::string func_name_; - Index verbose_level_; - const void* method_owner_; - - static Journalist* jrnl_; - }; -} - -# define DBG_START_FUN(__func_name, __verbose_level) \ - DebugJournalistWrapper dbg_jrnl((__func_name), (__verbose_level)); \ - -# define DBG_START_METH(__func_name, __verbose_level) \ - DebugJournalistWrapper dbg_jrnl((__func_name), (__verbose_level), this); - -# define DBG_PRINT(__args) \ - dbg_jrnl.DebugPrintf __args; - -# define DBG_EXEC(__verbose_level, __cmd) \ - if (dbg_jrnl.Verbosity() >= (__verbose_level)) { \ - (__cmd); \ - } - -# define DBG_VERBOSITY() \ - dbg_jrnl.Verbosity() - -#endif - - -#endif +// Copyright (C) 2004, 2007 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpDebug.hpp 2005 2011-06-06 12:55:16Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPDEBUG_HPP__ +#define __IPDEBUG_HPP__ + +#include "IpoptConfig.h" +#include "IpTypes.hpp" + +#ifdef COIN_IPOPT_CHECKLEVEL +#ifdef HAVE_CASSERT +# include +#else +# ifdef HAVE_ASSERT_H +# include +# else +# error "don't have header file for assert" +# endif +#endif +#else +#define COIN_IPOPT_CHECKLEVEL 0 +#endif + +#if COIN_IPOPT_CHECKLEVEL > 0 +# ifdef NDEBUG +# undef NDEBUG +# endif +# define DBG_ASSERT(test) assert(test) +# define DBG_ASSERT_EXCEPTION(__condition, __except_type, __msg) \ + ASSERT_EXCEPTION( (__condition), __except_type, __msg); +# define DBG_DO(__cmd) __cmd +#else +# define DBG_ASSERT(test) +# define DBG_ASSERT_EXCEPTION(__condition, __except_type, __msg) +# define DBG_DO(__cmd) +#endif + +#ifndef COIN_IPOPT_VERBOSITY +#define COIN_IPOPT_VERBOSITY 0 +#endif + +#if COIN_IPOPT_VERBOSITY < 1 +# define DBG_START_FUN(__func_name, __verbose_level) +# define DBG_START_METH(__func_name, __verbose_level) +# define DBG_PRINT(__printf_args) +# define DBG_PRINT_VECTOR(__verbose_level, __vec_name, __vec) +# define DBG_PRINT_MATRIX(__verbose_level, __mat_name, __mat) +# define DBG_EXEC(__verbosity, __cmd) +# define DBG_VERBOSITY() 0 +#else +#include + +namespace Ipopt +{ + // forward definition + class Journalist; + + /** Class that lives throughout the execution of a method or + * function for which debug output is to be generated. The output + * is sent to the unique debug journalist that is set with + * SetJournalist at the beginning of program execution. */ + class DebugJournalistWrapper + { + public: + /** @name Constructors/Destructors. */ + //@{ + DebugJournalistWrapper(std::string func_name, Index verbose_level); + DebugJournalistWrapper(std::string func_name, Index verbose_level, + const void* const method_owner); + ~DebugJournalistWrapper(); + //@} + + /** @name accessor methods */ + //@{ + Index Verbosity() + { + return verbose_level_; + } + const Journalist* Jnlst() + { + return jrnl_; + } + Index IndentationLevel() + { + return indentation_level_; + } + //@} + + /** Printing */ + void DebugPrintf(Index verbosity, const char* pformat, ...); + + /* Method for initialization of the static GLOBAL journalist, + * through with all debug printout is to be written. This needs + * to be set before any debug printout can be done. */ + static void SetJournalist(Journalist* jrnl); + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** default constructor */ + DebugJournalistWrapper(); + + /** copy contructor */ + DebugJournalistWrapper(const DebugJournalistWrapper&); + + /** Overloaded Equals Operator */ + DebugJournalistWrapper& operator=(const DebugJournalistWrapper&); + //@} + + static Index indentation_level_; + std::string func_name_; + Index verbose_level_; + const void* method_owner_; + + static Journalist* jrnl_; + }; +} + +# define DBG_START_FUN(__func_name, __verbose_level) \ + DebugJournalistWrapper dbg_jrnl((__func_name), (__verbose_level)); \ + +# define DBG_START_METH(__func_name, __verbose_level) \ + DebugJournalistWrapper dbg_jrnl((__func_name), (__verbose_level), this); + +# define DBG_PRINT(__args) \ + dbg_jrnl.DebugPrintf __args; + +# define DBG_EXEC(__verbose_level, __cmd) \ + if (dbg_jrnl.Verbosity() >= (__verbose_level)) { \ + (__cmd); \ + } + +# define DBG_VERBOSITY() \ + dbg_jrnl.Verbosity() + +#endif + + +#endif diff --git a/thirdparty/windows/include/coin/IpException.hpp b/thirdparty/windows/include/coin/IpException.hpp index d5fd944..7832a73 100644 --- a/thirdparty/windows/include/coin/IpException.hpp +++ b/thirdparty/windows/include/coin/IpException.hpp @@ -1,147 +1,147 @@ -// Copyright (C) 2004, 2006 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpException.hpp 1019 2007-06-24 03:52:34Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPEXCEPTION_HPP__ -#define __IPEXCEPTION_HPP__ - -#include "IpUtils.hpp" -#include "IpJournalist.hpp" - -/* This file contains a base class for all exceptions - * and a set of macros to help with exceptions - */ - -namespace Ipopt -{ - - /** This is the base class for all exceptions. The easiest way to - * use this class is by means of the following macros: - * - * \verbatim - - DECLARE_STD_EXCEPTION(ExceptionType); - \endverbatim - * - * This macro defines a new class with the name ExceptionType, - * inherited from the base class IpoptException. After this, - * exceptions of this type can be thrown using - * - * \verbatim - - THROW_EXCEPTION(ExceptionType, Message); - \endverbatim - * - * where Message is a std::string with a message that gives an - * indication of what caused the exception. Exceptions can also be - * thrown using the macro - * - * \verbatim - - ASSERT_EXCEPTION(Condition, ExceptionType, Message); - \endverbatim - * - * where Conditions is an expression. If Condition evaluates to - * false, then the exception of the type ExceptionType is thrown - * with Message. - * - * When an exception is caught, the method ReportException can be - * used to write the information about the exception to the - * Journalist, using the level J_ERROR and the category J_MAIN. - * - */ - class IpoptException - { - public: - /**@name Constructors/Destructors */ - //@{ - /** Constructor */ - IpoptException(std::string msg, std::string file_name, Index line_number, std::string type="IpoptException") - : - msg_(msg), - file_name_(file_name), - line_number_(line_number), - type_(type) - {} - - /** Copy Constructor */ - IpoptException(const IpoptException& copy) - : - msg_(copy.msg_), - file_name_(copy.file_name_), - line_number_(copy.line_number_), - type_(copy.type_) - {} - - /** Default destructor */ - virtual ~IpoptException() - {} - //@} - - /** Method to report the exception to a journalist */ - void ReportException(const Journalist& jnlst, - EJournalLevel level = J_ERROR) const - { - jnlst.Printf(level, J_MAIN, - "Exception of type: %s in file \"%s\" at line %d:\n Exception message: %s\n", - type_.c_str(), file_name_.c_str(), line_number_, msg_.c_str()); - } - - const std::string& Message() const - { - return msg_; - } - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - IpoptException(); - - /** Overloaded Equals Operator */ - void operator=(const IpoptException&); - //@} - - std::string msg_; - std::string file_name_; - Index line_number_; - std::string type_; - }; - -#define THROW_EXCEPTION(__except_type, __msg) \ - throw __except_type( (__msg), (__FILE__), (__LINE__) ); - -#define ASSERT_EXCEPTION(__condition, __except_type, __msg) \ - if (! (__condition) ) { \ - std::string newmsg = #__condition; \ - newmsg += " evaluated false: "; \ - newmsg += __msg; \ - throw __except_type( (newmsg), (__FILE__), (__LINE__) ); \ - } - -#define DECLARE_STD_EXCEPTION(__except_type) \ - class __except_type : public IpoptException \ - { \ - public: \ - __except_type(std::string msg, std::string fname, Index line) \ - : IpoptException(msg,fname,line, #__except_type) {} \ - __except_type(const __except_type& copy) \ - : IpoptException(copy) {} \ - private: \ - __except_type(); \ - void operator=(const __except_type&); \ - } - -} // namespace Ipopt - -#endif +// Copyright (C) 2004, 2006 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpException.hpp 2023 2011-06-18 18:49:49Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPEXCEPTION_HPP__ +#define __IPEXCEPTION_HPP__ + +#include "IpUtils.hpp" +#include "IpJournalist.hpp" + +/* This file contains a base class for all exceptions + * and a set of macros to help with exceptions + */ + +namespace Ipopt +{ + + /** This is the base class for all exceptions. The easiest way to + * use this class is by means of the following macros: + * + * \verbatim + + DECLARE_STD_EXCEPTION(ExceptionType); + \endverbatim + * + * This macro defines a new class with the name ExceptionType, + * inherited from the base class IpoptException. After this, + * exceptions of this type can be thrown using + * + * \verbatim + + THROW_EXCEPTION(ExceptionType, Message); + \endverbatim + * + * where Message is a std::string with a message that gives an + * indication of what caused the exception. Exceptions can also be + * thrown using the macro + * + * \verbatim + + ASSERT_EXCEPTION(Condition, ExceptionType, Message); + \endverbatim + * + * where Conditions is an expression. If Condition evaluates to + * false, then the exception of the type ExceptionType is thrown + * with Message. + * + * When an exception is caught, the method ReportException can be + * used to write the information about the exception to the + * Journalist, using the level J_ERROR and the category J_MAIN. + * + */ + class IpoptException + { + public: + /**@name Constructors/Destructors */ + //@{ + /** Constructor */ + IpoptException(std::string msg, std::string file_name, Index line_number, std::string type="IpoptException") + : + msg_(msg), + file_name_(file_name), + line_number_(line_number), + type_(type) + {} + + /** Copy Constructor */ + IpoptException(const IpoptException& copy) + : + msg_(copy.msg_), + file_name_(copy.file_name_), + line_number_(copy.line_number_), + type_(copy.type_) + {} + + /** Default destructor */ + virtual ~IpoptException() + {} + //@} + + /** Method to report the exception to a journalist */ + void ReportException(const Journalist& jnlst, + EJournalLevel level = J_ERROR) const + { + jnlst.Printf(level, J_MAIN, + "Exception of type: %s in file \"%s\" at line %d:\n Exception message: %s\n", + type_.c_str(), file_name_.c_str(), line_number_, msg_.c_str()); + } + + const std::string& Message() const + { + return msg_; + } + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + IpoptException(); + + /** Overloaded Equals Operator */ + void operator=(const IpoptException&); + //@} + + std::string msg_; + std::string file_name_; + Index line_number_; + std::string type_; + }; + +} // namespace Ipopt + +#define THROW_EXCEPTION(__except_type, __msg) \ + throw __except_type( (__msg), (__FILE__), (__LINE__) ); + +#define ASSERT_EXCEPTION(__condition, __except_type, __msg) \ + if (! (__condition) ) { \ + std::string newmsg = #__condition; \ + newmsg += " evaluated false: "; \ + newmsg += __msg; \ + throw __except_type( (newmsg), (__FILE__), (__LINE__) ); \ + } + +#define DECLARE_STD_EXCEPTION(__except_type) \ + class __except_type : public Ipopt::IpoptException \ + { \ + public: \ + __except_type(std::string msg, std::string fname, Ipopt::Index line) \ + : Ipopt::IpoptException(msg,fname,line, #__except_type) {} \ + __except_type(const __except_type& copy) \ + : Ipopt::IpoptException(copy) {} \ + private: \ + __except_type(); \ + void operator=(const __except_type&); \ + } + +#endif diff --git a/thirdparty/windows/include/coin/IpIpoptApplication.hpp b/thirdparty/windows/include/coin/IpIpoptApplication.hpp index d2bcf27..6729c7a 100644 --- a/thirdparty/windows/include/coin/IpIpoptApplication.hpp +++ b/thirdparty/windows/include/coin/IpIpoptApplication.hpp @@ -1,240 +1,243 @@ -// Copyright (C) 2004, 2009 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpIpoptApplication.hpp 1587 2009-10-27 16:09:21Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPIPOPTAPPLICATION_HPP__ -#define __IPIPOPTAPPLICATION_HPP__ - -#ifndef IPOPT_EXPORT -#ifdef _MSC_VER -#ifdef IPOPT_DLL -#define IPOPT_EXPORT(type) __declspec(dllexport) type __cdecl -#else -#define IPOPT_EXPORT(type) type __cdecl -#endif -#else -#define IPOPT_EXPORT(type) type -#endif -#endif - -#include - -#include "IpJournalist.hpp" -#include "IpTNLP.hpp" -#include "IpNLP.hpp" -/* Return codes for the Optimize call for an application */ -#include "IpReturnCodes.hpp" - -namespace Ipopt -{ - DECLARE_STD_EXCEPTION(IPOPT_APPLICATION_ERROR); - - /* forward declarations */ - class IpoptAlgorithm; - class IpoptNLP; - class IpoptData; - class IpoptCalculatedQuantities; - class AlgorithmBuilder; - class RegisteredOptions; - class OptionsList; - class SolveStatistics; - - /** This is the main application class for making calls to Ipopt. */ - class IpoptApplication : public ReferencedObject - { - public: - IpoptApplication(bool create_console_out = true, - bool create_empty = false); - - /** Another constructor that assumes that the code in the - * (default) constructor has already been executed */ - IpoptApplication(SmartPtr reg_options, - SmartPtr options, - SmartPtr jnlst); - - virtual ~IpoptApplication(); - - /** Method for creating a new IpoptApplication that uses the same - * journalist and registered options, and a copy of the options - list. */ - virtual SmartPtr clone(); - - /** Initialize method. This method reads the params file and - * initializes the journalists. You should call this method at - * some point before the first optimize call. Note: you can skip - * the processing of a params file by setting params_file to "". - * It returns something other than Solve_Succeeded if there was a - * problem in the initialization (such as an invalid option). - */ - virtual ApplicationReturnStatus Initialize(std::string params_file = "ipopt.opt"); - virtual ApplicationReturnStatus Initialize(std::istream& is); - - /**@name Solve methods */ - //@{ - /** Solve a problem that inherits from TNLP */ - virtual ApplicationReturnStatus OptimizeTNLP(const SmartPtr& tnlp); - - /** Solve a problem that inherits from NLP */ - virtual ApplicationReturnStatus OptimizeNLP(const SmartPtr& nlp); - - /** Solve a problem that inherits from NLP */ - virtual ApplicationReturnStatus OptimizeNLP(const SmartPtr& nlp, SmartPtr& alg_builder); - - /** Solve a problem (that inherits from TNLP) for a repeated time. - * The OptimizeTNLP method must have been called before. The - * TNLP must be the same object, and the structure (number of - * variables and constraints and position of nonzeros in Jacobian - * and Hessian must be the same). */ - virtual ApplicationReturnStatus ReOptimizeTNLP(const SmartPtr& tnlp); - - /** Solve a problem (that inherits from NLP) for a repeated time. - * The OptimizeNLP method must have been called before. The - * NLP must be the same object, and the structure (number of - * variables and constraints and position of nonzeros in Jacobian - * and Hessian must be the same). */ - virtual ApplicationReturnStatus ReOptimizeNLP(const SmartPtr& nlp); - //@} - - /** Method for opening an output file with given print_level. - * Returns false if there was a problem. */ - virtual bool OpenOutputFile(std::string file_name, EJournalLevel print_level); - - /**@name Accessor methods */ - //@{ - /** Get the Journalist for printing output */ - virtual SmartPtr Jnlst() - { - return jnlst_; - } - - /** Get a pointer to RegisteredOptions object to - * add new options */ - virtual SmartPtr RegOptions() - { - return reg_options_; - } - - /** Get the options list for setting options */ - virtual SmartPtr Options() - { - return options_; - } - - /** Get the options list for setting options (const version) */ - virtual SmartPtr Options() const - { - return ConstPtr(options_); - } - - /** Get the object with the statistics about the most recent - * optimization run. */ - virtual SmartPtr Statistics(); - - /** Get the IpoptNLP Object */ - virtual SmartPtr IpoptNLPObject(); - - /** Get the IpoptData Object */ - SmartPtr IpoptDataObject(); - - /** Get the IpoptCQ Object */ - virtual SmartPtr IpoptCQObject(); - - /** Get the Algorithm Object */ - SmartPtr AlgorithmObject(); - //@} - - /** @name Methods for IpoptTypeInfo */ - //@{ - static void RegisterOptions(SmartPtr roptions); - //@} - - /** Method to registering all Ipopt options. */ - static void - RegisterAllIpoptOptions(const SmartPtr& roptions); - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - // IpoptApplication(); - - /** Copy Constructor */ - IpoptApplication(const IpoptApplication&); - - /** Overloaded Equals Operator */ - void operator=(const IpoptApplication&); - //@} - - /** Method for the actual optimize call of the Ipopt algorithm. - * This is used both for Optimize and ReOptimize */ - ApplicationReturnStatus call_optimize(); - - /**@name Variables that customize the application behavior */ - //@{ - /** Decide whether or not the ipopt.opt file should be read */ - bool read_params_dat_; - //@} - - /** Journalist for reporting output */ - SmartPtr jnlst_; - - /** RegisteredOptions */ - SmartPtr reg_options_; - - /** OptionsList used for the application */ - SmartPtr options_; - - /** Object for storing statistics about the most recent - * optimization run. */ - SmartPtr statistics_; - - /** Object with the algorithm sceleton. - */ - SmartPtr alg_; - - /** IpoptNLP Object for the NLP. We keep this around for a - * ReOptimize warm start. */ - SmartPtr ip_nlp_; - - /** IpoptData Object for the NLP. We keep this around for a - * ReOptimize warm start. - */ - SmartPtr ip_data_; - - /** IpoptCalculatedQuantities Object for the NLP. We keep this - * around for a ReOptimize warm start. - */ - SmartPtr ip_cq_; - - /** Pointer to the TNLPAdapter used to convert the TNLP to an NLP. - * We keep this around for the ReOptimizerTNLP call. */ - SmartPtr nlp_adapter_; - - /** @name Algorithmic parameters */ - //@{ - /** Flag indicating if we are to use the inexact linear solver option */ - bool inexact_algorithm_; - /** Flag indicating if all bounds should be replaced by inequality - * constraints. This is necessary for the inexact algorithm. */ - bool replace_bounds_; - /** Flag indicating if the NLP:FinalizeSolution method should not - * be called after optimization. */ - bool skip_finalize_solution_call_; - //@} - }; - -} // namespace Ipopt - -extern "C" IPOPT_EXPORT(class Ipopt::IpoptApplication *) IpoptApplicationFactory(); - -#endif +// Copyright (C) 2004, 2010 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpIpoptApplication.hpp 2173 2013-03-30 17:25:39Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPIPOPTAPPLICATION_HPP__ +#define __IPIPOPTAPPLICATION_HPP__ + +#ifndef IPOPT_EXPORT +#ifdef _MSC_VER +#ifdef IPOPT_DLL +#define IPOPT_EXPORT(type) __declspec(dllexport) type __cdecl +#else +#define IPOPT_EXPORT(type) type __cdecl +#endif +#else +#define IPOPT_EXPORT(type) type +#endif +#endif + +#include + +#include "IpJournalist.hpp" +#include "IpTNLP.hpp" +#include "IpNLP.hpp" +/* Return codes for the Optimize call for an application */ +#include "IpReturnCodes.hpp" + +namespace Ipopt +{ + DECLARE_STD_EXCEPTION(IPOPT_APPLICATION_ERROR); + + /* forward declarations */ + class IpoptAlgorithm; + class IpoptNLP; + class IpoptData; + class IpoptCalculatedQuantities; + class AlgorithmBuilder; + class RegisteredOptions; + class OptionsList; + class SolveStatistics; + + /** This is the main application class for making calls to Ipopt. */ + class IpoptApplication : public ReferencedObject + { + public: + IpoptApplication(bool create_console_out = true, + bool create_empty = false); + + /** Another constructor that assumes that the code in the + * (default) constructor has already been executed */ + IpoptApplication(SmartPtr reg_options, + SmartPtr options, + SmartPtr jnlst); + + virtual ~IpoptApplication(); + + /** Method for creating a new IpoptApplication that uses the same + * journalist and registered options, and a copy of the options + list. */ + virtual SmartPtr clone(); + + /** Initialize method. This method reads the params file and + * initializes the journalists. You should call this method at + * some point before the first optimize call. Note: you can skip + * the processing of a params file by setting params_file to "". + * It returns something other than Solve_Succeeded if there was a + * problem in the initialization (such as an invalid option). + */ + virtual ApplicationReturnStatus Initialize(std::string params_file = "ipopt.opt"); + virtual ApplicationReturnStatus Initialize(std::istream& is); + + /**@name Solve methods */ + //@{ + /** Solve a problem that inherits from TNLP */ + virtual ApplicationReturnStatus OptimizeTNLP(const SmartPtr& tnlp); + + /** Solve a problem that inherits from NLP */ + virtual ApplicationReturnStatus OptimizeNLP(const SmartPtr& nlp); + + /** Solve a problem that inherits from NLP */ + virtual ApplicationReturnStatus OptimizeNLP(const SmartPtr& nlp, SmartPtr& alg_builder); + + /** Solve a problem (that inherits from TNLP) for a repeated time. + * The OptimizeTNLP method must have been called before. The + * TNLP must be the same object, and the structure (number of + * variables and constraints and position of nonzeros in Jacobian + * and Hessian must be the same). */ + virtual ApplicationReturnStatus ReOptimizeTNLP(const SmartPtr& tnlp); + + /** Solve a problem (that inherits from NLP) for a repeated time. + * The OptimizeNLP method must have been called before. The + * NLP must be the same object, and the structure (number of + * variables and constraints and position of nonzeros in Jacobian + * and Hessian must be the same). */ + virtual ApplicationReturnStatus ReOptimizeNLP(const SmartPtr& nlp); + //@} + + /** Method for opening an output file with given print_level. + * Returns false if there was a problem. */ + virtual bool OpenOutputFile(std::string file_name, EJournalLevel print_level); + + /**@name Accessor methods */ + //@{ + /** Get the Journalist for printing output */ + virtual SmartPtr Jnlst() + { + return jnlst_; + } + + /** Get a pointer to RegisteredOptions object to + * add new options */ + virtual SmartPtr RegOptions() + { + return reg_options_; + } + + /** Get the options list for setting options */ + virtual SmartPtr Options() + { + return options_; + } + + /** Get the options list for setting options (const version) */ + virtual SmartPtr Options() const + { + return ConstPtr(options_); + } + + /** Get the object with the statistics about the most recent + * optimization run. */ + virtual SmartPtr Statistics(); + + /** Get the IpoptNLP Object */ + virtual SmartPtr IpoptNLPObject(); + + /** Get the IpoptData Object */ + SmartPtr IpoptDataObject(); + + /** Get the IpoptCQ Object */ + virtual SmartPtr IpoptCQObject(); + + /** Get the Algorithm Object */ + SmartPtr AlgorithmObject(); + //@} + + /** Method for printing Ipopt copyright message now instead of + * just before the optimization. If you want to have the copy + * right message printed earlier than by default, call this + * method at the convenient time. */ + void PrintCopyrightMessage(); + + /** @name Methods for IpoptTypeInfo */ + //@{ + static void RegisterOptions(SmartPtr roptions); + //@} + + /** Method to registering all Ipopt options. */ + static void + RegisterAllIpoptOptions(const SmartPtr& roptions); + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + // IpoptApplication(); + + /** Copy Constructor */ + IpoptApplication(const IpoptApplication&); + + /** Overloaded Equals Operator */ + void operator=(const IpoptApplication&); + //@} + + /** Method for the actual optimize call of the Ipopt algorithm. + * This is used both for Optimize and ReOptimize */ + ApplicationReturnStatus call_optimize(); + + /**@name Variables that customize the application behavior */ + //@{ + /** Decide whether or not the ipopt.opt file should be read */ + bool read_params_dat_; + //@} + + /** Journalist for reporting output */ + SmartPtr jnlst_; + + /** RegisteredOptions */ + SmartPtr reg_options_; + + /** OptionsList used for the application */ + SmartPtr options_; + + /** Object for storing statistics about the most recent + * optimization run. */ + SmartPtr statistics_; + + /** Object with the algorithm sceleton. + */ + SmartPtr alg_; + + /** IpoptNLP Object for the NLP. We keep this around for a + * ReOptimize warm start. */ + SmartPtr ip_nlp_; + + /** IpoptData Object for the NLP. We keep this around for a + * ReOptimize warm start. + */ + SmartPtr ip_data_; + + /** IpoptCalculatedQuantities Object for the NLP. We keep this + * around for a ReOptimize warm start. + */ + SmartPtr ip_cq_; + + /** Pointer to the TNLPAdapter used to convert the TNLP to an NLP. + * We keep this around for the ReOptimizerTNLP call. */ + SmartPtr nlp_adapter_; + + /** @name Algorithmic parameters */ + //@{ + /** Flag indicating if we are to use the inexact linear solver option */ + bool inexact_algorithm_; + /** Flag indicating if all bounds should be replaced by inequality + * constraints. This is necessary for the inexact algorithm. */ + bool replace_bounds_; + //@} + }; + +} // namespace Ipopt + +extern "C" IPOPT_EXPORT(class Ipopt::IpoptApplication *) IpoptApplicationFactory(); + +#endif diff --git a/thirdparty/windows/include/coin/IpIpoptCalculatedQuantities.hpp b/thirdparty/windows/include/coin/IpIpoptCalculatedQuantities.hpp index 986a299..e102308 100644 --- a/thirdparty/windows/include/coin/IpIpoptCalculatedQuantities.hpp +++ b/thirdparty/windows/include/coin/IpIpoptCalculatedQuantities.hpp @@ -1,742 +1,751 @@ -// Copyright (C) 2004, 2008 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpIpoptCalculatedQuantities.hpp 1586 2009-10-27 15:55:03Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPIPOPTCALCULATEDQUANTITIES_HPP__ -#define __IPIPOPTCALCULATEDQUANTITIES_HPP__ - -#include "IpSmartPtr.hpp" -#include "IpCachedResults.hpp" - -#include - -namespace Ipopt -{ - class IpoptNLP; - class IpoptData; - class Vector; - class Matrix; - class SymMatrix; - class Journalist; - class OptionsList; - class RegisteredOptions; - - /** Norm types */ - enum ENormType { - NORM_1=0, - NORM_2, - NORM_MAX - }; - - /** Base class for additional calculated quantities that is special - * to a particular type of algorithm, such as the CG penalty - * function, or using iterative linear solvers. The regular - * IpoptCalculatedQuantities object should be given a derivation of - * this base class when it is created. */ - class IpoptAdditionalCq : public ReferencedObject - { - public: - /**@name Constructors/Destructors */ - //@{ - /** Default Constructor */ - IpoptAdditionalCq() - {} - - /** Default destructor */ - virtual ~IpoptAdditionalCq() - {} - //@} - - /** This method is called to initialize the global algorithmic - * parameters. The parameters are taken from the OptionsList - * object. */ - virtual bool Initialize(const Journalist& jnlst, - const OptionsList& options, - const std::string& prefix) = 0; - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Copy Constructor */ - IpoptAdditionalCq(const IpoptAdditionalCq&); - - /** Overloaded Equals Operator */ - void operator=(const IpoptAdditionalCq&); - //@} - }; - - /** Class for all IPOPT specific calculated quantities. - * - */ - class IpoptCalculatedQuantities : public ReferencedObject - { - public: - - /**@name Constructors/Destructors */ - //@{ - /** Constructor */ - IpoptCalculatedQuantities(const SmartPtr& ip_nlp, - const SmartPtr& ip_data); - /** Default destructor */ - virtual ~IpoptCalculatedQuantities(); - //@} - - /** Method for setting pointer for additional calculated - * quantities. This needs to be called before Initialized. */ - void SetAddCq(SmartPtr add_cq) - { - DBG_ASSERT(!HaveAddCq()); - add_cq_ = add_cq; - } - - /** Method detecting if additional object for calculated - * quantities has already been set */ - bool HaveAddCq() - { - return IsValid(add_cq_); - } - - /** This method must be called to initialize the global - * algorithmic parameters. The parameters are taken from the - * OptionsList object. */ - bool Initialize(const Journalist& jnlst, - const OptionsList& options, - const std::string& prefix); - - /** @name Slacks */ - //@{ - /** Slacks for x_L (at current iterate) */ - SmartPtr curr_slack_x_L(); - /** Slacks for x_U (at current iterate) */ - SmartPtr curr_slack_x_U(); - /** Slacks for s_L (at current iterate) */ - SmartPtr curr_slack_s_L(); - /** Slacks for s_U (at current iterate) */ - SmartPtr curr_slack_s_U(); - /** Slacks for x_L (at trial point) */ - SmartPtr trial_slack_x_L(); - /** Slacks for x_U (at trial point) */ - SmartPtr trial_slack_x_U(); - /** Slacks for s_L (at trial point) */ - SmartPtr trial_slack_s_L(); - /** Slacks for s_U (at trial point) */ - SmartPtr trial_slack_s_U(); - /** Indicating whether or not we "fudged" the slacks */ - Index AdjustedTrialSlacks(); - /** Reset the flags for "fudged" slacks */ - void ResetAdjustedTrialSlacks(); - //@} - - /** @name Objective function */ - //@{ - /** Value of objective function (at current point) */ - virtual Number curr_f(); - /** Unscaled value of the objective function (at the current point) */ - virtual Number unscaled_curr_f(); - /** Value of objective function (at trial point) */ - virtual Number trial_f(); - /** Unscaled value of the objective function (at the trial point) */ - virtual Number unscaled_trial_f(); - /** Gradient of objective function (at current point) */ - SmartPtr curr_grad_f(); - /** Gradient of objective function (at trial point) */ - SmartPtr trial_grad_f(); - //@} - - /** @name Barrier Objective Function */ - //@{ - /** Barrier Objective Function Value - * (at current iterate with current mu) - */ - virtual Number curr_barrier_obj(); - /** Barrier Objective Function Value - * (at trial point with current mu) - */ - virtual Number trial_barrier_obj(); - - /** Gradient of barrier objective function with respect to x - * (at current point with current mu) */ - SmartPtr curr_grad_barrier_obj_x(); - /** Gradient of barrier objective function with respect to s - * (at current point with current mu) */ - SmartPtr curr_grad_barrier_obj_s(); - - /** Gradient of the damping term with respect to x (times - * kappa_d) */ - SmartPtr grad_kappa_times_damping_x(); - /** Gradient of the damping term with respect to s (times - * kappa_d) */ - SmartPtr grad_kappa_times_damping_s(); - //@} - - /** @name Constraints */ - //@{ - /** c(x) (at current point) */ - SmartPtr curr_c(); - /** unscaled c(x) (at current point) */ - SmartPtr unscaled_curr_c(); - /** c(x) (at trial point) */ - SmartPtr trial_c(); - /** d(x) (at current point) */ - SmartPtr curr_d(); - /** unscaled d(x) (at current point) */ - SmartPtr unscaled_curr_d(); - /** d(x) (at trial point) */ - SmartPtr trial_d(); - /** d(x) - s (at current point) */ - SmartPtr curr_d_minus_s(); - /** d(x) - s (at trial point) */ - SmartPtr trial_d_minus_s(); - /** Jacobian of c (at current point) */ - SmartPtr curr_jac_c(); - /** Jacobian of c (at trial point) */ - SmartPtr trial_jac_c(); - /** Jacobian of d (at current point) */ - SmartPtr curr_jac_d(); - /** Jacobian of d (at trial point) */ - SmartPtr trial_jac_d(); - /** Product of Jacobian (evaluated at current point) of C - * transpose with general vector */ - SmartPtr curr_jac_cT_times_vec(const Vector& vec); - /** Product of Jacobian (evaluated at trial point) of C - * transpose with general vector */ - SmartPtr trial_jac_cT_times_vec(const Vector& vec); - /** Product of Jacobian (evaluated at current point) of D - * transpose with general vector */ - SmartPtr curr_jac_dT_times_vec(const Vector& vec); - /** Product of Jacobian (evaluated at trial point) of D - * transpose with general vector */ - SmartPtr trial_jac_dT_times_vec(const Vector& vec); - /** Product of Jacobian (evaluated at current point) of C - * transpose with current y_c */ - SmartPtr curr_jac_cT_times_curr_y_c(); - /** Product of Jacobian (evaluated at trial point) of C - * transpose with trial y_c */ - SmartPtr trial_jac_cT_times_trial_y_c(); - /** Product of Jacobian (evaluated at current point) of D - * transpose with current y_d */ - SmartPtr curr_jac_dT_times_curr_y_d(); - /** Product of Jacobian (evaluated at trial point) of D - * transpose with trial y_d */ - SmartPtr trial_jac_dT_times_trial_y_d(); - /** Product of Jacobian (evaluated at current point) of C - * with general vector */ - SmartPtr curr_jac_c_times_vec(const Vector& vec); - /** Product of Jacobian (evaluated at current point) of D - * with general vector */ - SmartPtr curr_jac_d_times_vec(const Vector& vec); - /** Constraint Violation (at current iterate). This value should - * be used in the line search, and not curr_primal_infeasibility(). - * What type of norm is used depends on constr_viol_normtype */ - virtual Number curr_constraint_violation(); - /** Constraint Violation (at trial point). This value should - * be used in the line search, and not curr_primal_infeasibility(). - * What type of norm is used depends on constr_viol_normtype */ - virtual Number trial_constraint_violation(); - /** Real constraint violation in a given norm (at current - * iterate). This considers the inequality constraints without - * slacks. */ - virtual Number curr_nlp_constraint_violation(ENormType NormType); - /** Unscaled real constraint violation in a given norm (at current - * iterate). This considers the inequality constraints without - * slacks. */ - virtual Number unscaled_curr_nlp_constraint_violation(ENormType NormType); - //@} - - /** @name Hessian matrices */ - //@{ - /** exact Hessian at current iterate (uncached) */ - SmartPtr curr_exact_hessian(); - //@} - - /** @name primal-dual error and its components */ - //@{ - /** x-part of gradient of Lagrangian function (at current point) */ - SmartPtr curr_grad_lag_x(); - /** x-part of gradient of Lagrangian function (at trial point) */ - SmartPtr trial_grad_lag_x(); - /** s-part of gradient of Lagrangian function (at current point) */ - SmartPtr curr_grad_lag_s(); - /** s-part of gradient of Lagrangian function (at trial point) */ - SmartPtr trial_grad_lag_s(); - /** x-part of gradient of Lagrangian function (at current point) - including linear damping term */ - SmartPtr curr_grad_lag_with_damping_x(); - /** s-part of gradient of Lagrangian function (at current point) - including linear damping term */ - SmartPtr curr_grad_lag_with_damping_s(); - /** Complementarity for x_L (for current iterate) */ - SmartPtr curr_compl_x_L(); - /** Complementarity for x_U (for current iterate) */ - SmartPtr curr_compl_x_U(); - /** Complementarity for s_L (for current iterate) */ - SmartPtr curr_compl_s_L(); - /** Complementarity for s_U (for current iterate) */ - SmartPtr curr_compl_s_U(); - /** Complementarity for x_L (for trial iterate) */ - SmartPtr trial_compl_x_L(); - /** Complementarity for x_U (for trial iterate) */ - SmartPtr trial_compl_x_U(); - /** Complementarity for s_L (for trial iterate) */ - SmartPtr trial_compl_s_L(); - /** Complementarity for s_U (for trial iterate) */ - SmartPtr trial_compl_s_U(); - /** Relaxed complementarity for x_L (for current iterate and current mu) */ - SmartPtr curr_relaxed_compl_x_L(); - /** Relaxed complementarity for x_U (for current iterate and current mu) */ - SmartPtr curr_relaxed_compl_x_U(); - /** Relaxed complementarity for s_L (for current iterate and current mu) */ - SmartPtr curr_relaxed_compl_s_L(); - /** Relaxed complementarity for s_U (for current iterate and current mu) */ - SmartPtr curr_relaxed_compl_s_U(); - - /** Primal infeasibility in a given norm (at current iterate). */ - virtual Number curr_primal_infeasibility(ENormType NormType); - /** Primal infeasibility in a given norm (at trial point) */ - virtual Number trial_primal_infeasibility(ENormType NormType); - - /** Dual infeasibility in a given norm (at current iterate) */ - virtual Number curr_dual_infeasibility(ENormType NormType); - /** Dual infeasibility in a given norm (at trial iterate) */ - virtual Number trial_dual_infeasibility(ENormType NormType); - /** Unscaled dual infeasibility in a given norm (at current iterate) */ - virtual Number unscaled_curr_dual_infeasibility(ENormType NormType); - - /** Complementarity (for all complementarity conditions together) - * in a given norm (at current iterate) */ - virtual Number curr_complementarity(Number mu, ENormType NormType); - /** Complementarity (for all complementarity conditions together) - * in a given norm (at trial iterate) */ - virtual Number trial_complementarity(Number mu, ENormType NormType); - /** Complementarity (for all complementarity conditions together) - * in a given norm (at current iterate) without NLP scaling. */ - virtual Number unscaled_curr_complementarity(Number mu, ENormType NormType); - - /** Centrality measure (in spirit of the -infinity-neighborhood. */ - Number CalcCentralityMeasure(const Vector& compl_x_L, - const Vector& compl_x_U, - const Vector& compl_s_L, - const Vector& compl_s_U); - /** Centrality measure at current point */ - virtual Number curr_centrality_measure(); - - /** Total optimality error for the original NLP at the current - * iterate, using scaling factors based on multipliers. Note - * that here the constraint violation is measured without slacks - * (nlp_constraint_violation) */ - virtual Number curr_nlp_error(); - /** Total optimality error for the original NLP at the current - * iterate, but using no scaling based on multipliers, and no - * scaling for the NLP. Note that here the constraint violation - * is measured without slacks (nlp_constraint_violation) */ - virtual Number unscaled_curr_nlp_error(); - - /** Total optimality error for the barrier problem at the - * current iterate, using scaling factors based on multipliers. */ - virtual Number curr_barrier_error(); - - /** Norm of the primal-dual system for a given mu (at current - * iterate). The norm is defined as the sum of the 1-norms of - * dual infeasibiliy, primal infeasibility, and complementarity, - * all divided by the number of elements of the vectors of which - * the norm is taken. - */ - virtual Number curr_primal_dual_system_error(Number mu); - /** Norm of the primal-dual system for a given mu (at trial - * iterate). The norm is defined as the sum of the 1-norms of - * dual infeasibiliy, primal infeasibility, and complementarity, - * all divided by the number of elements of the vectors of which - * the norm is taken. - */ - virtual Number trial_primal_dual_system_error(Number mu); - //@} - - /** @name Computing fraction-to-the-boundary step sizes */ - //@{ - /** Fraction to the boundary from (current) primal variables x and s - * for a given step */ - Number primal_frac_to_the_bound(Number tau, - const Vector& delta_x, - const Vector& delta_s); - /** Fraction to the boundary from (current) primal variables x and s - * for internal (current) step */ - Number curr_primal_frac_to_the_bound(Number tau); - /** Fraction to the boundary from (current) dual variables z and v - * for a given step */ - Number dual_frac_to_the_bound(Number tau, - const Vector& delta_z_L, - const Vector& delta_z_U, - const Vector& delta_v_L, - const Vector& delta_v_U); - /** Fraction to the boundary from (current) dual variables z and v - * for a given step, without caching */ - Number uncached_dual_frac_to_the_bound(Number tau, - const Vector& delta_z_L, - const Vector& delta_z_U, - const Vector& delta_v_L, - const Vector& delta_v_U); - /** Fraction to the boundary from (current) dual variables z and v - * for internal (current) step */ - Number curr_dual_frac_to_the_bound(Number tau); - /** Fraction to the boundary from (current) slacks for a given - * step in the slacks. Usually, one will use the - * primal_frac_to_the_bound method to compute the primal fraction - * to the boundary step size, but if it is cheaper to provide the - * steps in the slacks directly (e.g. when the primal step sizes - * are only temporary), the this method is more efficient. This - * method does not cache computations. */ - Number uncached_slack_frac_to_the_bound(Number tau, - const Vector& delta_x_L, - const Vector& delta_x_U, - const Vector& delta_s_L, - const Vector& delta_s_U); - //@} - - /** @name Sigma matrices */ - //@{ - SmartPtr curr_sigma_x(); - SmartPtr curr_sigma_s(); - //@} - - /** average of current values of the complementarities */ - Number curr_avrg_compl(); - /** average of trial values of the complementarities */ - Number trial_avrg_compl(); - - /** inner_product of current barrier obj. fn. gradient with - * current search direction */ - Number curr_gradBarrTDelta(); - - /** Compute the norm of a specific type of a set of vectors (uncached) */ - Number - CalcNormOfType(ENormType NormType, - std::vector > vecs); - - /** Compute the norm of a specific type of two vectors (uncached) */ - Number - CalcNormOfType(ENormType NormType, - const Vector& vec1, const Vector& vec2); - - /** Norm type used for calculating constraint violation */ - ENormType constr_viol_normtype() const - { - return constr_viol_normtype_; - } - - /** Method returning true if this is a square problem */ - bool IsSquareProblem() const; - - /** Method returning the IpoptNLP object. This should only be - * used with care! */ - SmartPtr& GetIpoptNLP() - { - return ip_nlp_; - } - - IpoptAdditionalCq& AdditionalCq() - { - DBG_ASSERT(IsValid(add_cq_)); - return *add_cq_; - } - - /** Methods for IpoptType */ - //@{ - /** Called by IpoptType to register the options */ - static void RegisterOptions(SmartPtr roptions); - //@} - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - IpoptCalculatedQuantities(); - - /** Copy Constructor */ - IpoptCalculatedQuantities(const IpoptCalculatedQuantities&); - - /** Overloaded Equals Operator */ - void operator=(const IpoptCalculatedQuantities&); - //@} - - /** @name Pointers for easy access to data and NLP information */ - //@{ - /** Ipopt NLP object */ - SmartPtr ip_nlp_; - /** Ipopt Data object */ - SmartPtr ip_data_; - /** Chen-Goldfarb specific calculated quantities */ - SmartPtr add_cq_; - //@} - - /** @name Algorithmic Parameters that can be set throught the - * options list. Those parameters are initialize by calling the - * Initialize method.*/ - //@{ - /** Parameter in formula for computing overall primal-dual - * optimality error */ - Number s_max_; - /** Weighting factor for the linear damping term added to the - * barrier objective funciton. */ - Number kappa_d_; - /** fractional movement allowed in bounds */ - Number slack_move_; - /** Norm type to be used when calculating the constraint violation */ - ENormType constr_viol_normtype_; - /** Flag indicating whether the TNLP with identical structure has - * already been solved before. */ - bool warm_start_same_structure_; - //@} - - /** @name Caches for slacks */ - //@{ - CachedResults< SmartPtr > curr_slack_x_L_cache_; - CachedResults< SmartPtr > curr_slack_x_U_cache_; - CachedResults< SmartPtr > curr_slack_s_L_cache_; - CachedResults< SmartPtr > curr_slack_s_U_cache_; - CachedResults< SmartPtr > trial_slack_x_L_cache_; - CachedResults< SmartPtr > trial_slack_x_U_cache_; - CachedResults< SmartPtr > trial_slack_s_L_cache_; - CachedResults< SmartPtr > trial_slack_s_U_cache_; - Index num_adjusted_slack_x_L_; - Index num_adjusted_slack_x_U_; - Index num_adjusted_slack_s_L_; - Index num_adjusted_slack_s_U_; - //@} - - /** @name Cached for objective function stuff */ - //@{ - CachedResults curr_f_cache_; - CachedResults trial_f_cache_; - CachedResults< SmartPtr > curr_grad_f_cache_; - CachedResults< SmartPtr > trial_grad_f_cache_; - //@} - - /** @name Caches for barrier function stuff */ - //@{ - CachedResults curr_barrier_obj_cache_; - CachedResults trial_barrier_obj_cache_; - CachedResults< SmartPtr > curr_grad_barrier_obj_x_cache_; - CachedResults< SmartPtr > curr_grad_barrier_obj_s_cache_; - CachedResults< SmartPtr > grad_kappa_times_damping_x_cache_; - CachedResults< SmartPtr > grad_kappa_times_damping_s_cache_; - //@} - - /** @name Caches for constraint stuff */ - //@{ - CachedResults< SmartPtr > curr_c_cache_; - CachedResults< SmartPtr > trial_c_cache_; - CachedResults< SmartPtr > curr_d_cache_; - CachedResults< SmartPtr > trial_d_cache_; - CachedResults< SmartPtr > curr_d_minus_s_cache_; - CachedResults< SmartPtr > trial_d_minus_s_cache_; - CachedResults< SmartPtr > curr_jac_c_cache_; - CachedResults< SmartPtr > trial_jac_c_cache_; - CachedResults< SmartPtr > curr_jac_d_cache_; - CachedResults< SmartPtr > trial_jac_d_cache_; - CachedResults< SmartPtr > curr_jac_cT_times_vec_cache_; - CachedResults< SmartPtr > trial_jac_cT_times_vec_cache_; - CachedResults< SmartPtr > curr_jac_dT_times_vec_cache_; - CachedResults< SmartPtr > trial_jac_dT_times_vec_cache_; - CachedResults< SmartPtr > curr_jac_c_times_vec_cache_; - CachedResults< SmartPtr > curr_jac_d_times_vec_cache_; - CachedResults curr_constraint_violation_cache_; - CachedResults trial_constraint_violation_cache_; - CachedResults curr_nlp_constraint_violation_cache_; - CachedResults unscaled_curr_nlp_constraint_violation_cache_; - //@} - - /** Cache for the exact Hessian */ - CachedResults< SmartPtr > curr_exact_hessian_cache_; - - /** @name Components of primal-dual error */ - //@{ - CachedResults< SmartPtr > curr_grad_lag_x_cache_; - CachedResults< SmartPtr > trial_grad_lag_x_cache_; - CachedResults< SmartPtr > curr_grad_lag_s_cache_; - CachedResults< SmartPtr > trial_grad_lag_s_cache_; - CachedResults< SmartPtr > curr_grad_lag_with_damping_x_cache_; - CachedResults< SmartPtr > curr_grad_lag_with_damping_s_cache_; - CachedResults< SmartPtr > curr_compl_x_L_cache_; - CachedResults< SmartPtr > curr_compl_x_U_cache_; - CachedResults< SmartPtr > curr_compl_s_L_cache_; - CachedResults< SmartPtr > curr_compl_s_U_cache_; - CachedResults< SmartPtr > trial_compl_x_L_cache_; - CachedResults< SmartPtr > trial_compl_x_U_cache_; - CachedResults< SmartPtr > trial_compl_s_L_cache_; - CachedResults< SmartPtr > trial_compl_s_U_cache_; - CachedResults< SmartPtr > curr_relaxed_compl_x_L_cache_; - CachedResults< SmartPtr > curr_relaxed_compl_x_U_cache_; - CachedResults< SmartPtr > curr_relaxed_compl_s_L_cache_; - CachedResults< SmartPtr > curr_relaxed_compl_s_U_cache_; - CachedResults curr_primal_infeasibility_cache_; - CachedResults trial_primal_infeasibility_cache_; - CachedResults curr_dual_infeasibility_cache_; - CachedResults trial_dual_infeasibility_cache_; - CachedResults unscaled_curr_dual_infeasibility_cache_; - CachedResults curr_complementarity_cache_; - CachedResults trial_complementarity_cache_; - CachedResults curr_centrality_measure_cache_; - CachedResults curr_nlp_error_cache_; - CachedResults unscaled_curr_nlp_error_cache_; - CachedResults curr_barrier_error_cache_; - CachedResults curr_primal_dual_system_error_cache_; - CachedResults trial_primal_dual_system_error_cache_; - //@} - - /** @name Caches for fraction to the boundary step sizes */ - //@{ - CachedResults primal_frac_to_the_bound_cache_; - CachedResults dual_frac_to_the_bound_cache_; - //@} - - /** @name Caches for sigma matrices */ - //@{ - CachedResults< SmartPtr > curr_sigma_x_cache_; - CachedResults< SmartPtr > curr_sigma_s_cache_; - //@} - - /** Cache for average of current complementarity */ - CachedResults curr_avrg_compl_cache_; - /** Cache for average of trial complementarity */ - CachedResults trial_avrg_compl_cache_; - - /** Cache for grad barrier obj. fn inner product with step */ - CachedResults curr_gradBarrTDelta_cache_; - - /** @name Indicator vectors required for the linear damping terms - * to handle unbounded solution sets. */ - //@{ - /** Indicator vector for selecting the elements in x that have - * only lower bounds. */ - SmartPtr dampind_x_L_; - /** Indicator vector for selecting the elements in x that have - * only upper bounds. */ - SmartPtr dampind_x_U_; - /** Indicator vector for selecting the elements in s that have - * only lower bounds. */ - SmartPtr dampind_s_L_; - /** Indicator vector for selecting the elements in s that have - * only upper bounds. */ - SmartPtr dampind_s_U_; - //@} - - /** @name Temporary vectors for intermediate calcuations. We keep - * these around to avoid unnecessarily many new allocations of - * Vectors. */ - //@{ - SmartPtr tmp_x_; - SmartPtr tmp_s_; - SmartPtr tmp_c_; - SmartPtr tmp_d_; - SmartPtr tmp_x_L_; - SmartPtr tmp_x_U_; - SmartPtr tmp_s_L_; - SmartPtr tmp_s_U_; - - /** Accessor methods for the temporary vectors */ - Vector& Tmp_x(); - Vector& Tmp_s(); - Vector& Tmp_c(); - Vector& Tmp_d(); - Vector& Tmp_x_L(); - Vector& Tmp_x_U(); - Vector& Tmp_s_L(); - Vector& Tmp_s_U(); - //@} - - /** flag indicating if Initialize method has been called (for - * debugging) */ - bool initialize_called_; - - /** @name Auxiliary functions */ - //@{ - /** Compute new vector containing the slack to a lower bound - * (uncached) - */ - SmartPtr CalcSlack_L(const Matrix& P, - const Vector& x, - const Vector& x_bound); - /** Compute new vector containing the slack to a upper bound - * (uncached) - */ - SmartPtr CalcSlack_U(const Matrix& P, - const Vector& x, - const Vector& x_bound); - /** Compute barrier term at given point - * (uncached) - */ - Number CalcBarrierTerm(Number mu, - const Vector& slack_x_L, - const Vector& slack_x_U, - const Vector& slack_s_L, - const Vector& slack_s_U); - - /** Compute complementarity for slack / multiplier pair */ - SmartPtr CalcCompl(const Vector& slack, - const Vector& mult); - - /** Compute fraction to the boundary parameter for lower and upper bounds */ - Number CalcFracToBound(const Vector& slack_L, - Vector& tmp_L, - const Matrix& P_L, - const Vector& slack_U, - Vector& tmp_U, - const Matrix& P_U, - const Vector& delta, - Number tau); - - /** Compute the scaling factors for the optimality error. */ - void ComputeOptimalityErrorScaling(const Vector& y_c, const Vector& y_d, - const Vector& z_L, const Vector& z_U, - const Vector& v_L, const Vector& v_U, - Number s_max, - Number& s_d, Number& s_c); - - /** Check if slacks are becoming too small. If slacks are - * becoming too small, they are change. The return value is the - * number of corrected slacks. */ - Index CalculateSafeSlack(SmartPtr& slack, - const SmartPtr& bound, - const SmartPtr& curr_point, - const SmartPtr& multiplier); - - /** Computes the indicator vectors that can be used to filter out - * those entries in the slack_... variables, that correspond to - * variables with only lower and upper bounds. This is required - * for the linear damping term in the barrier objective function - * to handle unbounded solution sets. */ - void ComputeDampingIndicators(SmartPtr& dampind_x_L, - SmartPtr& dampind_x_U, - SmartPtr& dampind_s_L, - SmartPtr& dampind_s_U); - - /** Check if we are in the restoration phase. Returns true, if the - * ip_nlp is of the type RestoIpoptNLP. ToDo: We probably want to - * handle this more elegant and don't have an explicit dependency - * here. Now I added this because otherwise the caching doesn't - * work properly since the restoration phase objective function - * depends on the current barrier parameter. */ - bool in_restoration_phase(); - - //@} - }; - -} // namespace Ipopt - -#endif +// Copyright (C) 2004, 2011 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpIpoptCalculatedQuantities.hpp 2020 2011-06-16 20:46:16Z andreasw $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPIPOPTCALCULATEDQUANTITIES_HPP__ +#define __IPIPOPTCALCULATEDQUANTITIES_HPP__ + +#include "IpSmartPtr.hpp" +#include "IpCachedResults.hpp" + +#include + +namespace Ipopt +{ + class IpoptNLP; + class IpoptData; + class Vector; + class Matrix; + class SymMatrix; + class Journalist; + class OptionsList; + class RegisteredOptions; + + /** Norm types */ + enum ENormType { + NORM_1=0, + NORM_2, + NORM_MAX + }; + + /** Base class for additional calculated quantities that is special + * to a particular type of algorithm, such as the CG penalty + * function, or using iterative linear solvers. The regular + * IpoptCalculatedQuantities object should be given a derivation of + * this base class when it is created. */ + class IpoptAdditionalCq : public ReferencedObject + { + public: + /**@name Constructors/Destructors */ + //@{ + /** Default Constructor */ + IpoptAdditionalCq() + {} + + /** Default destructor */ + virtual ~IpoptAdditionalCq() + {} + //@} + + /** This method is called to initialize the global algorithmic + * parameters. The parameters are taken from the OptionsList + * object. */ + virtual bool Initialize(const Journalist& jnlst, + const OptionsList& options, + const std::string& prefix) = 0; + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Copy Constructor */ + IpoptAdditionalCq(const IpoptAdditionalCq&); + + /** Overloaded Equals Operator */ + void operator=(const IpoptAdditionalCq&); + //@} + }; + + /** Class for all IPOPT specific calculated quantities. + * + */ + class IpoptCalculatedQuantities : public ReferencedObject + { + public: + + /**@name Constructors/Destructors */ + //@{ + /** Constructor */ + IpoptCalculatedQuantities(const SmartPtr& ip_nlp, + const SmartPtr& ip_data); + /** Default destructor */ + virtual ~IpoptCalculatedQuantities(); + //@} + + /** Method for setting pointer for additional calculated + * quantities. This needs to be called before Initialized. */ + void SetAddCq(SmartPtr add_cq) + { + DBG_ASSERT(!HaveAddCq()); + add_cq_ = add_cq; + } + + /** Method detecting if additional object for calculated + * quantities has already been set */ + bool HaveAddCq() + { + return IsValid(add_cq_); + } + + /** This method must be called to initialize the global + * algorithmic parameters. The parameters are taken from the + * OptionsList object. */ + bool Initialize(const Journalist& jnlst, + const OptionsList& options, + const std::string& prefix); + + /** @name Slacks */ + //@{ + /** Slacks for x_L (at current iterate) */ + SmartPtr curr_slack_x_L(); + /** Slacks for x_U (at current iterate) */ + SmartPtr curr_slack_x_U(); + /** Slacks for s_L (at current iterate) */ + SmartPtr curr_slack_s_L(); + /** Slacks for s_U (at current iterate) */ + SmartPtr curr_slack_s_U(); + /** Slacks for x_L (at trial point) */ + SmartPtr trial_slack_x_L(); + /** Slacks for x_U (at trial point) */ + SmartPtr trial_slack_x_U(); + /** Slacks for s_L (at trial point) */ + SmartPtr trial_slack_s_L(); + /** Slacks for s_U (at trial point) */ + SmartPtr trial_slack_s_U(); + /** Indicating whether or not we "fudged" the slacks */ + Index AdjustedTrialSlacks(); + /** Reset the flags for "fudged" slacks */ + void ResetAdjustedTrialSlacks(); + //@} + + /** @name Objective function */ + //@{ + /** Value of objective function (at current point) */ + virtual Number curr_f(); + /** Unscaled value of the objective function (at the current point) */ + virtual Number unscaled_curr_f(); + /** Value of objective function (at trial point) */ + virtual Number trial_f(); + /** Unscaled value of the objective function (at the trial point) */ + virtual Number unscaled_trial_f(); + /** Gradient of objective function (at current point) */ + SmartPtr curr_grad_f(); + /** Gradient of objective function (at trial point) */ + SmartPtr trial_grad_f(); + //@} + + /** @name Barrier Objective Function */ + //@{ + /** Barrier Objective Function Value + * (at current iterate with current mu) + */ + virtual Number curr_barrier_obj(); + /** Barrier Objective Function Value + * (at trial point with current mu) + */ + virtual Number trial_barrier_obj(); + + /** Gradient of barrier objective function with respect to x + * (at current point with current mu) */ + SmartPtr curr_grad_barrier_obj_x(); + /** Gradient of barrier objective function with respect to s + * (at current point with current mu) */ + SmartPtr curr_grad_barrier_obj_s(); + + /** Gradient of the damping term with respect to x (times + * kappa_d) */ + SmartPtr grad_kappa_times_damping_x(); + /** Gradient of the damping term with respect to s (times + * kappa_d) */ + SmartPtr grad_kappa_times_damping_s(); + //@} + + /** @name Constraints */ + //@{ + /** c(x) (at current point) */ + SmartPtr curr_c(); + /** unscaled c(x) (at current point) */ + SmartPtr unscaled_curr_c(); + /** c(x) (at trial point) */ + SmartPtr trial_c(); + /** unscaled c(x) (at trial point) */ + SmartPtr unscaled_trial_c(); + /** d(x) (at current point) */ + SmartPtr curr_d(); + /** unscaled d(x) (at current point) */ + SmartPtr unscaled_curr_d(); + /** d(x) (at trial point) */ + SmartPtr trial_d(); + /** d(x) - s (at current point) */ + SmartPtr curr_d_minus_s(); + /** d(x) - s (at trial point) */ + SmartPtr trial_d_minus_s(); + /** Jacobian of c (at current point) */ + SmartPtr curr_jac_c(); + /** Jacobian of c (at trial point) */ + SmartPtr trial_jac_c(); + /** Jacobian of d (at current point) */ + SmartPtr curr_jac_d(); + /** Jacobian of d (at trial point) */ + SmartPtr trial_jac_d(); + /** Product of Jacobian (evaluated at current point) of C + * transpose with general vector */ + SmartPtr curr_jac_cT_times_vec(const Vector& vec); + /** Product of Jacobian (evaluated at trial point) of C + * transpose with general vector */ + SmartPtr trial_jac_cT_times_vec(const Vector& vec); + /** Product of Jacobian (evaluated at current point) of D + * transpose with general vector */ + SmartPtr curr_jac_dT_times_vec(const Vector& vec); + /** Product of Jacobian (evaluated at trial point) of D + * transpose with general vector */ + SmartPtr trial_jac_dT_times_vec(const Vector& vec); + /** Product of Jacobian (evaluated at current point) of C + * transpose with current y_c */ + SmartPtr curr_jac_cT_times_curr_y_c(); + /** Product of Jacobian (evaluated at trial point) of C + * transpose with trial y_c */ + SmartPtr trial_jac_cT_times_trial_y_c(); + /** Product of Jacobian (evaluated at current point) of D + * transpose with current y_d */ + SmartPtr curr_jac_dT_times_curr_y_d(); + /** Product of Jacobian (evaluated at trial point) of D + * transpose with trial y_d */ + SmartPtr trial_jac_dT_times_trial_y_d(); + /** Product of Jacobian (evaluated at current point) of C + * with general vector */ + SmartPtr curr_jac_c_times_vec(const Vector& vec); + /** Product of Jacobian (evaluated at current point) of D + * with general vector */ + SmartPtr curr_jac_d_times_vec(const Vector& vec); + /** Constraint Violation (at current iterate). This value should + * be used in the line search, and not curr_primal_infeasibility(). + * What type of norm is used depends on constr_viol_normtype */ + virtual Number curr_constraint_violation(); + /** Constraint Violation (at trial point). This value should + * be used in the line search, and not curr_primal_infeasibility(). + * What type of norm is used depends on constr_viol_normtype */ + virtual Number trial_constraint_violation(); + /** Real constraint violation in a given norm (at current + * iterate). This considers the inequality constraints without + * slacks. */ + virtual Number curr_nlp_constraint_violation(ENormType NormType); + /** Unscaled real constraint violation in a given norm (at current + * iterate). This considers the inequality constraints without + * slacks. */ + virtual Number unscaled_curr_nlp_constraint_violation(ENormType NormType); + /** Unscaled real constraint violation in a given norm (at trial + * iterate). This considers the inequality constraints without + * slacks. */ + virtual Number unscaled_trial_nlp_constraint_violation(ENormType NormType); + //@} + + /** @name Hessian matrices */ + //@{ + /** exact Hessian at current iterate (uncached) */ + SmartPtr curr_exact_hessian(); + //@} + + /** @name primal-dual error and its components */ + //@{ + /** x-part of gradient of Lagrangian function (at current point) */ + SmartPtr curr_grad_lag_x(); + /** x-part of gradient of Lagrangian function (at trial point) */ + SmartPtr trial_grad_lag_x(); + /** s-part of gradient of Lagrangian function (at current point) */ + SmartPtr curr_grad_lag_s(); + /** s-part of gradient of Lagrangian function (at trial point) */ + SmartPtr trial_grad_lag_s(); + /** x-part of gradient of Lagrangian function (at current point) + including linear damping term */ + SmartPtr curr_grad_lag_with_damping_x(); + /** s-part of gradient of Lagrangian function (at current point) + including linear damping term */ + SmartPtr curr_grad_lag_with_damping_s(); + /** Complementarity for x_L (for current iterate) */ + SmartPtr curr_compl_x_L(); + /** Complementarity for x_U (for current iterate) */ + SmartPtr curr_compl_x_U(); + /** Complementarity for s_L (for current iterate) */ + SmartPtr curr_compl_s_L(); + /** Complementarity for s_U (for current iterate) */ + SmartPtr curr_compl_s_U(); + /** Complementarity for x_L (for trial iterate) */ + SmartPtr trial_compl_x_L(); + /** Complementarity for x_U (for trial iterate) */ + SmartPtr trial_compl_x_U(); + /** Complementarity for s_L (for trial iterate) */ + SmartPtr trial_compl_s_L(); + /** Complementarity for s_U (for trial iterate) */ + SmartPtr trial_compl_s_U(); + /** Relaxed complementarity for x_L (for current iterate and current mu) */ + SmartPtr curr_relaxed_compl_x_L(); + /** Relaxed complementarity for x_U (for current iterate and current mu) */ + SmartPtr curr_relaxed_compl_x_U(); + /** Relaxed complementarity for s_L (for current iterate and current mu) */ + SmartPtr curr_relaxed_compl_s_L(); + /** Relaxed complementarity for s_U (for current iterate and current mu) */ + SmartPtr curr_relaxed_compl_s_U(); + + /** Primal infeasibility in a given norm (at current iterate). */ + virtual Number curr_primal_infeasibility(ENormType NormType); + /** Primal infeasibility in a given norm (at trial point) */ + virtual Number trial_primal_infeasibility(ENormType NormType); + + /** Dual infeasibility in a given norm (at current iterate) */ + virtual Number curr_dual_infeasibility(ENormType NormType); + /** Dual infeasibility in a given norm (at trial iterate) */ + virtual Number trial_dual_infeasibility(ENormType NormType); + /** Unscaled dual infeasibility in a given norm (at current iterate) */ + virtual Number unscaled_curr_dual_infeasibility(ENormType NormType); + + /** Complementarity (for all complementarity conditions together) + * in a given norm (at current iterate) */ + virtual Number curr_complementarity(Number mu, ENormType NormType); + /** Complementarity (for all complementarity conditions together) + * in a given norm (at trial iterate) */ + virtual Number trial_complementarity(Number mu, ENormType NormType); + /** Complementarity (for all complementarity conditions together) + * in a given norm (at current iterate) without NLP scaling. */ + virtual Number unscaled_curr_complementarity(Number mu, ENormType NormType); + + /** Centrality measure (in spirit of the -infinity-neighborhood. */ + Number CalcCentralityMeasure(const Vector& compl_x_L, + const Vector& compl_x_U, + const Vector& compl_s_L, + const Vector& compl_s_U); + /** Centrality measure at current point */ + virtual Number curr_centrality_measure(); + + /** Total optimality error for the original NLP at the current + * iterate, using scaling factors based on multipliers. Note + * that here the constraint violation is measured without slacks + * (nlp_constraint_violation) */ + virtual Number curr_nlp_error(); + /** Total optimality error for the original NLP at the current + * iterate, but using no scaling based on multipliers, and no + * scaling for the NLP. Note that here the constraint violation + * is measured without slacks (nlp_constraint_violation) */ + virtual Number unscaled_curr_nlp_error(); + + /** Total optimality error for the barrier problem at the + * current iterate, using scaling factors based on multipliers. */ + virtual Number curr_barrier_error(); + + /** Norm of the primal-dual system for a given mu (at current + * iterate). The norm is defined as the sum of the 1-norms of + * dual infeasibiliy, primal infeasibility, and complementarity, + * all divided by the number of elements of the vectors of which + * the norm is taken. + */ + virtual Number curr_primal_dual_system_error(Number mu); + /** Norm of the primal-dual system for a given mu (at trial + * iterate). The norm is defined as the sum of the 1-norms of + * dual infeasibiliy, primal infeasibility, and complementarity, + * all divided by the number of elements of the vectors of which + * the norm is taken. + */ + virtual Number trial_primal_dual_system_error(Number mu); + //@} + + /** @name Computing fraction-to-the-boundary step sizes */ + //@{ + /** Fraction to the boundary from (current) primal variables x and s + * for a given step */ + Number primal_frac_to_the_bound(Number tau, + const Vector& delta_x, + const Vector& delta_s); + /** Fraction to the boundary from (current) primal variables x and s + * for internal (current) step */ + Number curr_primal_frac_to_the_bound(Number tau); + /** Fraction to the boundary from (current) dual variables z and v + * for a given step */ + Number dual_frac_to_the_bound(Number tau, + const Vector& delta_z_L, + const Vector& delta_z_U, + const Vector& delta_v_L, + const Vector& delta_v_U); + /** Fraction to the boundary from (current) dual variables z and v + * for a given step, without caching */ + Number uncached_dual_frac_to_the_bound(Number tau, + const Vector& delta_z_L, + const Vector& delta_z_U, + const Vector& delta_v_L, + const Vector& delta_v_U); + /** Fraction to the boundary from (current) dual variables z and v + * for internal (current) step */ + Number curr_dual_frac_to_the_bound(Number tau); + /** Fraction to the boundary from (current) slacks for a given + * step in the slacks. Usually, one will use the + * primal_frac_to_the_bound method to compute the primal fraction + * to the boundary step size, but if it is cheaper to provide the + * steps in the slacks directly (e.g. when the primal step sizes + * are only temporary), the this method is more efficient. This + * method does not cache computations. */ + Number uncached_slack_frac_to_the_bound(Number tau, + const Vector& delta_x_L, + const Vector& delta_x_U, + const Vector& delta_s_L, + const Vector& delta_s_U); + //@} + + /** @name Sigma matrices */ + //@{ + SmartPtr curr_sigma_x(); + SmartPtr curr_sigma_s(); + //@} + + /** average of current values of the complementarities */ + Number curr_avrg_compl(); + /** average of trial values of the complementarities */ + Number trial_avrg_compl(); + + /** inner_product of current barrier obj. fn. gradient with + * current search direction */ + Number curr_gradBarrTDelta(); + + /** Compute the norm of a specific type of a set of vectors (uncached) */ + Number + CalcNormOfType(ENormType NormType, + std::vector > vecs); + + /** Compute the norm of a specific type of two vectors (uncached) */ + Number + CalcNormOfType(ENormType NormType, + const Vector& vec1, const Vector& vec2); + + /** Norm type used for calculating constraint violation */ + ENormType constr_viol_normtype() const + { + return constr_viol_normtype_; + } + + /** Method returning true if this is a square problem */ + bool IsSquareProblem() const; + + /** Method returning the IpoptNLP object. This should only be + * used with care! */ + SmartPtr& GetIpoptNLP() + { + return ip_nlp_; + } + + IpoptAdditionalCq& AdditionalCq() + { + DBG_ASSERT(IsValid(add_cq_)); + return *add_cq_; + } + + /** Methods for IpoptType */ + //@{ + /** Called by IpoptType to register the options */ + static void RegisterOptions(SmartPtr roptions); + //@} + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + IpoptCalculatedQuantities(); + + /** Copy Constructor */ + IpoptCalculatedQuantities(const IpoptCalculatedQuantities&); + + /** Overloaded Equals Operator */ + void operator=(const IpoptCalculatedQuantities&); + //@} + + /** @name Pointers for easy access to data and NLP information */ + //@{ + /** Ipopt NLP object */ + SmartPtr ip_nlp_; + /** Ipopt Data object */ + SmartPtr ip_data_; + /** Chen-Goldfarb specific calculated quantities */ + SmartPtr add_cq_; + //@} + + /** @name Algorithmic Parameters that can be set throught the + * options list. Those parameters are initialize by calling the + * Initialize method.*/ + //@{ + /** Parameter in formula for computing overall primal-dual + * optimality error */ + Number s_max_; + /** Weighting factor for the linear damping term added to the + * barrier objective funciton. */ + Number kappa_d_; + /** fractional movement allowed in bounds */ + Number slack_move_; + /** Norm type to be used when calculating the constraint violation */ + ENormType constr_viol_normtype_; + /** Flag indicating whether the TNLP with identical structure has + * already been solved before. */ + bool warm_start_same_structure_; + /** Desired value of the barrier parameter */ + Number mu_target_; + //@} + + /** @name Caches for slacks */ + //@{ + CachedResults< SmartPtr > curr_slack_x_L_cache_; + CachedResults< SmartPtr > curr_slack_x_U_cache_; + CachedResults< SmartPtr > curr_slack_s_L_cache_; + CachedResults< SmartPtr > curr_slack_s_U_cache_; + CachedResults< SmartPtr > trial_slack_x_L_cache_; + CachedResults< SmartPtr > trial_slack_x_U_cache_; + CachedResults< SmartPtr > trial_slack_s_L_cache_; + CachedResults< SmartPtr > trial_slack_s_U_cache_; + Index num_adjusted_slack_x_L_; + Index num_adjusted_slack_x_U_; + Index num_adjusted_slack_s_L_; + Index num_adjusted_slack_s_U_; + //@} + + /** @name Cached for objective function stuff */ + //@{ + CachedResults curr_f_cache_; + CachedResults trial_f_cache_; + CachedResults< SmartPtr > curr_grad_f_cache_; + CachedResults< SmartPtr > trial_grad_f_cache_; + //@} + + /** @name Caches for barrier function stuff */ + //@{ + CachedResults curr_barrier_obj_cache_; + CachedResults trial_barrier_obj_cache_; + CachedResults< SmartPtr > curr_grad_barrier_obj_x_cache_; + CachedResults< SmartPtr > curr_grad_barrier_obj_s_cache_; + CachedResults< SmartPtr > grad_kappa_times_damping_x_cache_; + CachedResults< SmartPtr > grad_kappa_times_damping_s_cache_; + //@} + + /** @name Caches for constraint stuff */ + //@{ + CachedResults< SmartPtr > curr_c_cache_; + CachedResults< SmartPtr > trial_c_cache_; + CachedResults< SmartPtr > curr_d_cache_; + CachedResults< SmartPtr > trial_d_cache_; + CachedResults< SmartPtr > curr_d_minus_s_cache_; + CachedResults< SmartPtr > trial_d_minus_s_cache_; + CachedResults< SmartPtr > curr_jac_c_cache_; + CachedResults< SmartPtr > trial_jac_c_cache_; + CachedResults< SmartPtr > curr_jac_d_cache_; + CachedResults< SmartPtr > trial_jac_d_cache_; + CachedResults< SmartPtr > curr_jac_cT_times_vec_cache_; + CachedResults< SmartPtr > trial_jac_cT_times_vec_cache_; + CachedResults< SmartPtr > curr_jac_dT_times_vec_cache_; + CachedResults< SmartPtr > trial_jac_dT_times_vec_cache_; + CachedResults< SmartPtr > curr_jac_c_times_vec_cache_; + CachedResults< SmartPtr > curr_jac_d_times_vec_cache_; + CachedResults curr_constraint_violation_cache_; + CachedResults trial_constraint_violation_cache_; + CachedResults curr_nlp_constraint_violation_cache_; + CachedResults unscaled_curr_nlp_constraint_violation_cache_; + CachedResults unscaled_trial_nlp_constraint_violation_cache_; + //@} + + /** Cache for the exact Hessian */ + CachedResults< SmartPtr > curr_exact_hessian_cache_; + + /** @name Components of primal-dual error */ + //@{ + CachedResults< SmartPtr > curr_grad_lag_x_cache_; + CachedResults< SmartPtr > trial_grad_lag_x_cache_; + CachedResults< SmartPtr > curr_grad_lag_s_cache_; + CachedResults< SmartPtr > trial_grad_lag_s_cache_; + CachedResults< SmartPtr > curr_grad_lag_with_damping_x_cache_; + CachedResults< SmartPtr > curr_grad_lag_with_damping_s_cache_; + CachedResults< SmartPtr > curr_compl_x_L_cache_; + CachedResults< SmartPtr > curr_compl_x_U_cache_; + CachedResults< SmartPtr > curr_compl_s_L_cache_; + CachedResults< SmartPtr > curr_compl_s_U_cache_; + CachedResults< SmartPtr > trial_compl_x_L_cache_; + CachedResults< SmartPtr > trial_compl_x_U_cache_; + CachedResults< SmartPtr > trial_compl_s_L_cache_; + CachedResults< SmartPtr > trial_compl_s_U_cache_; + CachedResults< SmartPtr > curr_relaxed_compl_x_L_cache_; + CachedResults< SmartPtr > curr_relaxed_compl_x_U_cache_; + CachedResults< SmartPtr > curr_relaxed_compl_s_L_cache_; + CachedResults< SmartPtr > curr_relaxed_compl_s_U_cache_; + CachedResults curr_primal_infeasibility_cache_; + CachedResults trial_primal_infeasibility_cache_; + CachedResults curr_dual_infeasibility_cache_; + CachedResults trial_dual_infeasibility_cache_; + CachedResults unscaled_curr_dual_infeasibility_cache_; + CachedResults curr_complementarity_cache_; + CachedResults trial_complementarity_cache_; + CachedResults curr_centrality_measure_cache_; + CachedResults curr_nlp_error_cache_; + CachedResults unscaled_curr_nlp_error_cache_; + CachedResults curr_barrier_error_cache_; + CachedResults curr_primal_dual_system_error_cache_; + CachedResults trial_primal_dual_system_error_cache_; + //@} + + /** @name Caches for fraction to the boundary step sizes */ + //@{ + CachedResults primal_frac_to_the_bound_cache_; + CachedResults dual_frac_to_the_bound_cache_; + //@} + + /** @name Caches for sigma matrices */ + //@{ + CachedResults< SmartPtr > curr_sigma_x_cache_; + CachedResults< SmartPtr > curr_sigma_s_cache_; + //@} + + /** Cache for average of current complementarity */ + CachedResults curr_avrg_compl_cache_; + /** Cache for average of trial complementarity */ + CachedResults trial_avrg_compl_cache_; + + /** Cache for grad barrier obj. fn inner product with step */ + CachedResults curr_gradBarrTDelta_cache_; + + /** @name Indicator vectors required for the linear damping terms + * to handle unbounded solution sets. */ + //@{ + /** Indicator vector for selecting the elements in x that have + * only lower bounds. */ + SmartPtr dampind_x_L_; + /** Indicator vector for selecting the elements in x that have + * only upper bounds. */ + SmartPtr dampind_x_U_; + /** Indicator vector for selecting the elements in s that have + * only lower bounds. */ + SmartPtr dampind_s_L_; + /** Indicator vector for selecting the elements in s that have + * only upper bounds. */ + SmartPtr dampind_s_U_; + //@} + + /** @name Temporary vectors for intermediate calcuations. We keep + * these around to avoid unnecessarily many new allocations of + * Vectors. */ + //@{ + SmartPtr tmp_x_; + SmartPtr tmp_s_; + SmartPtr tmp_c_; + SmartPtr tmp_d_; + SmartPtr tmp_x_L_; + SmartPtr tmp_x_U_; + SmartPtr tmp_s_L_; + SmartPtr tmp_s_U_; + + /** Accessor methods for the temporary vectors */ + Vector& Tmp_x(); + Vector& Tmp_s(); + Vector& Tmp_c(); + Vector& Tmp_d(); + Vector& Tmp_x_L(); + Vector& Tmp_x_U(); + Vector& Tmp_s_L(); + Vector& Tmp_s_U(); + //@} + + /** flag indicating if Initialize method has been called (for + * debugging) */ + bool initialize_called_; + + /** @name Auxiliary functions */ + //@{ + /** Compute new vector containing the slack to a lower bound + * (uncached) + */ + SmartPtr CalcSlack_L(const Matrix& P, + const Vector& x, + const Vector& x_bound); + /** Compute new vector containing the slack to a upper bound + * (uncached) + */ + SmartPtr CalcSlack_U(const Matrix& P, + const Vector& x, + const Vector& x_bound); + /** Compute barrier term at given point + * (uncached) + */ + Number CalcBarrierTerm(Number mu, + const Vector& slack_x_L, + const Vector& slack_x_U, + const Vector& slack_s_L, + const Vector& slack_s_U); + + /** Compute complementarity for slack / multiplier pair */ + SmartPtr CalcCompl(const Vector& slack, + const Vector& mult); + + /** Compute fraction to the boundary parameter for lower and upper bounds */ + Number CalcFracToBound(const Vector& slack_L, + Vector& tmp_L, + const Matrix& P_L, + const Vector& slack_U, + Vector& tmp_U, + const Matrix& P_U, + const Vector& delta, + Number tau); + + /** Compute the scaling factors for the optimality error. */ + void ComputeOptimalityErrorScaling(const Vector& y_c, const Vector& y_d, + const Vector& z_L, const Vector& z_U, + const Vector& v_L, const Vector& v_U, + Number s_max, + Number& s_d, Number& s_c); + + /** Check if slacks are becoming too small. If slacks are + * becoming too small, they are change. The return value is the + * number of corrected slacks. */ + Index CalculateSafeSlack(SmartPtr& slack, + const SmartPtr& bound, + const SmartPtr& curr_point, + const SmartPtr& multiplier); + + /** Computes the indicator vectors that can be used to filter out + * those entries in the slack_... variables, that correspond to + * variables with only lower and upper bounds. This is required + * for the linear damping term in the barrier objective function + * to handle unbounded solution sets. */ + void ComputeDampingIndicators(SmartPtr& dampind_x_L, + SmartPtr& dampind_x_U, + SmartPtr& dampind_s_L, + SmartPtr& dampind_s_U); + + /** Check if we are in the restoration phase. Returns true, if the + * ip_nlp is of the type RestoIpoptNLP. ToDo: We probably want to + * handle this more elegant and don't have an explicit dependency + * here. Now I added this because otherwise the caching doesn't + * work properly since the restoration phase objective function + * depends on the current barrier parameter. */ + bool in_restoration_phase(); + + //@} + }; + +} // namespace Ipopt + +#endif diff --git a/thirdparty/windows/include/coin/IpJournalist.hpp b/thirdparty/windows/include/coin/IpJournalist.hpp index 25ccef9..7e1b69a 100644 --- a/thirdparty/windows/include/coin/IpJournalist.hpp +++ b/thirdparty/windows/include/coin/IpJournalist.hpp @@ -1,487 +1,497 @@ -// Copyright (C) 2004, 2009 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpJournalist.hpp 1587 2009-10-27 16:09:21Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPJOURNALIST_HPP__ -#define __IPJOURNALIST_HPP__ - -#include "IpoptConfig.h" -#include "IpTypes.hpp" -#include "IpReferenced.hpp" -#include "IpSmartPtr.hpp" - -#ifdef HAVE_CSTDARG -# include -#else -# ifdef HAVE_STDARG_H -# include -# else -# error "don't have header file for stdarg" -# endif -#endif - -#include -#include -#include - -namespace Ipopt -{ - - // forward declarations - class Journal; - class FileJournal; - - /**@name Journalist Enumerations. */ - //@{ - /** Print Level Enum. */ - enum EJournalLevel { - J_INSUPPRESSIBLE=-1, - J_NONE=0, - J_ERROR, - J_STRONGWARNING, - J_SUMMARY, - J_WARNING, - J_ITERSUMMARY, - J_DETAILED, - J_MOREDETAILED, - J_VECTOR, - J_MOREVECTOR, - J_MATRIX, - J_MOREMATRIX, - J_ALL, - J_LAST_LEVEL - }; - - /** Category Selection Enum. */ - enum EJournalCategory { - J_DBG=0, - J_STATISTICS, - J_MAIN, - J_INITIALIZATION, - J_BARRIER_UPDATE, - J_SOLVE_PD_SYSTEM, - J_FRAC_TO_BOUND, - J_LINEAR_ALGEBRA, - J_LINE_SEARCH, - J_HESSIAN_APPROXIMATION, - J_SOLUTION, - J_DOCUMENTATION, - J_NLP, - J_TIMING_STATISTICS, - J_USER_APPLICATION /** This can be used by the user's application*/ , - J_USER1 /** This can be used by the user's application*/ , - J_USER2 /** This can be used by the user's application*/ , - J_USER3 /** This can be used by the user's application*/ , - J_USER4 /** This can be used by the user's application*/ , - J_USER5 /** This can be used by the user's application*/ , - J_USER6 /** This can be used by the user's application*/ , - J_USER7 /** This can be used by the user's application*/ , - J_USER8 /** This can be used by the user's application*/ , - J_USER9 /** This can be used by the user's application*/ , - J_USER10 /** This can be used by the user's application*/ , - J_USER11 /** This can be used by the user's application*/ , - J_USER12 /** This can be used by the user's application*/ , - J_USER13 /** This can be used by the user's application*/ , - J_USER14 /** This can be used by the user's application*/ , - J_USER15 /** This can be used by the user's application*/ , - J_USER16 /** This can be used by the user's application*/ , - J_USER17 /** This can be used by the user's application*/ , - J_LAST_CATEGORY - }; - //@} - - /** Class responsible for all message output. - * This class is responsible for all messaging and output. - * The "printing" code or "author" should send ALL messages to the - * Journalist, indicating an appropriate category and print level. - * The journalist then decides, based on reader specified - * acceptance criteria, which message is actually printed in which - * journals. - * This allows the printing code to send everything, while the - * "reader" can decide what they really want to see. - * - * Authors: - * Authors use the - * Journals: You can add as many Journals as you like to the - * Journalist with the AddJournal or the AddFileJournal methods. - * Each one represents a different printing location (or file). - * Then, you can call the "print" methods of the Journalist to output - * information to each of the journals. - * - * Acceptance Criteria: Each print message should be flagged - * appropriately with an EJournalCategory and EJournalLevel. - * - * The AddFileJournal - * method returns a pointer to the newly created Journal object - * (if successful) so you can set Acceptance criteria for that - * particular location. - * - */ - class Journalist : public ReferencedObject - { - public: - /**@name Constructor / Desructor. */ - //@{ - /** Constructor. */ - Journalist(); - - /** Destructor... */ - virtual ~Journalist(); - //@} - - /**@name Author Methods. - * These methods are used by authoring code, or code that wants - * to report some information. - */ - //@{ - /** Method to print a formatted string */ - virtual void Printf(EJournalLevel level, EJournalCategory category, - const char* format, ...) const; - - /** Method to print a long string including indentation. The - * string is printed starting at the current position. If the - * position (counting started at the current position) exceeds - * max_length, a new line is inserted, and indent_spaces many - * spaces are printed before the string is continued. This is - * for example used during the printing of the option - * documentation. */ - virtual void PrintStringOverLines(EJournalLevel level, EJournalCategory category, - Index indent_spaces, Index max_length, - const std::string& line) const; - - /** Method to print a formatted string with indentation */ - virtual void PrintfIndented(EJournalLevel level, - EJournalCategory category, - Index indent_level, - const char* format, ...) const; - - /** Method to print a formatted string - * using the va_list argument. */ - virtual void VPrintf(EJournalLevel level, - EJournalCategory category, - const char* pformat, - va_list ap) const; - - /** Method to print a formatted string with indentation, - * using the va_list argument. */ - virtual void VPrintfIndented(EJournalLevel level, - EJournalCategory category, - Index indent_level, - const char* pformat, - va_list ap) const; - - /** Method that returns true if there is a Journal that would - * write output for the given JournalLevel and JournalCategory. - * This is useful if expensive computation would be required for - * a particular output. The author code can check with this - * method if the computations are indeed required. - */ - virtual bool ProduceOutput(EJournalLevel level, - EJournalCategory category) const; - - - /** Method that flushes the current buffer for all Journalists. - Calling this method after one optimization run helps to avoid - cluttering output with that produced by other parts of the - program (e.g. written in Fortran) */ - virtual void FlushBuffer() const; - //@} - - /**@name Reader Methods. - * These methods are used by the reader. The reader will setup the - * journalist with each output file and the acceptance - * criteria for that file. - * - * Use these methods to setup the journals (files or other output). - * These are the internal objects that keep track of the print levels - * for each category. Then use the internal Journal objects to - * set specific print levels for each category (or keep defaults). - * - */ - //@{ - /** Add a new journal. The location_name is a string identifier, - * which can be used to obtain the pointer to the new Journal at - * a later point using the GetJournal method. - * The default_level is - * used to initialize the * printing level for all categories. - */ - virtual bool AddJournal(const SmartPtr jrnl); - - /** Add a new FileJournal. fname is the name - * of the * file to which this Journal corresponds. Use - * fname="stdout" * for stdout, and use fname="stderr" for - * stderr. This method * returns the Journal pointer so you can - * set specific acceptance criteria. It returns NULL if there - * was a problem creating a new Journal. - */ - virtual SmartPtr AddFileJournal( - const std::string& location_name, /** identifier */ - const std::string& fname, - EJournalLevel default_level = J_WARNING - ); - - /** Get an existing journal. You can use this method to change - * the acceptance criteria at runtime. - */ - virtual SmartPtr GetJournal(const std::string& location_name); - - /** Delete all journals curently known by the journalist. */ - virtual void DeleteAllJournals(); - //@} - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Copy Constructor */ - Journalist(const Journalist&); - - /** Overloaded Equals Operator */ - void operator=(const Journalist&); - //@} - - //** Private Data Members. */ - //@{ - std::vector< SmartPtr > journals_; - //@} - }; - - /** Journal class (part of the Journalist implementation.). This - * class is the base class for all Journals. It controls the - * acceptance criteria for print statements etc. Derived classes - * like the FileJournal - output those messages to specific locations - */ - class Journal : public ReferencedObject - { - public: - /** Constructor. */ - Journal(const std::string& name, EJournalLevel default_level); - - /** Destructor. */ - virtual ~Journal(); - - /** Get the name of the Journal */ - virtual std::string Name(); - - /** Set the print level for a particular category. */ - virtual void SetPrintLevel( - EJournalCategory category, EJournalLevel level - ); - - /** Set the print level for all category. */ - virtual void SetAllPrintLevels( - EJournalLevel level - ); - - /**@name Journal Output Methods. These methods are called by the - * Journalist who first checks if the output print level and category - * are acceptable. - * Calling the Print methods explicitly (instead of through the - * Journalist will output the message regardless of print level - * and category. You should use the Journalist to print & flush instead - */ - //@{ - /** Ask if a particular print level/category is accepted by the - * journal. - */ - virtual bool IsAccepted( - EJournalCategory category, EJournalLevel level - ) const; - - /** Print to the designated output location */ - virtual void Print(EJournalCategory category, EJournalLevel level, - const char* str) - { - PrintImpl(category, level, str); - } - - /** Printf to the designated output location */ - virtual void Printf(EJournalCategory category, EJournalLevel level, - const char* pformat, va_list ap) - { - PrintfImpl(category, level, pformat, ap); - } - - /** Flush output buffer.*/ - virtual void FlushBuffer() - { - FlushBufferImpl(); - } - //@} - - protected: - /**@name Implementation version of Print methods. Derived classes - * should overload the Impl methods. - */ - //@{ - /** Print to the designated output location */ - virtual void PrintImpl(EJournalCategory category, EJournalLevel level, - const char* str)=0; - - /** Printf to the designated output location */ - virtual void PrintfImpl(EJournalCategory category, EJournalLevel level, - const char* pformat, va_list ap)=0; - - /** Flush output buffer.*/ - virtual void FlushBufferImpl()=0; - //@} - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - Journal(); - - /** Copy Constructor */ - Journal(const Journal&); - - /** Overloaded Equals Operator */ - void operator=(const Journal&); - //@} - - /** Name of the output location */ - std::string name_; - - /** vector of integers indicating the level for each category */ - Index print_levels_[J_LAST_CATEGORY]; - }; - - - /** FileJournal class. This is a particular Journal implementation that - * writes to a file for output. It can write to (stdout, stderr, or disk) - * by using "stdout" and "stderr" as filenames. - */ - class FileJournal : public Journal - { - public: - /** Constructor. */ - FileJournal(const std::string& name, EJournalLevel default_level); - - /** Destructor. */ - virtual ~FileJournal(); - - /** Open a new file for the output location. - * Special Names: stdout means stdout, - * : stderr means stderr. - * - * Return code is false only if the file with the given name - * could not be opened. - */ - virtual bool Open(const char* fname); - - protected: - /**@name Implementation version of Print methods - Overloaded from - * Journal base class. - */ - //@{ - /** Print to the designated output location */ - virtual void PrintImpl(EJournalCategory category, EJournalLevel level, - const char* str); - - /** Printf to the designated output location */ - virtual void PrintfImpl(EJournalCategory category, EJournalLevel level, - const char* pformat, va_list ap); - - /** Flush output buffer.*/ - virtual void FlushBufferImpl(); - //@} - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - FileJournal(); - - /** Copy Constructor */ - FileJournal(const FileJournal&); - - /** Overloaded Equals Operator */ - void operator=(const FileJournal&); - //@} - - /** FILE pointer for the output destination */ - FILE* file_; - }; - - /** StreamJournal class. This is a particular Journal implementation that - * writes to a stream for output. - */ - class StreamJournal : public Journal - { - public: - /** Constructor. */ - StreamJournal(const std::string& name, EJournalLevel default_level); - - /** Destructor. */ - virtual ~StreamJournal() - {} - - /** Setting the output stream pointer */ - void SetOutputStream(std::ostream* os); - - protected: - /**@name Implementation version of Print methods - Overloaded from - * Journal base class. - */ - //@{ - /** Print to the designated output location */ - virtual void PrintImpl(EJournalCategory category, EJournalLevel level, - const char* str); - - /** Printf to the designated output location */ - virtual void PrintfImpl(EJournalCategory category, EJournalLevel level, - const char* pformat, va_list ap); - - /** Flush output buffer.*/ - virtual void FlushBufferImpl(); - //@} - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - StreamJournal(); - - /** Copy Constructor */ - StreamJournal(const StreamJournal&); - - /** Overloaded Equals Operator */ - void operator=(const StreamJournal&); - //@} - - /** pointer to output stream for the output destination */ - std::ostream* os_; - - /** buffer for sprintf. Being generous in size here... */ - char buffer_[32768]; - }; -} - -#endif +// Copyright (C) 2004, 2009 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpJournalist.hpp 2204 2013-04-13 13:49:26Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPJOURNALIST_HPP__ +#define __IPJOURNALIST_HPP__ + +#include "IpoptConfig.h" +#include "IpTypes.hpp" +#include "IpReferenced.hpp" +#include "IpSmartPtr.hpp" + +#ifdef HAVE_CSTDARG +# include +#else +# ifdef HAVE_STDARG_H +# include +# else +# include // if this header is included by someone who does not define HAVE_CSTDARG or HAVE_STDARG, let's hope that cstdarg is available +# endif +#endif + +#ifdef HAVE_CSTDIO +# include +#else +# ifdef HAVE_STDIO_H +# include +# else +# include // if this header is included by someone who does not define HAVE_CSTDIO or HAVE_STDIO, let's hope that cstdio is available +# endif +#endif + +#include +#include +#include + +namespace Ipopt +{ + + // forward declarations + class Journal; + class FileJournal; + + /**@name Journalist Enumerations. */ + //@{ + /** Print Level Enum. */ + enum EJournalLevel { + J_INSUPPRESSIBLE=-1, + J_NONE=0, + J_ERROR, + J_STRONGWARNING, + J_SUMMARY, + J_WARNING, + J_ITERSUMMARY, + J_DETAILED, + J_MOREDETAILED, + J_VECTOR, + J_MOREVECTOR, + J_MATRIX, + J_MOREMATRIX, + J_ALL, + J_LAST_LEVEL + }; + + /** Category Selection Enum. */ + enum EJournalCategory { + J_DBG=0, + J_STATISTICS, + J_MAIN, + J_INITIALIZATION, + J_BARRIER_UPDATE, + J_SOLVE_PD_SYSTEM, + J_FRAC_TO_BOUND, + J_LINEAR_ALGEBRA, + J_LINE_SEARCH, + J_HESSIAN_APPROXIMATION, + J_SOLUTION, + J_DOCUMENTATION, + J_NLP, + J_TIMING_STATISTICS, + J_USER_APPLICATION /** This can be used by the user's application*/ , + J_USER1 /** This can be used by the user's application*/ , + J_USER2 /** This can be used by the user's application*/ , + J_USER3 /** This can be used by the user's application*/ , + J_USER4 /** This can be used by the user's application*/ , + J_USER5 /** This can be used by the user's application*/ , + J_USER6 /** This can be used by the user's application*/ , + J_USER7 /** This can be used by the user's application*/ , + J_USER8 /** This can be used by the user's application*/ , + J_USER9 /** This can be used by the user's application*/ , + J_USER10 /** This can be used by the user's application*/ , + J_USER11 /** This can be used by the user's application*/ , + J_USER12 /** This can be used by the user's application*/ , + J_USER13 /** This can be used by the user's application*/ , + J_USER14 /** This can be used by the user's application*/ , + J_USER15 /** This can be used by the user's application*/ , + J_USER16 /** This can be used by the user's application*/ , + J_USER17 /** This can be used by the user's application*/ , + J_LAST_CATEGORY + }; + //@} + + /** Class responsible for all message output. + * This class is responsible for all messaging and output. + * The "printing" code or "author" should send ALL messages to the + * Journalist, indicating an appropriate category and print level. + * The journalist then decides, based on reader specified + * acceptance criteria, which message is actually printed in which + * journals. + * This allows the printing code to send everything, while the + * "reader" can decide what they really want to see. + * + * Authors: + * Authors use the + * Journals: You can add as many Journals as you like to the + * Journalist with the AddJournal or the AddFileJournal methods. + * Each one represents a different printing location (or file). + * Then, you can call the "print" methods of the Journalist to output + * information to each of the journals. + * + * Acceptance Criteria: Each print message should be flagged + * appropriately with an EJournalCategory and EJournalLevel. + * + * The AddFileJournal + * method returns a pointer to the newly created Journal object + * (if successful) so you can set Acceptance criteria for that + * particular location. + * + */ + class Journalist : public ReferencedObject + { + public: + /**@name Constructor / Desructor. */ + //@{ + /** Constructor. */ + Journalist(); + + /** Destructor... */ + virtual ~Journalist(); + //@} + + /**@name Author Methods. + * These methods are used by authoring code, or code that wants + * to report some information. + */ + //@{ + /** Method to print a formatted string */ + virtual void Printf(EJournalLevel level, EJournalCategory category, + const char* format, ...) const; + + /** Method to print a long string including indentation. The + * string is printed starting at the current position. If the + * position (counting started at the current position) exceeds + * max_length, a new line is inserted, and indent_spaces many + * spaces are printed before the string is continued. This is + * for example used during the printing of the option + * documentation. */ + virtual void PrintStringOverLines(EJournalLevel level, EJournalCategory category, + Index indent_spaces, Index max_length, + const std::string& line) const; + + /** Method to print a formatted string with indentation */ + virtual void PrintfIndented(EJournalLevel level, + EJournalCategory category, + Index indent_level, + const char* format, ...) const; + + /** Method to print a formatted string + * using the va_list argument. */ + virtual void VPrintf(EJournalLevel level, + EJournalCategory category, + const char* pformat, + va_list ap) const; + + /** Method to print a formatted string with indentation, + * using the va_list argument. */ + virtual void VPrintfIndented(EJournalLevel level, + EJournalCategory category, + Index indent_level, + const char* pformat, + va_list ap) const; + + /** Method that returns true if there is a Journal that would + * write output for the given JournalLevel and JournalCategory. + * This is useful if expensive computation would be required for + * a particular output. The author code can check with this + * method if the computations are indeed required. + */ + virtual bool ProduceOutput(EJournalLevel level, + EJournalCategory category) const; + + + /** Method that flushes the current buffer for all Journalists. + Calling this method after one optimization run helps to avoid + cluttering output with that produced by other parts of the + program (e.g. written in Fortran) */ + virtual void FlushBuffer() const; + //@} + + /**@name Reader Methods. + * These methods are used by the reader. The reader will setup the + * journalist with each output file and the acceptance + * criteria for that file. + * + * Use these methods to setup the journals (files or other output). + * These are the internal objects that keep track of the print levels + * for each category. Then use the internal Journal objects to + * set specific print levels for each category (or keep defaults). + * + */ + //@{ + /** Add a new journal. The location_name is a string identifier, + * which can be used to obtain the pointer to the new Journal at + * a later point using the GetJournal method. + * The default_level is + * used to initialize the * printing level for all categories. + */ + virtual bool AddJournal(const SmartPtr jrnl); + + /** Add a new FileJournal. fname is the name + * of the * file to which this Journal corresponds. Use + * fname="stdout" * for stdout, and use fname="stderr" for + * stderr. This method * returns the Journal pointer so you can + * set specific acceptance criteria. It returns NULL if there + * was a problem creating a new Journal. + */ + virtual SmartPtr AddFileJournal( + const std::string& location_name, /**< journal identifier */ + const std::string& fname, /**< file name */ + EJournalLevel default_level = J_WARNING /**< default journal level */ + ); + + /** Get an existing journal. You can use this method to change + * the acceptance criteria at runtime. + */ + virtual SmartPtr GetJournal(const std::string& location_name); + + /** Delete all journals curently known by the journalist. */ + virtual void DeleteAllJournals(); + //@} + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Copy Constructor */ + Journalist(const Journalist&); + + /** Overloaded Equals Operator */ + void operator=(const Journalist&); + //@} + + //** Private Data Members. */ + //@{ + std::vector< SmartPtr > journals_; + //@} + }; + + /** Journal class (part of the Journalist implementation.). This + * class is the base class for all Journals. It controls the + * acceptance criteria for print statements etc. Derived classes + * like the FileJournal - output those messages to specific locations + */ + class Journal : public ReferencedObject + { + public: + /** Constructor. */ + Journal(const std::string& name, EJournalLevel default_level); + + /** Destructor. */ + virtual ~Journal(); + + /** Get the name of the Journal */ + virtual std::string Name(); + + /** Set the print level for a particular category. */ + virtual void SetPrintLevel( + EJournalCategory category, EJournalLevel level + ); + + /** Set the print level for all category. */ + virtual void SetAllPrintLevels( + EJournalLevel level + ); + + /**@name Journal Output Methods. These methods are called by the + * Journalist who first checks if the output print level and category + * are acceptable. + * Calling the Print methods explicitly (instead of through the + * Journalist will output the message regardless of print level + * and category. You should use the Journalist to print & flush instead + */ + //@{ + /** Ask if a particular print level/category is accepted by the + * journal. + */ + virtual bool IsAccepted( + EJournalCategory category, EJournalLevel level + ) const; + + /** Print to the designated output location */ + virtual void Print(EJournalCategory category, EJournalLevel level, + const char* str) + { + PrintImpl(category, level, str); + } + + /** Printf to the designated output location */ + virtual void Printf(EJournalCategory category, EJournalLevel level, + const char* pformat, va_list ap) + { + PrintfImpl(category, level, pformat, ap); + } + + /** Flush output buffer.*/ + virtual void FlushBuffer() + { + FlushBufferImpl(); + } + //@} + + protected: + /**@name Implementation version of Print methods. Derived classes + * should overload the Impl methods. + */ + //@{ + /** Print to the designated output location */ + virtual void PrintImpl(EJournalCategory category, EJournalLevel level, + const char* str)=0; + + /** Printf to the designated output location */ + virtual void PrintfImpl(EJournalCategory category, EJournalLevel level, + const char* pformat, va_list ap)=0; + + /** Flush output buffer.*/ + virtual void FlushBufferImpl()=0; + //@} + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + Journal(); + + /** Copy Constructor */ + Journal(const Journal&); + + /** Overloaded Equals Operator */ + void operator=(const Journal&); + //@} + + /** Name of the output location */ + std::string name_; + + /** vector of integers indicating the level for each category */ + Index print_levels_[J_LAST_CATEGORY]; + }; + + + /** FileJournal class. This is a particular Journal implementation that + * writes to a file for output. It can write to (stdout, stderr, or disk) + * by using "stdout" and "stderr" as filenames. + */ + class FileJournal : public Journal + { + public: + /** Constructor. */ + FileJournal(const std::string& name, EJournalLevel default_level); + + /** Destructor. */ + virtual ~FileJournal(); + + /** Open a new file for the output location. + * Special Names: stdout means stdout, + * : stderr means stderr. + * + * Return code is false only if the file with the given name + * could not be opened. + */ + virtual bool Open(const char* fname); + + protected: + /**@name Implementation version of Print methods - Overloaded from + * Journal base class. + */ + //@{ + /** Print to the designated output location */ + virtual void PrintImpl(EJournalCategory category, EJournalLevel level, + const char* str); + + /** Printf to the designated output location */ + virtual void PrintfImpl(EJournalCategory category, EJournalLevel level, + const char* pformat, va_list ap); + + /** Flush output buffer.*/ + virtual void FlushBufferImpl(); + //@} + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + FileJournal(); + + /** Copy Constructor */ + FileJournal(const FileJournal&); + + /** Overloaded Equals Operator */ + void operator=(const FileJournal&); + //@} + + /** FILE pointer for the output destination */ + FILE* file_; + }; + + /** StreamJournal class. This is a particular Journal implementation that + * writes to a stream for output. + */ + class StreamJournal : public Journal + { + public: + /** Constructor. */ + StreamJournal(const std::string& name, EJournalLevel default_level); + + /** Destructor. */ + virtual ~StreamJournal() + {} + + /** Setting the output stream pointer */ + void SetOutputStream(std::ostream* os); + + protected: + /**@name Implementation version of Print methods - Overloaded from + * Journal base class. + */ + //@{ + /** Print to the designated output location */ + virtual void PrintImpl(EJournalCategory category, EJournalLevel level, + const char* str); + + /** Printf to the designated output location */ + virtual void PrintfImpl(EJournalCategory category, EJournalLevel level, + const char* pformat, va_list ap); + + /** Flush output buffer.*/ + virtual void FlushBufferImpl(); + //@} + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + StreamJournal(); + + /** Copy Constructor */ + StreamJournal(const StreamJournal&); + + /** Overloaded Equals Operator */ + void operator=(const StreamJournal&); + //@} + + /** pointer to output stream for the output destination */ + std::ostream* os_; + + /** buffer for sprintf. Being generous in size here... */ + char buffer_[32768]; + }; +} + +#endif diff --git a/thirdparty/windows/include/coin/IpMatrix.hpp b/thirdparty/windows/include/coin/IpMatrix.hpp index 93b04e1..1f90e31 100644 --- a/thirdparty/windows/include/coin/IpMatrix.hpp +++ b/thirdparty/windows/include/coin/IpMatrix.hpp @@ -1,342 +1,344 @@ -// Copyright (C) 2004, 2008 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpMatrix.hpp 1280 2008-08-10 21:19:31Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPMATRIX_HPP__ -#define __IPMATRIX_HPP__ - -#include "IpVector.hpp" - -namespace Ipopt -{ - - /* forward declarations */ - class MatrixSpace; - - /** Matrix Base Class. This is the base class for all derived matrix - * types. All Matrices, such as Jacobian and Hessian matrices, as - * well as possibly the iteration matrices needed for the step - * computation, are of this type. - * - * Deriving from Matrix: Overload the protected XXX_Impl method. - */ - class Matrix : public TaggedObject - { - public: - /** @name Constructor/Destructor */ - //@{ - /** Constructor. It has to be given a pointer to the - * corresponding MatrixSpace. - */ - Matrix(const MatrixSpace* owner_space) - : - TaggedObject(), - owner_space_(owner_space), - valid_cache_tag_(0) - {} - - /** Destructor */ - virtual ~Matrix() - {} - //@} - - /**@name Operations of the Matrix on a Vector */ - //@{ - /** Matrix-vector multiply. Computes y = alpha * Matrix * x + - * beta * y. Do not overload. Overload MultVectorImpl instead. - */ - void MultVector(Number alpha, const Vector& x, Number beta, - Vector& y) const - { - MultVectorImpl(alpha, x, beta, y); - } - - /** Matrix(transpose) vector multiply. Computes y = alpha * - * Matrix^T * x + beta * y. Do not overload. Overload - * TransMultVectorImpl instead. - */ - void TransMultVector(Number alpha, const Vector& x, Number beta, - Vector& y) const - { - TransMultVectorImpl(alpha, x, beta, y); - } - //@} - - /** @name Methods for specialized operations. A prototype - * implementation is provided, but for efficient implementation - * those should be specially implemented. - */ - //@{ - /** X = X + alpha*(Matrix S^{-1} Z). Should be implemented - * efficiently for the ExansionMatrix - */ - void AddMSinvZ(Number alpha, const Vector& S, const Vector& Z, - Vector& X) const; - - /** X = S^{-1} (r + alpha*Z*M^Td). Should be implemented - * efficiently for the ExansionMatrix - */ - void SinvBlrmZMTdBr(Number alpha, const Vector& S, - const Vector& R, const Vector& Z, - const Vector& D, Vector& X) const; - //@} - - /** Method for determining if all stored numbers are valid (i.e., - * no Inf or Nan). */ - bool HasValidNumbers() const; - - /** @name Information about the size of the matrix */ - //@{ - /** Number of rows */ - Index NRows() const; - - /** Number of columns */ - Index NCols() const; - //@} - - /** @name Norms of the individual rows and columns */ - //@{ - /** Compute the max-norm of the rows in the matrix. The result is - * stored in rows_norms. The vector is assumed to be initialized - * of init is false. */ - void ComputeRowAMax(Vector& rows_norms, bool init=true) const - { - DBG_ASSERT(NRows() == rows_norms.Dim()); - if (init) rows_norms.Set(0.); - ComputeRowAMaxImpl(rows_norms, init); - } - /** Compute the max-norm of the columns in the matrix. The result - * is stored in cols_norms The vector is assumed to be initialized - * of init is false. */ - void ComputeColAMax(Vector& cols_norms, bool init=true) const - { - DBG_ASSERT(NCols() == cols_norms.Dim()); - if (init) cols_norms.Set(0.); - ComputeColAMaxImpl(cols_norms, init); - } - //@} - - /** Print detailed information about the matrix. Do not overload. - * Overload PrintImpl instead. - */ - //@{ - virtual void Print(SmartPtr jnlst, - EJournalLevel level, - EJournalCategory category, - const std::string& name, - Index indent=0, - const std::string& prefix="") const; - virtual void Print(const Journalist& jnlst, - EJournalLevel level, - EJournalCategory category, - const std::string& name, - Index indent=0, - const std::string& prefix="") const; - //@} - - /** Return the owner MatrixSpace*/ - SmartPtr OwnerSpace() const; - - protected: - /** @name implementation methods (derived classes MUST - * overload these pure virtual protected methods. - */ - //@{ - /** Matrix-vector multiply. Computes y = alpha * Matrix * x + - * beta * y - */ - virtual void MultVectorImpl(Number alpha, const Vector& x, Number beta, Vector& y) const =0; - - /** Matrix(transpose) vector multiply. - * Computes y = alpha * Matrix^T * x + beta * y - */ - virtual void TransMultVectorImpl(Number alpha, const Vector& x, Number beta, Vector& y) const =0; - - /** X = X + alpha*(Matrix S^{-1} Z). Prototype for this - * specialize method is provided, but for efficient - * implementation it should be overloaded for the expansion matrix. - */ - virtual void AddMSinvZImpl(Number alpha, const Vector& S, const Vector& Z, - Vector& X) const; - - /** X = S^{-1} (r + alpha*Z*M^Td). Should be implemented - * efficiently for the ExpansionMatrix. - */ - virtual void SinvBlrmZMTdBrImpl(Number alpha, const Vector& S, - const Vector& R, const Vector& Z, - const Vector& D, Vector& X) const; - - /** Method for determining if all stored numbers are valid (i.e., - * no Inf or Nan). A default implementation always returning true - * is provided, but if possible it should be implemented. */ - virtual bool HasValidNumbersImpl() const - { - return true; - } - - /** Compute the max-norm of the rows in the matrix. The result is - * stored in rows_norms. The vector is assumed to be - * initialized. */ - virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const = 0; - /** Compute the max-norm of the columns in the matrix. The result - * is stored in cols_norms. The vector is assumed to be - * initialized. */ - virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const = 0; - - /** Print detailed information about the matrix. */ - virtual void PrintImpl(const Journalist& jnlst, - EJournalLevel level, - EJournalCategory category, - const std::string& name, - Index indent, - const std::string& prefix) const =0; - //@} - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** default constructor */ - Matrix(); - - /** Copy constructor */ - Matrix(const Matrix&); - - /** Overloaded Equals Operator */ - Matrix& operator=(const Matrix&); - //@} - - const SmartPtr owner_space_; - - /**@name CachedResults data members */ - //@{ - mutable TaggedObject::Tag valid_cache_tag_; - mutable bool cached_valid_; - //@} - }; - - - /** MatrixSpace base class, corresponding to the Matrix base class. - * For each Matrix implementation, a corresponding MatrixSpace has - * to be implemented. A MatrixSpace is able to create new Matrices - * of a specific type. The MatrixSpace should also store - * information that is common to all Matrices of that type. For - * example, the dimensions of a Matrix is stored in the MatrixSpace - * base class. - */ - class MatrixSpace : public ReferencedObject - { - public: - /** @name Constructors/Destructors */ - //@{ - /** Constructor, given the number rows and columns of all matrices - * generated by this MatrixSpace. - */ - MatrixSpace(Index nRows, Index nCols) - : - nRows_(nRows), - nCols_(nCols) - {} - - /** Destructor */ - virtual ~MatrixSpace() - {} - //@} - - /** Pure virtual method for creating a new Matrix of the - * corresponding type. - */ - virtual Matrix* MakeNew() const=0; - - /** Accessor function for the number of rows. */ - Index NRows() const - { - return nRows_; - } - /** Accessor function for the number of columns. */ - Index NCols() const - { - return nCols_; - } - - /** Method to test if a given matrix belongs to a particular - * matrix space. - */ - bool IsMatrixFromSpace(const Matrix& matrix) const - { - return (matrix.OwnerSpace() == this); - } - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** default constructor */ - MatrixSpace(); - - /** Copy constructor */ - MatrixSpace(const MatrixSpace&); - - /** Overloaded Equals Operator */ - MatrixSpace& operator=(const MatrixSpace&); - //@} - - /** Number of rows for all matrices of this type. */ - const Index nRows_; - /** Number of columns for all matrices of this type. */ - const Index nCols_; - }; - - - /* Inline Methods */ - inline - Index Matrix::NRows() const - { - return owner_space_->NRows(); - } - - inline - Index Matrix::NCols() const - { - return owner_space_->NCols(); - } - - inline - SmartPtr Matrix::OwnerSpace() const - { - return owner_space_; - } - -} // namespace Ipopt - -// Macro definitions for debugging matrices -#if COIN_IPOPT_VERBOSITY == 0 -# define DBG_PRINT_MATRIX(__verbose_level, __mat_name, __mat) -#else -# define DBG_PRINT_MATRIX(__verbose_level, __mat_name, __mat) \ - if (dbg_jrnl.Verbosity() >= (__verbose_level)) { \ - if (dbg_jrnl.Jnlst()!=NULL) { \ - (__mat).Print(dbg_jrnl.Jnlst(), \ - J_ERROR, J_DBG, \ - __mat_name, \ - dbg_jrnl.IndentationLevel()*2, \ - "# "); \ - } \ - } -#endif // #if COIN_IPOPT_VERBOSITY == 0 - -#endif +// Copyright (C) 2004, 2008 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpMatrix.hpp 2276 2013-05-05 12:33:44Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPMATRIX_HPP__ +#define __IPMATRIX_HPP__ + +#include "IpVector.hpp" + +namespace Ipopt +{ + + /* forward declarations */ + class MatrixSpace; + + /** Matrix Base Class. This is the base class for all derived matrix + * types. All Matrices, such as Jacobian and Hessian matrices, as + * well as possibly the iteration matrices needed for the step + * computation, are of this type. + * + * Deriving from Matrix: Overload the protected XXX_Impl method. + */ + class Matrix : public TaggedObject + { + public: + /** @name Constructor/Destructor */ + //@{ + /** Constructor. It has to be given a pointer to the + * corresponding MatrixSpace. + */ + Matrix(const MatrixSpace* owner_space) + : + TaggedObject(), + owner_space_(owner_space) + {} + + /** Destructor */ + virtual ~Matrix() + {} + //@} + + /**@name Operations of the Matrix on a Vector */ + //@{ + /** Matrix-vector multiply. Computes y = alpha * Matrix * x + + * beta * y. Do not overload. Overload MultVectorImpl instead. + */ + void MultVector(Number alpha, const Vector& x, Number beta, + Vector& y) const + { + MultVectorImpl(alpha, x, beta, y); + } + + /** Matrix(transpose) vector multiply. Computes y = alpha * + * Matrix^T * x + beta * y. Do not overload. Overload + * TransMultVectorImpl instead. + */ + void TransMultVector(Number alpha, const Vector& x, Number beta, + Vector& y) const + { + TransMultVectorImpl(alpha, x, beta, y); + } + //@} + + /** @name Methods for specialized operations. A prototype + * implementation is provided, but for efficient implementation + * those should be specially implemented. + */ + //@{ + /** X = X + alpha*(Matrix S^{-1} Z). Should be implemented + * efficiently for the ExansionMatrix + */ + void AddMSinvZ(Number alpha, const Vector& S, const Vector& Z, + Vector& X) const; + + /** X = S^{-1} (r + alpha*Z*M^Td). Should be implemented + * efficiently for the ExansionMatrix + */ + void SinvBlrmZMTdBr(Number alpha, const Vector& S, + const Vector& R, const Vector& Z, + const Vector& D, Vector& X) const; + //@} + + /** Method for determining if all stored numbers are valid (i.e., + * no Inf or Nan). */ + bool HasValidNumbers() const; + + /** @name Information about the size of the matrix */ + //@{ + /** Number of rows */ + inline + Index NRows() const; + + /** Number of columns */ + inline + Index NCols() const; + //@} + + /** @name Norms of the individual rows and columns */ + //@{ + /** Compute the max-norm of the rows in the matrix. The result is + * stored in rows_norms. The vector is assumed to be initialized + * of init is false. */ + void ComputeRowAMax(Vector& rows_norms, bool init=true) const + { + DBG_ASSERT(NRows() == rows_norms.Dim()); + if (init) rows_norms.Set(0.); + ComputeRowAMaxImpl(rows_norms, init); + } + /** Compute the max-norm of the columns in the matrix. The result + * is stored in cols_norms The vector is assumed to be initialized + * of init is false. */ + void ComputeColAMax(Vector& cols_norms, bool init=true) const + { + DBG_ASSERT(NCols() == cols_norms.Dim()); + if (init) cols_norms.Set(0.); + ComputeColAMaxImpl(cols_norms, init); + } + //@} + + /** Print detailed information about the matrix. Do not overload. + * Overload PrintImpl instead. + */ + //@{ + virtual void Print(SmartPtr jnlst, + EJournalLevel level, + EJournalCategory category, + const std::string& name, + Index indent=0, + const std::string& prefix="") const; + virtual void Print(const Journalist& jnlst, + EJournalLevel level, + EJournalCategory category, + const std::string& name, + Index indent=0, + const std::string& prefix="") const; + //@} + + /** Return the owner MatrixSpace*/ + inline + SmartPtr OwnerSpace() const; + + protected: + /** @name implementation methods (derived classes MUST + * overload these pure virtual protected methods. + */ + //@{ + /** Matrix-vector multiply. Computes y = alpha * Matrix * x + + * beta * y + */ + virtual void MultVectorImpl(Number alpha, const Vector& x, Number beta, Vector& y) const =0; + + /** Matrix(transpose) vector multiply. + * Computes y = alpha * Matrix^T * x + beta * y + */ + virtual void TransMultVectorImpl(Number alpha, const Vector& x, Number beta, Vector& y) const =0; + + /** X = X + alpha*(Matrix S^{-1} Z). Prototype for this + * specialize method is provided, but for efficient + * implementation it should be overloaded for the expansion matrix. + */ + virtual void AddMSinvZImpl(Number alpha, const Vector& S, const Vector& Z, + Vector& X) const; + + /** X = S^{-1} (r + alpha*Z*M^Td). Should be implemented + * efficiently for the ExpansionMatrix. + */ + virtual void SinvBlrmZMTdBrImpl(Number alpha, const Vector& S, + const Vector& R, const Vector& Z, + const Vector& D, Vector& X) const; + + /** Method for determining if all stored numbers are valid (i.e., + * no Inf or Nan). A default implementation always returning true + * is provided, but if possible it should be implemented. */ + virtual bool HasValidNumbersImpl() const + { + return true; + } + + /** Compute the max-norm of the rows in the matrix. The result is + * stored in rows_norms. The vector is assumed to be + * initialized. */ + virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const = 0; + /** Compute the max-norm of the columns in the matrix. The result + * is stored in cols_norms. The vector is assumed to be + * initialized. */ + virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const = 0; + + /** Print detailed information about the matrix. */ + virtual void PrintImpl(const Journalist& jnlst, + EJournalLevel level, + EJournalCategory category, + const std::string& name, + Index indent, + const std::string& prefix) const =0; + //@} + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** default constructor */ + Matrix(); + + /** Copy constructor */ + Matrix(const Matrix&); + + /** Overloaded Equals Operator */ + Matrix& operator=(const Matrix&); + //@} + + const SmartPtr owner_space_; + + /**@name CachedResults data members */ + //@{ + mutable TaggedObject::Tag valid_cache_tag_; + mutable bool cached_valid_; + //@} + }; + + + /** MatrixSpace base class, corresponding to the Matrix base class. + * For each Matrix implementation, a corresponding MatrixSpace has + * to be implemented. A MatrixSpace is able to create new Matrices + * of a specific type. The MatrixSpace should also store + * information that is common to all Matrices of that type. For + * example, the dimensions of a Matrix is stored in the MatrixSpace + * base class. + */ + class MatrixSpace : public ReferencedObject + { + public: + /** @name Constructors/Destructors */ + //@{ + /** Constructor, given the number rows and columns of all matrices + * generated by this MatrixSpace. + */ + MatrixSpace(Index nRows, Index nCols) + : + nRows_(nRows), + nCols_(nCols) + {} + + /** Destructor */ + virtual ~MatrixSpace() + {} + //@} + + /** Pure virtual method for creating a new Matrix of the + * corresponding type. + */ + virtual Matrix* MakeNew() const=0; + + /** Accessor function for the number of rows. */ + Index NRows() const + { + return nRows_; + } + /** Accessor function for the number of columns. */ + Index NCols() const + { + return nCols_; + } + + /** Method to test if a given matrix belongs to a particular + * matrix space. + */ + bool IsMatrixFromSpace(const Matrix& matrix) const + { + return (matrix.OwnerSpace() == this); + } + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** default constructor */ + MatrixSpace(); + + /** Copy constructor */ + MatrixSpace(const MatrixSpace&); + + /** Overloaded Equals Operator */ + MatrixSpace& operator=(const MatrixSpace&); + //@} + + /** Number of rows for all matrices of this type. */ + const Index nRows_; + /** Number of columns for all matrices of this type. */ + const Index nCols_; + }; + + + /* Inline Methods */ + inline + Index Matrix::NRows() const + { + return owner_space_->NRows(); + } + + inline + Index Matrix::NCols() const + { + return owner_space_->NCols(); + } + + inline + SmartPtr Matrix::OwnerSpace() const + { + return owner_space_; + } + +} // namespace Ipopt + +// Macro definitions for debugging matrices +#if COIN_IPOPT_VERBOSITY == 0 +# define DBG_PRINT_MATRIX(__verbose_level, __mat_name, __mat) +#else +# define DBG_PRINT_MATRIX(__verbose_level, __mat_name, __mat) \ + if (dbg_jrnl.Verbosity() >= (__verbose_level)) { \ + if (dbg_jrnl.Jnlst()!=NULL) { \ + (__mat).Print(dbg_jrnl.Jnlst(), \ + J_ERROR, J_DBG, \ + __mat_name, \ + dbg_jrnl.IndentationLevel()*2, \ + "# "); \ + } \ + } +#endif // #if COIN_IPOPT_VERBOSITY == 0 + +#endif diff --git a/thirdparty/windows/include/coin/IpNLP.hpp b/thirdparty/windows/include/coin/IpNLP.hpp index 20ee64b..814f089 100644 --- a/thirdparty/windows/include/coin/IpNLP.hpp +++ b/thirdparty/windows/include/coin/IpNLP.hpp @@ -1,243 +1,243 @@ -// Copyright (C) 2004, 2006 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpNLP.hpp 1312 2008-08-29 22:21:40Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPNLP_HPP__ -#define __IPNLP_HPP__ - -#include "IpUtils.hpp" -#include "IpVector.hpp" -#include "IpSmartPtr.hpp" -#include "IpMatrix.hpp" -#include "IpSymMatrix.hpp" -#include "IpOptionsList.hpp" -#include "IpAlgTypes.hpp" -#include "IpReturnCodes.hpp" - -namespace Ipopt -{ - // forward declarations - class IpoptData; - class IpoptCalculatedQuantities; - class IteratesVector; - - /** Brief Class Description. - * Detailed Class Description. - */ - class NLP : public ReferencedObject - { - public: - /**@name Constructors/Destructors */ - //@{ - /** Default constructor */ - NLP() - {} - - /** Default destructor */ - virtual ~NLP() - {} - //@} - - /** Exceptions */ - //@{ - DECLARE_STD_EXCEPTION(USER_SCALING_NOT_IMPLEMENTED); - DECLARE_STD_EXCEPTION(INVALID_NLP); - //@} - - /** @name NLP Initialization (overload in - * derived classes).*/ - //@{ - /** Overload if you want the chance to process options or parameters that - * may be specific to the NLP */ - virtual bool ProcessOptions(const OptionsList& options, - const std::string& prefix) - { - return true; - } - - /** Method for creating the derived vector / matrix types. The - * Hess_lagrangian_space pointer can be NULL if a quasi-Newton - * options is chosen. */ - virtual bool GetSpaces(SmartPtr& x_space, - SmartPtr& c_space, - SmartPtr& d_space, - SmartPtr& x_l_space, - SmartPtr& px_l_space, - SmartPtr& x_u_space, - SmartPtr& px_u_space, - SmartPtr& d_l_space, - SmartPtr& pd_l_space, - SmartPtr& d_u_space, - SmartPtr& pd_u_space, - SmartPtr& Jac_c_space, - SmartPtr& Jac_d_space, - SmartPtr& Hess_lagrangian_space)=0; - - /** Method for obtaining the bounds information */ - virtual bool GetBoundsInformation(const Matrix& Px_L, - Vector& x_L, - const Matrix& Px_U, - Vector& x_U, - const Matrix& Pd_L, - Vector& d_L, - const Matrix& Pd_U, - Vector& d_U)=0; - - /** Method for obtaining the starting point for all the - * iterates. ToDo it might not make sense to ask for initial - * values for v_L and v_U? */ - virtual bool GetStartingPoint( - SmartPtr x, - bool need_x, - SmartPtr y_c, - bool need_y_c, - SmartPtr y_d, - bool need_y_d, - SmartPtr z_L, - bool need_z_L, - SmartPtr z_U, - bool need_z_U - )=0; - - /** Method for obtaining an entire iterate as a warmstart point. - * The incoming IteratesVector has to be filled. The default - * dummy implementation returns false. */ - virtual bool GetWarmStartIterate(IteratesVector& warm_start_iterate) - { - return false; - } - //@} - - /** @name NLP evaluation routines (overload - * in derived classes. */ - //@{ - virtual bool Eval_f(const Vector& x, Number& f) = 0; - - virtual bool Eval_grad_f(const Vector& x, Vector& g_f) = 0; - - virtual bool Eval_c(const Vector& x, Vector& c) = 0; - - virtual bool Eval_jac_c(const Vector& x, Matrix& jac_c) = 0; - - virtual bool Eval_d(const Vector& x, Vector& d) = 0; - - virtual bool Eval_jac_d(const Vector& x, Matrix& jac_d) = 0; - - virtual bool Eval_h(const Vector& x, - Number obj_factor, - const Vector& yc, - const Vector& yd, - SymMatrix& h) = 0; - //@} - - /** @name NLP solution routines. Have default dummy - * implementations that can be overloaded. */ - //@{ - /** This method is called at the very end of the optimization. It - * provides the final iterate to the user, so that it can be - * stored as the solution. The status flag indicates the outcome - * of the optimization, where SolverReturn is defined in - * IpAlgTypes.hpp. */ - virtual void FinalizeSolution(SolverReturn status, - const Vector& x, const Vector& z_L, - const Vector& z_U, - const Vector& c, const Vector& d, - const Vector& y_c, const Vector& y_d, - Number obj_value, - const IpoptData* ip_data, - IpoptCalculatedQuantities* ip_cq) - {} - - /** This method is called once per iteration, after the iteration - * summary output has been printed. It provides the current - * information to the user to do with it anything she wants. It - * also allows the user to ask for a premature termination of the - * optimization by returning false, in which case Ipopt will - * terminate with a corresponding return status. The basic - * information provided in the argument list has the quantities - * values printed in the iteration summary line. If more - * information is required, a user can obtain it from the IpData - * and IpCalculatedQuantities objects. However, note that the - * provided quantities are all for the problem that Ipopt sees, - * i.e., the quantities might be scaled, fixed variables might be - * sorted out, etc. The status indicates things like whether the - * algorithm is in the restoration phase... In the restoration - * phase, the dual variables are probably not not changing. */ - virtual bool IntermediateCallBack(AlgorithmMode mode, - Index iter, Number obj_value, - Number inf_pr, Number inf_du, - Number mu, Number d_norm, - Number regularization_size, - Number alpha_du, Number alpha_pr, - Index ls_trials, - const IpoptData* ip_data, - IpoptCalculatedQuantities* ip_cq) - { - return true; - } - //@} - - /** Routines to get the scaling parameters. These do not need to - * be overloaded unless the options are set for User scaling - */ - //@{ - virtual void GetScalingParameters( - const SmartPtr x_space, - const SmartPtr c_space, - const SmartPtr d_space, - Number& obj_scaling, - SmartPtr& x_scaling, - SmartPtr& c_scaling, - SmartPtr& d_scaling) const - { - THROW_EXCEPTION(USER_SCALING_NOT_IMPLEMENTED, - "You have set options for user provided scaling, but have" - " not implemented GetScalingParameters in the NLP interface"); - } - //@} - - /** Method for obtaining the subspace in which the limited-memory - * Hessian approximation should be done. This is only called if - * the limited-memory Hessian approximation is chosen. Since the - * Hessian is zero in the space of all variables that appear in - * the problem functions only linearly, this allows the user to - * provide a VectorSpace for all nonlinear variables, and an - * ExpansionMatrix to lift from this VectorSpace to the - * VectorSpace of the primal variables x. If the returned values - * are NULL, it is assumed that the Hessian is to be approximated - * in the space of all x variables. The default instantiation of - * this method returns NULL, and a user only has to overwrite - * this method if the approximation is to be done only in a - * subspace. */ - virtual void - GetQuasiNewtonApproximationSpaces(SmartPtr& approx_space, - SmartPtr& P_approx) - { - approx_space = NULL; - P_approx = NULL; - } - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Copy Constructor */ - NLP(const NLP&); - - /** Overloaded Equals Operator */ - void operator=(const NLP&); - //@} - }; - -} // namespace Ipopt - -#endif +// Copyright (C) 2004, 2006 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpNLP.hpp 1861 2010-12-21 21:34:47Z andreasw $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPNLP_HPP__ +#define __IPNLP_HPP__ + +#include "IpUtils.hpp" +#include "IpVector.hpp" +#include "IpSmartPtr.hpp" +#include "IpMatrix.hpp" +#include "IpSymMatrix.hpp" +#include "IpOptionsList.hpp" +#include "IpAlgTypes.hpp" +#include "IpReturnCodes.hpp" + +namespace Ipopt +{ + // forward declarations + class IpoptData; + class IpoptCalculatedQuantities; + class IteratesVector; + + /** Brief Class Description. + * Detailed Class Description. + */ + class NLP : public ReferencedObject + { + public: + /**@name Constructors/Destructors */ + //@{ + /** Default constructor */ + NLP() + {} + + /** Default destructor */ + virtual ~NLP() + {} + //@} + + /** Exceptions */ + //@{ + DECLARE_STD_EXCEPTION(USER_SCALING_NOT_IMPLEMENTED); + DECLARE_STD_EXCEPTION(INVALID_NLP); + //@} + + /** @name NLP Initialization (overload in + * derived classes).*/ + //@{ + /** Overload if you want the chance to process options or parameters that + * may be specific to the NLP */ + virtual bool ProcessOptions(const OptionsList& options, + const std::string& prefix) + { + return true; + } + + /** Method for creating the derived vector / matrix types. The + * Hess_lagrangian_space pointer can be NULL if a quasi-Newton + * options is chosen. */ + virtual bool GetSpaces(SmartPtr& x_space, + SmartPtr& c_space, + SmartPtr& d_space, + SmartPtr& x_l_space, + SmartPtr& px_l_space, + SmartPtr& x_u_space, + SmartPtr& px_u_space, + SmartPtr& d_l_space, + SmartPtr& pd_l_space, + SmartPtr& d_u_space, + SmartPtr& pd_u_space, + SmartPtr& Jac_c_space, + SmartPtr& Jac_d_space, + SmartPtr& Hess_lagrangian_space)=0; + + /** Method for obtaining the bounds information */ + virtual bool GetBoundsInformation(const Matrix& Px_L, + Vector& x_L, + const Matrix& Px_U, + Vector& x_U, + const Matrix& Pd_L, + Vector& d_L, + const Matrix& Pd_U, + Vector& d_U)=0; + + /** Method for obtaining the starting point for all the + * iterates. ToDo it might not make sense to ask for initial + * values for v_L and v_U? */ + virtual bool GetStartingPoint( + SmartPtr x, + bool need_x, + SmartPtr y_c, + bool need_y_c, + SmartPtr y_d, + bool need_y_d, + SmartPtr z_L, + bool need_z_L, + SmartPtr z_U, + bool need_z_U + )=0; + + /** Method for obtaining an entire iterate as a warmstart point. + * The incoming IteratesVector has to be filled. The default + * dummy implementation returns false. */ + virtual bool GetWarmStartIterate(IteratesVector& warm_start_iterate) + { + return false; + } + //@} + + /** @name NLP evaluation routines (overload + * in derived classes. */ + //@{ + virtual bool Eval_f(const Vector& x, Number& f) = 0; + + virtual bool Eval_grad_f(const Vector& x, Vector& g_f) = 0; + + virtual bool Eval_c(const Vector& x, Vector& c) = 0; + + virtual bool Eval_jac_c(const Vector& x, Matrix& jac_c) = 0; + + virtual bool Eval_d(const Vector& x, Vector& d) = 0; + + virtual bool Eval_jac_d(const Vector& x, Matrix& jac_d) = 0; + + virtual bool Eval_h(const Vector& x, + Number obj_factor, + const Vector& yc, + const Vector& yd, + SymMatrix& h) = 0; + //@} + + /** @name NLP solution routines. Have default dummy + * implementations that can be overloaded. */ + //@{ + /** This method is called at the very end of the optimization. It + * provides the final iterate to the user, so that it can be + * stored as the solution. The status flag indicates the outcome + * of the optimization, where SolverReturn is defined in + * IpAlgTypes.hpp. */ + virtual void FinalizeSolution(SolverReturn status, + const Vector& x, const Vector& z_L, + const Vector& z_U, + const Vector& c, const Vector& d, + const Vector& y_c, const Vector& y_d, + Number obj_value, + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq) + {} + + /** This method is called once per iteration, after the iteration + * summary output has been printed. It provides the current + * information to the user to do with it anything she wants. It + * also allows the user to ask for a premature termination of the + * optimization by returning false, in which case Ipopt will + * terminate with a corresponding return status. The basic + * information provided in the argument list has the quantities + * values printed in the iteration summary line. If more + * information is required, a user can obtain it from the IpData + * and IpCalculatedQuantities objects. However, note that the + * provided quantities are all for the problem that Ipopt sees, + * i.e., the quantities might be scaled, fixed variables might be + * sorted out, etc. The status indicates things like whether the + * algorithm is in the restoration phase... In the restoration + * phase, the dual variables are probably not not changing. */ + virtual bool IntermediateCallBack(AlgorithmMode mode, + Index iter, Number obj_value, + Number inf_pr, Number inf_du, + Number mu, Number d_norm, + Number regularization_size, + Number alpha_du, Number alpha_pr, + Index ls_trials, + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq) + { + return true; + } + //@} + + /** Routines to get the scaling parameters. These do not need to + * be overloaded unless the options are set for User scaling + */ + //@{ + virtual void GetScalingParameters( + const SmartPtr x_space, + const SmartPtr c_space, + const SmartPtr d_space, + Number& obj_scaling, + SmartPtr& x_scaling, + SmartPtr& c_scaling, + SmartPtr& d_scaling) const + { + THROW_EXCEPTION(USER_SCALING_NOT_IMPLEMENTED, + "You have set options for user provided scaling, but have" + " not implemented GetScalingParameters in the NLP interface"); + } + //@} + + /** Method for obtaining the subspace in which the limited-memory + * Hessian approximation should be done. This is only called if + * the limited-memory Hessian approximation is chosen. Since the + * Hessian is zero in the space of all variables that appear in + * the problem functions only linearly, this allows the user to + * provide a VectorSpace for all nonlinear variables, and an + * ExpansionMatrix to lift from this VectorSpace to the + * VectorSpace of the primal variables x. If the returned values + * are NULL, it is assumed that the Hessian is to be approximated + * in the space of all x variables. The default instantiation of + * this method returns NULL, and a user only has to overwrite + * this method if the approximation is to be done only in a + * subspace. */ + virtual void + GetQuasiNewtonApproximationSpaces(SmartPtr& approx_space, + SmartPtr& P_approx) + { + approx_space = NULL; + P_approx = NULL; + } + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Copy Constructor */ + NLP(const NLP&); + + /** Overloaded Equals Operator */ + void operator=(const NLP&); + //@} + }; + +} // namespace Ipopt + +#endif diff --git a/thirdparty/windows/include/coin/IpObserver.hpp b/thirdparty/windows/include/coin/IpObserver.hpp index 55ef738..4c8ff7b 100644 --- a/thirdparty/windows/include/coin/IpObserver.hpp +++ b/thirdparty/windows/include/coin/IpObserver.hpp @@ -1,358 +1,366 @@ -// Copyright (C) 2004, 2006 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpObserver.hpp 1019 2007-06-24 03:52:34Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPOBSERVER_HPP__ -#define __IPOBSERVER_HPP__ - -#include "IpUtils.hpp" -#include -#include - -//#define IP_DEBUG_OBSERVER -#if COIN_IPOPT_CHECKLEVEL > 2 -# define IP_DEBUG_OBSERVER -#endif -#ifdef IP_DEBUG_OBSERVER -# include "IpDebug.hpp" -#endif - -namespace Ipopt -{ - /** Forward declarations */ - class Subject; - - /** Slight Variation of the Observer Design Pattern. - * This class implements the Observer class of the - * Observer Design Pattern. An Observer "Attach"es - * to a Subject, indicating that it would like to - * be notified of changes in the Subject. - * Any derived class wishing to recieve notifications - * from a Subject should inherit off of - * Observer and overload the protected method, - * RecieveNotification_(...). - */ - class Observer - { - public: -#ifdef IP_DEBUG_OBSERVER - - static const Index dbg_verbosity; -#endif - - /**@name Constructors/Destructors */ - //@{ - /** Default Constructor */ - Observer() - {} - - /** Default destructor */ - virtual ~Observer(); - //@} - - /** Enumeration specifying the type of notification */ - enum NotifyType - { - NT_All, - NT_BeingDestroyed, - NT_Changed - }; - - protected: - /** Derived classes should call this method - * to request an "Attach" to a Subject. Do - * not call "Attach" explicitly on the Subject - * since further processing is done here - */ - void RequestAttach(NotifyType notify_type, const Subject* subject); - - /** Derived classes should call this method - * to request a "Detach" to a Subject. Do - * not call "Detach" explicitly on the Subject - * since further processing is done here - */ - void RequestDetach(NotifyType notify_type, const Subject* subject); - - /** Derived classes should overload this method to - * recieve the requested notification from - * attached Subjects - */ - virtual void RecieveNotification(NotifyType notify_type, const Subject* subject)=0; - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Copy Constructor */ - Observer(const Observer&); - - /** Overloaded Equals Operator */ - void operator=(const Observer&); - //@} - - /** A list of the subjects currently being - * observed. */ - std::vector subjects_; - - /** Private Method for Recieving Notification - * should only be called by the friend class - * Subject. This method will, in turn, call - * the overloaded RecieveNotification method - * for the derived class to process. - */ - void ProcessNotification(NotifyType notify_type, const Subject* subject); - - friend class Subject; - }; - - /** Slight Variation of the Observer Design Pattern (Subject part). - * This class implements the Subject class of the Observer Design - * Pattern. An Observer "Attach"es to a Subject, indicating that it - * would like to be notified of changes in the Subject. Any - * derived class that is to be observed has to inherit off the - * Subject base class. If the subject needs to notify the - * Observer, it calls the Notify method. - */ - class Subject - { - public: -#ifdef IP_DEBUG_OBSERVER - - static const Index dbg_verbosity; -#endif - - /**@name Constructors/Destructors */ - //@{ - /** Default Constructor */ - Subject() - {} - - /** Default destructor */ - virtual ~Subject(); - //@} - - /**@name Methods to Add and Remove Observers. - * Currently, the notify_type flags are not used, - * and Observers are attached in general and will - * recieve all notifications (of the type requested - * and possibly of types not requested). It is - * up to the observer to ignore the types they - * are not interested in. The NotifyType in the - * parameter list is so a more efficient mechanism - * depending on type could be implemented later if - * necessary.*/ - //@{ - - /** Attach the specified observer - * (i.e., begin recieving notifications). */ - void AttachObserver(Observer::NotifyType notify_type, Observer* observer) const; - - /** Detach the specified observer - * (i.e., no longer recieve notifications). */ - void DetachObserver(Observer::NotifyType notify_type, Observer* observer) const; - //@} - - protected: - - void Notify(Observer::NotifyType notify_type) const; - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Copy Constructor */ - Subject(const Subject&); - - /** Overloaded Equals Operator */ - void operator=(const Subject&); - //@} - - mutable std::vector observers_; - - }; - - /* inline methods */ - inline - Observer::~Observer() - { -#ifdef IP_DEBUG_OBSERVER - DBG_START_METH("Observer::~Observer", dbg_verbosity); - if (DBG_VERBOSITY()>=1) { - for (Index i=0; i<(Index)subjects_.size(); i++) { - DBG_PRINT((1,"subjects_[%d] = 0x%x\n", i, subjects_[i])); - } - } -#endif - // Detach all subjects - for (Int i=(Int)(subjects_.size()-1); i>=0; i--) { -#ifdef IP_DEBUG_OBSERVER - DBG_PRINT((1,"About to detach subjects_[%d] = 0x%x\n", i, subjects_[i])); -#endif - - RequestDetach(NT_All, subjects_[i]); - } - } - - inline - void Observer::RequestAttach(NotifyType notify_type, const Subject* subject) - { -#ifdef IP_DEBUG_OBSERVER - DBG_START_METH("Observer::RequestAttach", dbg_verbosity); - - // Add the subject to the list if it does not already exist - std::vector::iterator attached_subject; - attached_subject = std::find(subjects_.begin(), subjects_.end(), subject); - DBG_ASSERT(attached_subject == subjects_.end()); - DBG_ASSERT(subject); -#endif - - // add the subject to the list - subjects_.push_back(subject); - // Attach the observer to the subject - subject->AttachObserver(notify_type, this); - } - - inline - void Observer::RequestDetach(NotifyType notify_type, const Subject* subject) - { -#ifdef IP_DEBUG_OBSERVER - DBG_START_METH("Observer::RequestDetach", dbg_verbosity); - DBG_PRINT((1, "Requesting detach of subject: 0x%x\n", subject)); - DBG_ASSERT(subject); -#endif - - if (subject) { - std::vector::iterator attached_subject; - attached_subject = std::find(subjects_.begin(), subjects_.end(), subject); -#ifdef IP_DEBUG_OBSERVER - - DBG_ASSERT(attached_subject != subjects_.end()); -#endif - - if (attached_subject != subjects_.end()) { -#ifdef IP_DEBUG_OBSERVER - DBG_PRINT((1, "Removing subject: 0x%x from the list\n", subject)); -#endif - - subjects_.erase(attached_subject); - } - - // Detach the observer from the subject - subject->DetachObserver(notify_type, this); - } - } - - inline - void Observer::ProcessNotification(NotifyType notify_type, const Subject* subject) - { -#ifdef IP_DEBUG_OBSERVER - DBG_START_METH("Observer::ProcessNotification", dbg_verbosity); - DBG_ASSERT(subject); -#endif - - if (subject) { - std::vector::iterator attached_subject; - attached_subject = std::find(subjects_.begin(), subjects_.end(), subject); - - // We must be processing a notification for a - // subject that was previously attached. -#ifdef IP_DEBUG_OBSERVER - - DBG_ASSERT(attached_subject != subjects_.end()); -#endif - - this->RecieveNotification(notify_type, subject); - - if (notify_type == NT_BeingDestroyed) { - // the subject is going away, remove it from our list - subjects_.erase(attached_subject); - } - } - } - - inline - Subject::~Subject() - { -#ifdef IP_DEBUG_OBSERVER - DBG_START_METH("Subject::~Subject", dbg_verbosity); -#endif - - std::vector::iterator iter; - for (iter = observers_.begin(); iter != observers_.end(); iter++) { - (*iter)->ProcessNotification(Observer::NT_BeingDestroyed, this); - } - } - - inline - void Subject::AttachObserver(Observer::NotifyType notify_type, Observer* observer) const - { -#ifdef IP_DEBUG_OBSERVER - DBG_START_METH("Subject::AttachObserver", dbg_verbosity); - // current implementation notifies all observers of everything - // they must filter the notifications that they are not interested - // in (i.e. a hub, not a router) - DBG_ASSERT(observer); - - std::vector::iterator attached_observer; - attached_observer = std::find(observers_.begin(), observers_.end(), observer); - DBG_ASSERT(attached_observer == observers_.end()); - - DBG_ASSERT(observer); -#endif - - observers_.push_back(observer); - } - - inline - void Subject::DetachObserver(Observer::NotifyType notify_type, Observer* observer) const - { -#ifdef IP_DEBUG_OBSERVER - DBG_START_METH("Subject::DetachObserver", dbg_verbosity); - DBG_ASSERT(observer); -#endif - - if (observer) { - std::vector::iterator attached_observer; - attached_observer = std::find(observers_.begin(), observers_.end(), observer); -#ifdef IP_DEBUG_OBSERVER - - DBG_ASSERT(attached_observer != observers_.end()); -#endif - - if (attached_observer != observers_.end()) { - observers_.erase(attached_observer); - } - } - } - - inline - void Subject::Notify(Observer::NotifyType notify_type) const - { -#ifdef IP_DEBUG_OBSERVER - DBG_START_METH("Subject::Notify", dbg_verbosity); -#endif - - std::vector::iterator iter; - for (iter = observers_.begin(); iter != observers_.end(); iter++) { - (*iter)->ProcessNotification(notify_type, this); - } - } - - -} // namespace Ipopt - -#endif +// Copyright (C) 2004, 2006 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpObserver.hpp 2161 2013-01-01 20:39:05Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPOBSERVER_HPP__ +#define __IPOBSERVER_HPP__ + +#include "IpUtils.hpp" +#include +#include + +//#define IP_DEBUG_OBSERVER +#if COIN_IPOPT_CHECKLEVEL > 2 +# define IP_DEBUG_OBSERVER +#endif +#ifdef IP_DEBUG_OBSERVER +# include "IpDebug.hpp" +#endif + +namespace Ipopt +{ + /** Forward declarations */ + class Subject; + + /** Slight Variation of the Observer Design Pattern. + * This class implements the Observer class of the + * Observer Design Pattern. An Observer "Attach"es + * to a Subject, indicating that it would like to + * be notified of changes in the Subject. + * Any derived class wishing to recieve notifications + * from a Subject should inherit off of + * Observer and overload the protected method, + * RecieveNotification_(...). + */ + class Observer + { + public: +#ifdef IP_DEBUG_OBSERVER + + static const Index dbg_verbosity; +#endif + + /**@name Constructors/Destructors */ + //@{ + /** Default Constructor */ + Observer() + {} + + /** Default destructor */ + inline + virtual ~Observer(); + //@} + + /** Enumeration specifying the type of notification */ + enum NotifyType + { + NT_All, + NT_BeingDestroyed, + NT_Changed + }; + + protected: + /** Derived classes should call this method + * to request an "Attach" to a Subject. Do + * not call "Attach" explicitly on the Subject + * since further processing is done here + */ + inline + void RequestAttach(NotifyType notify_type, const Subject* subject); + + /** Derived classes should call this method + * to request a "Detach" to a Subject. Do + * not call "Detach" explicitly on the Subject + * since further processing is done here + */ + inline + void RequestDetach(NotifyType notify_type, const Subject* subject); + + /** Derived classes should overload this method to + * recieve the requested notification from + * attached Subjects + */ + virtual void RecieveNotification(NotifyType notify_type, const Subject* subject)=0; + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Copy Constructor */ + Observer(const Observer&); + + /** Overloaded Equals Operator */ + void operator=(const Observer&); + //@} + + /** A list of the subjects currently being + * observed. */ + std::vector subjects_; + + /** Private Method for Recieving Notification + * should only be called by the friend class + * Subject. This method will, in turn, call + * the overloaded RecieveNotification method + * for the derived class to process. + */ + inline + void ProcessNotification(NotifyType notify_type, const Subject* subject); + + friend class Subject; + }; + + /** Slight Variation of the Observer Design Pattern (Subject part). + * This class implements the Subject class of the Observer Design + * Pattern. An Observer "Attach"es to a Subject, indicating that it + * would like to be notified of changes in the Subject. Any + * derived class that is to be observed has to inherit off the + * Subject base class. If the subject needs to notify the + * Observer, it calls the Notify method. + */ + class Subject + { + public: +#ifdef IP_DEBUG_OBSERVER + + static const Index dbg_verbosity; +#endif + + /**@name Constructors/Destructors */ + //@{ + /** Default Constructor */ + Subject() + {} + + /** Default destructor */ + inline + virtual ~Subject(); + //@} + + /**@name Methods to Add and Remove Observers. + * Currently, the notify_type flags are not used, + * and Observers are attached in general and will + * recieve all notifications (of the type requested + * and possibly of types not requested). It is + * up to the observer to ignore the types they + * are not interested in. The NotifyType in the + * parameter list is so a more efficient mechanism + * depending on type could be implemented later if + * necessary.*/ + //@{ + + /** Attach the specified observer + * (i.e., begin recieving notifications). */ + inline + void AttachObserver(Observer::NotifyType notify_type, Observer* observer) const; + + /** Detach the specified observer + * (i.e., no longer recieve notifications). */ + inline + void DetachObserver(Observer::NotifyType notify_type, Observer* observer) const; + //@} + + protected: + + inline + void Notify(Observer::NotifyType notify_type) const; + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Copy Constructor */ + Subject(const Subject&); + + /** Overloaded Equals Operator */ + void operator=(const Subject&); + //@} + + mutable std::vector observers_; + + }; + + /* inline methods */ + inline + Observer::~Observer() + { +#ifdef IP_DEBUG_OBSERVER + DBG_START_METH("Observer::~Observer", dbg_verbosity); + if (DBG_VERBOSITY()>=1) { + for (Index i=0; i<(Index)subjects_.size(); i++) { + DBG_PRINT((1,"subjects_[%d] = 0x%x\n", i, subjects_[i])); + } + } +#endif + // Detach all subjects + for (Int i=(Int)(subjects_.size()-1); i>=0; i--) { +#ifdef IP_DEBUG_OBSERVER + DBG_PRINT((1,"About to detach subjects_[%d] = 0x%x\n", i, subjects_[i])); +#endif + + RequestDetach(NT_All, subjects_[i]); + } + } + + inline + void Observer::RequestAttach(NotifyType notify_type, const Subject* subject) + { +#ifdef IP_DEBUG_OBSERVER + DBG_START_METH("Observer::RequestAttach", dbg_verbosity); + + // Add the subject to the list if it does not already exist + std::vector::iterator attached_subject; + attached_subject = std::find(subjects_.begin(), subjects_.end(), subject); + DBG_ASSERT(attached_subject == subjects_.end()); + DBG_ASSERT(subject); +#endif + + // add the subject to the list + subjects_.push_back(subject); + // Attach the observer to the subject + subject->AttachObserver(notify_type, this); + } + + inline + void Observer::RequestDetach(NotifyType notify_type, const Subject* subject) + { +#ifdef IP_DEBUG_OBSERVER + DBG_START_METH("Observer::RequestDetach", dbg_verbosity); + DBG_PRINT((1, "Requesting detach of subject: 0x%x\n", subject)); + DBG_ASSERT(subject); +#endif + + if (subject) { + std::vector::iterator attached_subject; + attached_subject = std::find(subjects_.begin(), subjects_.end(), subject); +#ifdef IP_DEBUG_OBSERVER + + DBG_ASSERT(attached_subject != subjects_.end()); +#endif + + if (attached_subject != subjects_.end()) { +#ifdef IP_DEBUG_OBSERVER + DBG_PRINT((1, "Removing subject: 0x%x from the list\n", subject)); +#endif + + subjects_.erase(attached_subject); + } + + // Detach the observer from the subject + subject->DetachObserver(notify_type, this); + } + } + + inline + void Observer::ProcessNotification(NotifyType notify_type, const Subject* subject) + { +#ifdef IP_DEBUG_OBSERVER + DBG_START_METH("Observer::ProcessNotification", dbg_verbosity); + DBG_ASSERT(subject); +#endif + + if (subject) { + std::vector::iterator attached_subject; + attached_subject = std::find(subjects_.begin(), subjects_.end(), subject); + + // We must be processing a notification for a + // subject that was previously attached. +#ifdef IP_DEBUG_OBSERVER + + DBG_ASSERT(attached_subject != subjects_.end()); +#endif + + this->RecieveNotification(notify_type, subject); + + if (notify_type == NT_BeingDestroyed) { + // the subject is going away, remove it from our list + subjects_.erase(attached_subject); + } + } + } + + inline + Subject::~Subject() + { +#ifdef IP_DEBUG_OBSERVER + DBG_START_METH("Subject::~Subject", dbg_verbosity); +#endif + + std::vector::iterator iter; + for (iter = observers_.begin(); iter != observers_.end(); iter++) { + (*iter)->ProcessNotification(Observer::NT_BeingDestroyed, this); + } + } + + inline + void Subject::AttachObserver(Observer::NotifyType notify_type, Observer* observer) const + { +#ifdef IP_DEBUG_OBSERVER + DBG_START_METH("Subject::AttachObserver", dbg_verbosity); + // current implementation notifies all observers of everything + // they must filter the notifications that they are not interested + // in (i.e. a hub, not a router) + DBG_ASSERT(observer); + + std::vector::iterator attached_observer; + attached_observer = std::find(observers_.begin(), observers_.end(), observer); + DBG_ASSERT(attached_observer == observers_.end()); + + DBG_ASSERT(observer); +#endif + + observers_.push_back(observer); + } + + inline + void Subject::DetachObserver(Observer::NotifyType notify_type, Observer* observer) const + { +#ifdef IP_DEBUG_OBSERVER + DBG_START_METH("Subject::DetachObserver", dbg_verbosity); + DBG_ASSERT(observer); +#endif + + if (observer) { + std::vector::iterator attached_observer; + attached_observer = std::find(observers_.begin(), observers_.end(), observer); +#ifdef IP_DEBUG_OBSERVER + + DBG_ASSERT(attached_observer != observers_.end()); +#endif + + if (attached_observer != observers_.end()) { + observers_.erase(attached_observer); + } + } + } + + inline + void Subject::Notify(Observer::NotifyType notify_type) const + { +#ifdef IP_DEBUG_OBSERVER + DBG_START_METH("Subject::Notify", dbg_verbosity); +#endif + + std::vector::iterator iter; + for (iter = observers_.begin(); iter != observers_.end(); iter++) { + (*iter)->ProcessNotification(notify_type, this); + } + } + + +} // namespace Ipopt + +#endif diff --git a/thirdparty/windows/include/coin/IpOptionsList.hpp b/thirdparty/windows/include/coin/IpOptionsList.hpp index 098174a..a4c7c36 100644 --- a/thirdparty/windows/include/coin/IpOptionsList.hpp +++ b/thirdparty/windows/include/coin/IpOptionsList.hpp @@ -1,289 +1,289 @@ -// Copyright (C) 2004, 2006 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpOptionsList.hpp 1587 2009-10-27 16:09:21Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPOPTLIST_HPP__ -#define __IPOPTLIST_HPP__ - -#include "IpUtils.hpp" -#include "IpReferenced.hpp" -#include "IpException.hpp" -#include "IpRegOptions.hpp" - -#include -#include - -namespace Ipopt -{ - /** Exception that can be used to indicate errors with options */ - DECLARE_STD_EXCEPTION(OPTION_INVALID); - - /** This class stores a list of user set options. Each options is - * identified by a case-insensitive keyword (tag). Its value is - * stored internally as a string (always lower case), but for - * convenience set and get methods are provided to obtain Index and - * Number type values. For each keyword we also keep track of how - * often the value of an option has been requested by a get method. - */ - class OptionsList : public ReferencedObject - { - /** Class for storing the value and counter for each option in - * OptionsList. */ - class OptionValue - { - public: - /**@name Constructors/Destructors */ - //@{ - /** Default constructor (needed for the map) */ - OptionValue() - : - initialized_(false) - {} - - /** Constructor given the value */ - OptionValue(std::string value, bool allow_clobber, bool dont_print) - : - value_(value), - counter_(0), - initialized_(true), - allow_clobber_(allow_clobber), - dont_print_(dont_print) - {} - - /** Copy Constructor */ - OptionValue(const OptionValue& copy) - : - value_(copy.value_), - counter_(copy.counter_), - initialized_(copy.initialized_), - allow_clobber_(copy.allow_clobber_), - dont_print_(copy.dont_print_) - {} - - /** Equals operator */ - void operator=(const OptionValue& copy) - { - value_=copy.value_; - counter_=copy.counter_; - initialized_=copy.initialized_; - allow_clobber_=copy.allow_clobber_; - dont_print_=copy.dont_print_; - } - - /** Default Destructor */ - ~OptionValue() - {} - //@} - - /** Method for retrieving the value of an option. Calling this - * method will increase the counter by one. */ - std::string GetValue() const - { - DBG_ASSERT(initialized_); - counter_++; - return value_; - } - - /** Method for retrieving the value without increasing the - * counter */ - std::string Value() const - { - DBG_ASSERT(initialized_); - return value_; - } - - /** Method for accessing current value of the request counter */ - Index Counter() const - { - DBG_ASSERT(initialized_); - return counter_; - } - - /** True if the option can be overwritten */ - bool AllowClobber() const - { - DBG_ASSERT(initialized_); - return allow_clobber_; - } - - /** True if this option is not to show up in the - * print_user_options output */ - bool DontPrint() const - { - DBG_ASSERT(initialized_); - return dont_print_; - } - - private: - /** Value for this option */ - std::string value_; - - /** Counter for requests */ - mutable Index counter_; - - /** for debugging */ - bool initialized_; - - /** True if the option can be overwritten */ - bool allow_clobber_; - - /** True if this option is not to show up in the - * print_user_options output */ - bool dont_print_; - }; - - public: - /**@name Constructors/Destructors */ - //@{ - OptionsList(SmartPtr reg_options, SmartPtr jnlst) - : reg_options_(reg_options), jnlst_(jnlst) - {} - - OptionsList() - {} - - /** Copy Constructor */ - OptionsList(const OptionsList& copy) - { - // copy all the option strings and values - options_ = copy.options_; - // copy the registered options pointer - reg_options_ = copy.reg_options_; - } - - /** Default destructor */ - virtual ~OptionsList() - {} - - /** Overloaded Equals Operator */ - virtual void operator=(const OptionsList& source) - { - options_ = source.options_; - reg_options_ = source.reg_options_; - jnlst_ = source.jnlst_; - } - //@} - - /** Method for clearing all previously set options */ - virtual void clear() - { - options_.clear(); - } - - /** @name Get / Set Methods */ - //@{ - virtual void SetRegisteredOptions(const SmartPtr reg_options) - { - reg_options_ = reg_options; - } - virtual void SetJournalist(const SmartPtr jnlst) - { - jnlst_ = jnlst; - } - //@} - /** @name Methods for setting options */ - //@{ - virtual bool SetStringValue(const std::string& tag, const std::string& value, - bool allow_clobber = true, bool dont_print = false); - virtual bool SetNumericValue(const std::string& tag, Number value, - bool allow_clobber = true, bool dont_print = false); - virtual bool SetIntegerValue(const std::string& tag, Index value, - bool allow_clobber = true, bool dont_print = false); - //@} - - /** @name Methods for setting options only if they have not been - * set before*/ - //@{ - virtual bool SetStringValueIfUnset(const std::string& tag, const std::string& value, - bool allow_clobber = true, bool dont_print = false); - virtual bool SetNumericValueIfUnset(const std::string& tag, Number value, - bool allow_clobber = true, bool dont_print = false); - virtual bool SetIntegerValueIfUnset(const std::string& tag, Index value, - bool allow_clobber = true, bool dont_print = false); - //@} - - /** @name Methods for retrieving values from the options list. If - * a tag is not found, the methods return false, and value is set - * to the default value defined in the registered options. */ - //@{ - virtual bool GetStringValue(const std::string& tag, std::string& value, - const std::string& prefix) const; - virtual bool GetEnumValue(const std::string& tag, Index& value, - const std::string& prefix) const; - virtual bool GetBoolValue(const std::string& tag, bool& value, - const std::string& prefix) const; - virtual bool GetNumericValue(const std::string& tag, Number& value, - const std::string& prefix) const; - virtual bool GetIntegerValue(const std::string& tag, Index& value, - const std::string& prefix) const; - //@} - - /** Get a string with the list of all options (tag, value, counter) */ - virtual void PrintList(std::string& list) const; - - /** Get a string with the list of all options set by the user - * (tag, value, use/notused). Here, options with dont_print flag - * set to true are not printed. */ - virtual void PrintUserOptions(std::string& list) const; - - /** Read options from the stream is. Returns false if - * an error was encountered. */ - virtual bool ReadFromStream(const Journalist& jnlst, std::istream& is); - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - // OptionsList(); - - //@} - - /** map for storing the options */ - std::map< std::string, OptionValue > options_; - - /** list of all the registered options to validate against */ - SmartPtr reg_options_; - - /** Journalist for writing error messages, etc. */ - SmartPtr jnlst_; - - /** auxilliary method for converting sting to all lower-case - * letters */ - const std::string& lowercase(const std::string tag) const; - - /** auxilliary method for finding the value for a tag in the - * options list. This method first looks for the concatenated - * string prefix+tag (if prefix is not ""), and if this is not - * found, it looks for tag. The return value is true iff - * prefix+tag or tag is found. In that case, the corresponding - * string value is copied into value. */ - bool find_tag(const std::string& tag, const std::string& prefix, - std::string& value) const; - - /** tells whether or not we can clobber a particular option. - * returns true if the option does not already exist, or if - * the option exists but is set to allow_clobber - */ - bool will_allow_clobber(const std::string& tag) const; - - /** read the next token from stream is. Returns false, if EOF was - * reached before a tokens was ecountered. */ - bool readnexttoken(std::istream& is, std::string& token); - - /** auxilliary string set by lowercase method */ - mutable std::string lowercase_buffer_; - }; - -} // namespace Ipopt - -#endif +// Copyright (C) 2004, 2006 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpOptionsList.hpp 1861 2010-12-21 21:34:47Z andreasw $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPOPTLIST_HPP__ +#define __IPOPTLIST_HPP__ + +#include "IpUtils.hpp" +#include "IpReferenced.hpp" +#include "IpException.hpp" +#include "IpRegOptions.hpp" + +#include +#include + +namespace Ipopt +{ + /** Exception that can be used to indicate errors with options */ + DECLARE_STD_EXCEPTION(OPTION_INVALID); + + /** This class stores a list of user set options. Each options is + * identified by a case-insensitive keyword (tag). Its value is + * stored internally as a string (always lower case), but for + * convenience set and get methods are provided to obtain Index and + * Number type values. For each keyword we also keep track of how + * often the value of an option has been requested by a get method. + */ + class OptionsList : public ReferencedObject + { + /** Class for storing the value and counter for each option in + * OptionsList. */ + class OptionValue + { + public: + /**@name Constructors/Destructors */ + //@{ + /** Default constructor (needed for the map) */ + OptionValue() + : + initialized_(false) + {} + + /** Constructor given the value */ + OptionValue(std::string value, bool allow_clobber, bool dont_print) + : + value_(value), + counter_(0), + initialized_(true), + allow_clobber_(allow_clobber), + dont_print_(dont_print) + {} + + /** Copy Constructor */ + OptionValue(const OptionValue& copy) + : + value_(copy.value_), + counter_(copy.counter_), + initialized_(copy.initialized_), + allow_clobber_(copy.allow_clobber_), + dont_print_(copy.dont_print_) + {} + + /** Equals operator */ + void operator=(const OptionValue& copy) + { + value_=copy.value_; + counter_=copy.counter_; + initialized_=copy.initialized_; + allow_clobber_=copy.allow_clobber_; + dont_print_=copy.dont_print_; + } + + /** Default Destructor */ + ~OptionValue() + {} + //@} + + /** Method for retrieving the value of an option. Calling this + * method will increase the counter by one. */ + std::string GetValue() const + { + DBG_ASSERT(initialized_); + counter_++; + return value_; + } + + /** Method for retrieving the value without increasing the + * counter */ + std::string Value() const + { + DBG_ASSERT(initialized_); + return value_; + } + + /** Method for accessing current value of the request counter */ + Index Counter() const + { + DBG_ASSERT(initialized_); + return counter_; + } + + /** True if the option can be overwritten */ + bool AllowClobber() const + { + DBG_ASSERT(initialized_); + return allow_clobber_; + } + + /** True if this option is not to show up in the + * print_user_options output */ + bool DontPrint() const + { + DBG_ASSERT(initialized_); + return dont_print_; + } + + private: + /** Value for this option */ + std::string value_; + + /** Counter for requests */ + mutable Index counter_; + + /** for debugging */ + bool initialized_; + + /** True if the option can be overwritten */ + bool allow_clobber_; + + /** True if this option is not to show up in the + * print_user_options output */ + bool dont_print_; + }; + + public: + /**@name Constructors/Destructors */ + //@{ + OptionsList(SmartPtr reg_options, SmartPtr jnlst) + : reg_options_(reg_options), jnlst_(jnlst) + {} + + OptionsList() + {} + + /** Copy Constructor */ + OptionsList(const OptionsList& copy) + { + // copy all the option strings and values + options_ = copy.options_; + // copy the registered options pointer + reg_options_ = copy.reg_options_; + } + + /** Default destructor */ + virtual ~OptionsList() + {} + + /** Overloaded Equals Operator */ + virtual void operator=(const OptionsList& source) + { + options_ = source.options_; + reg_options_ = source.reg_options_; + jnlst_ = source.jnlst_; + } + //@} + + /** Method for clearing all previously set options */ + virtual void clear() + { + options_.clear(); + } + + /** @name Get / Set Methods */ + //@{ + virtual void SetRegisteredOptions(const SmartPtr reg_options) + { + reg_options_ = reg_options; + } + virtual void SetJournalist(const SmartPtr jnlst) + { + jnlst_ = jnlst; + } + //@} + /** @name Methods for setting options */ + //@{ + virtual bool SetStringValue(const std::string& tag, const std::string& value, + bool allow_clobber = true, bool dont_print = false); + virtual bool SetNumericValue(const std::string& tag, Number value, + bool allow_clobber = true, bool dont_print = false); + virtual bool SetIntegerValue(const std::string& tag, Index value, + bool allow_clobber = true, bool dont_print = false); + //@} + + /** @name Methods for setting options only if they have not been + * set before*/ + //@{ + virtual bool SetStringValueIfUnset(const std::string& tag, const std::string& value, + bool allow_clobber = true, bool dont_print = false); + virtual bool SetNumericValueIfUnset(const std::string& tag, Number value, + bool allow_clobber = true, bool dont_print = false); + virtual bool SetIntegerValueIfUnset(const std::string& tag, Index value, + bool allow_clobber = true, bool dont_print = false); + //@} + + /** @name Methods for retrieving values from the options list. If + * a tag is not found, the methods return false, and value is set + * to the default value defined in the registered options. */ + //@{ + virtual bool GetStringValue(const std::string& tag, std::string& value, + const std::string& prefix) const; + virtual bool GetEnumValue(const std::string& tag, Index& value, + const std::string& prefix) const; + virtual bool GetBoolValue(const std::string& tag, bool& value, + const std::string& prefix) const; + virtual bool GetNumericValue(const std::string& tag, Number& value, + const std::string& prefix) const; + virtual bool GetIntegerValue(const std::string& tag, Index& value, + const std::string& prefix) const; + //@} + + /** Get a string with the list of all options (tag, value, counter) */ + virtual void PrintList(std::string& list) const; + + /** Get a string with the list of all options set by the user + * (tag, value, use/notused). Here, options with dont_print flag + * set to true are not printed. */ + virtual void PrintUserOptions(std::string& list) const; + + /** Read options from the stream is. Returns false if + * an error was encountered. */ + virtual bool ReadFromStream(const Journalist& jnlst, std::istream& is); + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + // OptionsList(); + + //@} + + /** map for storing the options */ + std::map< std::string, OptionValue > options_; + + /** list of all the registered options to validate against */ + SmartPtr reg_options_; + + /** Journalist for writing error messages, etc. */ + SmartPtr jnlst_; + + /** auxilliary method for converting sting to all lower-case + * letters */ + const std::string& lowercase(const std::string tag) const; + + /** auxilliary method for finding the value for a tag in the + * options list. This method first looks for the concatenated + * string prefix+tag (if prefix is not ""), and if this is not + * found, it looks for tag. The return value is true iff + * prefix+tag or tag is found. In that case, the corresponding + * string value is copied into value. */ + bool find_tag(const std::string& tag, const std::string& prefix, + std::string& value) const; + + /** tells whether or not we can clobber a particular option. + * returns true if the option does not already exist, or if + * the option exists but is set to allow_clobber + */ + bool will_allow_clobber(const std::string& tag) const; + + /** read the next token from stream is. Returns false, if EOF was + * reached before a tokens was ecountered. */ + bool readnexttoken(std::istream& is, std::string& token); + + /** auxilliary string set by lowercase method */ + mutable std::string lowercase_buffer_; + }; + +} // namespace Ipopt + +#endif diff --git a/thirdparty/windows/include/coin/IpReferenced.hpp b/thirdparty/windows/include/coin/IpReferenced.hpp index 6f40e3e..aa4ce79 100644 --- a/thirdparty/windows/include/coin/IpReferenced.hpp +++ b/thirdparty/windows/include/coin/IpReferenced.hpp @@ -1,249 +1,258 @@ -// Copyright (C) 2004, 2006 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpReferenced.hpp 1019 2007-06-24 03:52:34Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPREFERENCED_HPP__ -#define __IPREFERENCED_HPP__ - -#include "IpTypes.hpp" -#include "IpDebug.hpp" - -#include - -namespace Ipopt -{ - - /** Psydo-class, from which everything has to inherit that wants to - * use be registered as a Referencer for a ReferencedObject. - */ - class Referencer - {} - ; - - /** ReferencedObject class. - * This is part of the implementation of an intrusive smart pointer - * design. This class stores the reference count of all the smart - * pointers that currently reference it. See the documentation for - * the SmartPtr class for more details. - * - * A SmartPtr behaves much like a raw pointer, but manages the lifetime - * of an object, deleting the object automatically. This class implements - * a reference-counting, intrusive smart pointer design, where all - * objects pointed to must inherit off of ReferencedObject, which - * stores the reference count. Although this is intrusive (native types - * and externally authored classes require wrappers to be referenced - * by smart pointers), it is a safer design. A more detailed discussion of - * these issues follows after the usage information. - * - * Usage Example: - * Note: to use the SmartPtr, all objects to which you point MUST - * inherit off of ReferencedObject. - * - * \verbatim - * - * In MyClass.hpp... - * - * #include "IpReferenced.hpp" - - * namespace Ipopt { - * - * class MyClass : public ReferencedObject // must derive from ReferencedObject - * { - * ... - * } - * } // namespace Ipopt - * - * - * In my_usage.cpp... - * - * #include "IpSmartPtr.hpp" - * #include "MyClass.hpp" - * - * void func(AnyObject& obj) - * { - * SmartPtr ptr_to_myclass = new MyClass(...); - * // ptr_to_myclass now points to a new MyClass, - * // and the reference count is 1 - * - * ... - * - * obj.SetMyClass(ptr_to_myclass); - * // Here, let's assume that AnyObject uses a - * // SmartPtr internally here. - * // Now, both ptr_to_myclass and the internal - * // SmartPtr in obj point to the same MyClass object - * // and its reference count is 2. - * - * ... - * - * // No need to delete ptr_to_myclass, this - * // will be done automatically when the - * // reference count drops to zero. - * - * } - * - * \endverbatim - * - * Other Notes: - * The SmartPtr implements both dereference operators -> & *. - * The SmartPtr does NOT implement a conversion operator to - * the raw pointer. Use the GetRawPtr() method when this - * is necessary. Make sure that the raw pointer is NOT - * deleted. - * The SmartPtr implements the comparison operators == & != - * for a variety of types. Use these instead of - * \verbatim - * if (GetRawPtr(smrt_ptr) == ptr) // Don't use this - * \endverbatim - * SmartPtr's, as currently implemented, do NOT handle circular references. - * For example: consider a higher level object using SmartPtrs to point to - * A and B, but A and B also point to each other (i.e. A has a SmartPtr - * to B and B has a SmartPtr to A). In this scenario, when the higher - * level object is finished with A and B, their reference counts will - * never drop to zero (since they reference each other) and they - * will not be deleted. This can be detected by memory leak tools like - * valgrind. If the circular reference is necessary, the problem can be - * overcome by a number of techniques: - * - * 1) A and B can have a method that "releases" each other, that is - * they set their internal SmartPtrs to NULL. - * \verbatim - * void AClass::ReleaseCircularReferences() - * { - * smart_ptr_to_B = NULL; - * } - * \endverbatim - * Then, the higher level class can call these methods before - * it is done using A & B. - * - * 2) Raw pointers can be used in A and B to reference each other. - * Here, an implicit assumption is made that the lifetime is - * controlled by the higher level object and that A and B will - * both exist in a controlled manner. Although this seems - * dangerous, in many situations, this type of referencing - * is very controlled and this is reasonably safe. - * - * 3) This SmartPtr class could be redesigned with the Weak/Strong - * design concept. Here, the SmartPtr is identified as being - * Strong (controls lifetime of the object) or Weak (merely - * referencing the object). The Strong SmartPtr increments - * (and decrements) the reference count in ReferencedObject - * but the Weak SmartPtr does not. In the example above, - * the higher level object would have Strong SmartPtrs to - * A and B, but A and B would have Weak SmartPtrs to each - * other. Then, when the higher level object was done with - * A and B, they would be deleted. The Weak SmartPtrs in A - * and B would not decrement the reference count and would, - * of course, not delete the object. This idea is very similar - * to item (2), where it is implied that the sequence of events - * is controlled such that A and B will not call anything using - * their pointers following the higher level delete (i.e. in - * their destructors!). This is somehow safer, however, because - * code can be written (however expensive) to perform run-time - * detection of this situation. For example, the ReferencedObject - * could store pointers to all Weak SmartPtrs that are referencing - * it and, in its destructor, tell these pointers that it is - * dying. They could then set themselves to NULL, or set an - * internal flag to detect usage past this point. - * - * Comments on Non-Intrusive Design: - * In a non-intrusive design, the reference count is stored somewhere other - * than the object being referenced. This means, unless the reference - * counting pointer is the first referencer, it must get a pointer to the - * referenced object from another smart pointer (so it has access to the - * reference count location). In this non-intrusive design, if we are - * pointing to an object with a smart pointer (or a number of smart - * pointers), and we then give another smart pointer the address through - * a RAW pointer, we will have two independent, AND INCORRECT, reference - * counts. To avoid this pitfall, we use an intrusive reference counting - * technique where the reference count is stored in the object being - * referenced. - */ - class ReferencedObject - { - public: - ReferencedObject() - : - reference_count_(0) - {} - - virtual ~ReferencedObject() - { - DBG_ASSERT(reference_count_ == 0); - } - - Index ReferenceCount() const; - - void AddRef(const Referencer* referencer) const; - - void ReleaseRef(const Referencer* referencer) const; - - private: - mutable Index reference_count_; - -# ifdef REF_DEBUG - - mutable std::list referencers_; -# endif - - }; - - /* inline methods */ - inline - Index ReferencedObject::ReferenceCount() const - { - // DBG_START_METH("ReferencedObject::ReferenceCount()", 0); - // DBG_PRINT((1,"Returning reference_count_ = %d\n", reference_count_)); - return reference_count_; - } - - inline - void ReferencedObject::AddRef(const Referencer* referencer) const - { - // DBG_START_METH("ReferencedObject::AddRef(const Referencer* referencer)", 0); - reference_count_++; - // DBG_PRINT((1, "New reference_count_ = %d\n", reference_count_)); -# ifdef REF_DEBUG - - referencers_.push_back(referencer); -# endif - - } - - inline - void ReferencedObject::ReleaseRef(const Referencer* referencer) const - { - // DBG_START_METH("ReferencedObject::ReleaseRef(const Referencer* referencer)", - // 0); - reference_count_--; - // DBG_PRINT((1, "New reference_count_ = %d\n", reference_count_)); - -# ifdef REF_DEBUG - - bool found = false; - std::list::iterator iter; - for (iter = referencers_.begin(); iter != referencers_.end(); iter++) { - if ((*iter) == referencer) { - found = true; - break; - } - } - - // cannot call release on a reference that was never added... - DBG_ASSERT(found); - - if (found) { - referencers_.erase(iter); - } -# endif - - } - - -} // namespace Ipopt - -#endif +// Copyright (C) 2004, 2006 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpReferenced.hpp 2182 2013-03-30 20:02:18Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPREFERENCED_HPP__ +#define __IPREFERENCED_HPP__ + +#include "IpTypes.hpp" +#include "IpDebug.hpp" + +#include + +#if COIN_IPOPT_CHECKLEVEL > 3 + #define IP_DEBUG_REFERENCED +#endif + +namespace Ipopt +{ + + /** Psydo-class, from which everything has to inherit that wants to + * use be registered as a Referencer for a ReferencedObject. + */ + class Referencer + {} + ; + + /** ReferencedObject class. + * This is part of the implementation of an intrusive smart pointer + * design. This class stores the reference count of all the smart + * pointers that currently reference it. See the documentation for + * the SmartPtr class for more details. + * + * A SmartPtr behaves much like a raw pointer, but manages the lifetime + * of an object, deleting the object automatically. This class implements + * a reference-counting, intrusive smart pointer design, where all + * objects pointed to must inherit off of ReferencedObject, which + * stores the reference count. Although this is intrusive (native types + * and externally authored classes require wrappers to be referenced + * by smart pointers), it is a safer design. A more detailed discussion of + * these issues follows after the usage information. + * + * Usage Example: + * Note: to use the SmartPtr, all objects to which you point MUST + * inherit off of ReferencedObject. + * + * \verbatim + * + * In MyClass.hpp... + * + * #include "IpReferenced.hpp" + + * namespace Ipopt { + * + * class MyClass : public ReferencedObject // must derive from ReferencedObject + * { + * ... + * } + * } // namespace Ipopt + * + * + * In my_usage.cpp... + * + * #include "IpSmartPtr.hpp" + * #include "MyClass.hpp" + * + * void func(AnyObject& obj) + * { + * SmartPtr ptr_to_myclass = new MyClass(...); + * // ptr_to_myclass now points to a new MyClass, + * // and the reference count is 1 + * + * ... + * + * obj.SetMyClass(ptr_to_myclass); + * // Here, let's assume that AnyObject uses a + * // SmartPtr internally here. + * // Now, both ptr_to_myclass and the internal + * // SmartPtr in obj point to the same MyClass object + * // and its reference count is 2. + * + * ... + * + * // No need to delete ptr_to_myclass, this + * // will be done automatically when the + * // reference count drops to zero. + * + * } + * + * \endverbatim + * + * Other Notes: + * The SmartPtr implements both dereference operators -> & *. + * The SmartPtr does NOT implement a conversion operator to + * the raw pointer. Use the GetRawPtr() method when this + * is necessary. Make sure that the raw pointer is NOT + * deleted. + * The SmartPtr implements the comparison operators == & != + * for a variety of types. Use these instead of + * \verbatim + * if (GetRawPtr(smrt_ptr) == ptr) // Don't use this + * \endverbatim + * SmartPtr's, as currently implemented, do NOT handle circular references. + * For example: consider a higher level object using SmartPtrs to point to + * A and B, but A and B also point to each other (i.e. A has a SmartPtr + * to B and B has a SmartPtr to A). In this scenario, when the higher + * level object is finished with A and B, their reference counts will + * never drop to zero (since they reference each other) and they + * will not be deleted. This can be detected by memory leak tools like + * valgrind. If the circular reference is necessary, the problem can be + * overcome by a number of techniques: + * + * 1) A and B can have a method that "releases" each other, that is + * they set their internal SmartPtrs to NULL. + * \verbatim + * void AClass::ReleaseCircularReferences() + * { + * smart_ptr_to_B = NULL; + * } + * \endverbatim + * Then, the higher level class can call these methods before + * it is done using A & B. + * + * 2) Raw pointers can be used in A and B to reference each other. + * Here, an implicit assumption is made that the lifetime is + * controlled by the higher level object and that A and B will + * both exist in a controlled manner. Although this seems + * dangerous, in many situations, this type of referencing + * is very controlled and this is reasonably safe. + * + * 3) This SmartPtr class could be redesigned with the Weak/Strong + * design concept. Here, the SmartPtr is identified as being + * Strong (controls lifetime of the object) or Weak (merely + * referencing the object). The Strong SmartPtr increments + * (and decrements) the reference count in ReferencedObject + * but the Weak SmartPtr does not. In the example above, + * the higher level object would have Strong SmartPtrs to + * A and B, but A and B would have Weak SmartPtrs to each + * other. Then, when the higher level object was done with + * A and B, they would be deleted. The Weak SmartPtrs in A + * and B would not decrement the reference count and would, + * of course, not delete the object. This idea is very similar + * to item (2), where it is implied that the sequence of events + * is controlled such that A and B will not call anything using + * their pointers following the higher level delete (i.e. in + * their destructors!). This is somehow safer, however, because + * code can be written (however expensive) to perform run-time + * detection of this situation. For example, the ReferencedObject + * could store pointers to all Weak SmartPtrs that are referencing + * it and, in its destructor, tell these pointers that it is + * dying. They could then set themselves to NULL, or set an + * internal flag to detect usage past this point. + * + * For every most derived object only one ReferencedObject may exist, + * that is multiple inheritance requires virtual inheritance, see also + * the 2nd point in ticket #162. + * + * Comments on Non-Intrusive Design: + * In a non-intrusive design, the reference count is stored somewhere other + * than the object being referenced. This means, unless the reference + * counting pointer is the first referencer, it must get a pointer to the + * referenced object from another smart pointer (so it has access to the + * reference count location). In this non-intrusive design, if we are + * pointing to an object with a smart pointer (or a number of smart + * pointers), and we then give another smart pointer the address through + * a RAW pointer, we will have two independent, AND INCORRECT, reference + * counts. To avoid this pitfall, we use an intrusive reference counting + * technique where the reference count is stored in the object being + * referenced. + */ + class ReferencedObject + { + public: + ReferencedObject() + : + reference_count_(0) + {} + + virtual ~ReferencedObject() + { + DBG_ASSERT(reference_count_ == 0); + } + + inline + Index ReferenceCount() const; + + inline + void AddRef(const Referencer* referencer) const; + + inline + void ReleaseRef(const Referencer* referencer) const; + + private: + mutable Index reference_count_; + +# ifdef IP_DEBUG_REFERENCED + mutable std::list referencers_; +# endif + + }; + + /* inline methods */ + inline + Index ReferencedObject::ReferenceCount() const + { + // DBG_START_METH("ReferencedObject::ReferenceCount()", 0); + // DBG_PRINT((1,"Returning reference_count_ = %d\n", reference_count_)); + return reference_count_; + } + + inline + void ReferencedObject::AddRef(const Referencer* referencer) const + { + // DBG_START_METH("ReferencedObject::AddRef(const Referencer* referencer)", 0); + reference_count_++; + // DBG_PRINT((1, "New reference_count_ = %d\n", reference_count_)); +# ifdef IP_DEBUG_REFERENCED + referencers_.push_back(referencer); +# endif + + } + + inline + void ReferencedObject::ReleaseRef(const Referencer* referencer) const + { + // DBG_START_METH("ReferencedObject::ReleaseRef(const Referencer* referencer)", + // 0); + reference_count_--; + // DBG_PRINT((1, "New reference_count_ = %d\n", reference_count_)); + +# ifdef IP_DEBUG_REFERENCED + + bool found = false; + std::list::iterator iter; + for (iter = referencers_.begin(); iter != referencers_.end(); iter++) { + if ((*iter) == referencer) { + found = true; + break; + } + } + + // cannot call release on a reference that was never added... + DBG_ASSERT(found); + + if (found) { + referencers_.erase(iter); + } +# endif + + } + + +} // namespace Ipopt + +#endif diff --git a/thirdparty/windows/include/coin/IpRegOptions.hpp b/thirdparty/windows/include/coin/IpRegOptions.hpp index 0e3c904..c3dc8ff 100644 --- a/thirdparty/windows/include/coin/IpRegOptions.hpp +++ b/thirdparty/windows/include/coin/IpRegOptions.hpp @@ -1,651 +1,658 @@ -// Copyright (C) 2004, 2007 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpRegOptions.hpp 1587 2009-10-27 16:09:21Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2005-06-18 - -#ifndef __IPREGOPTIONS_HPP__ -#define __IPREGOPTIONS_HPP__ - -#include "IpUtils.hpp" -#include "IpReferenced.hpp" -#include "IpException.hpp" -#include "IpSmartPtr.hpp" - -#include - -namespace Ipopt -{ - - enum RegisteredOptionType - { - OT_Number, - OT_Integer, - OT_String, - OT_Unknown - }; - - /** Base class for registered options. The derived types are more - * specific to a string option or a Number (real) option, etc. - */ - class RegisteredOption : public ReferencedObject - { - public: - /** Constructors / Destructors */ - //@{ - RegisteredOption() - : - type_(OT_Unknown), - has_lower_(false), - has_upper_(false), - counter_(0) - {} - - RegisteredOption(const std::string& name, - const std::string& short_description, - const std::string& long_description, - const std::string& registering_category) - : - name_(name), - short_description_(short_description), - long_description_(long_description), - registering_category_(registering_category), - type_(OT_Unknown), - has_lower_(false), - has_upper_(false), - counter_(next_counter_++) - {} - - RegisteredOption(const RegisteredOption& copy) - : - name_(copy.name_), - short_description_(copy.short_description_), - long_description_(copy.long_description_), - registering_category_(copy.registering_category_), - type_(copy.type_), - has_lower_(copy.has_lower_), - lower_(copy.lower_), - has_upper_(copy.has_upper_), - upper_(copy.upper_), - valid_strings_(copy.valid_strings_), - counter_(copy.counter_) - {} - - virtual ~RegisteredOption() - {} - //@} - - DECLARE_STD_EXCEPTION(ERROR_CONVERTING_STRING_TO_ENUM); - - /** Standard Get / Set Methods */ - //@{ - /** Get the option's name (tag in the input file) */ - virtual const std::string& Name() const - { - return name_; - } - /** Set the option's name (tag in the input file) */ - virtual void SetName(const std::string& name) - { - name_ = name; - } - /** Get the short description */ - virtual const std::string& ShortDescription() const - { - return short_description_; - } - /** Get the long description */ - virtual const std::string& LongDescription() const - { - return long_description_; - } - /** Set the short description */ - virtual void SetShortDescription(const std::string& short_description) - { - short_description_ = short_description; - } - /** Set the long description */ - virtual void SetLongDescription(const std::string& long_description) - { - long_description_ = long_description; - } - /** Get the registering class */ - virtual const std::string& RegisteringCategory() const - { - return registering_category_; - } - /** Set the registering class */ - virtual void SetRegisteringCategory(const std::string& registering_category) - { - registering_category_ = registering_category; - } - /** Get the Option's type */ - virtual const RegisteredOptionType& Type() const - { - return type_; - } - /** Get the Option's type */ - virtual void SetType(const RegisteredOptionType& type) - { - type_ = type; - } - /** Counter */ - virtual Index Counter() const - { - return counter_; - } - //@} - - /** @name Get / Set methods valid for specific types - NOTE: the Type - * must be set before calling these methods. - */ - //@{ - /** check if the option has a lower bound - can be called for - * OT_Number & OT_Integer*/ - virtual const bool& HasLower() const - { - DBG_ASSERT(type_ == OT_Number || type_ == OT_Integer); - return has_lower_; - } - /** check if the lower bound is strict - can be called for - OT_Number */ - virtual const bool& LowerStrict() const - { - DBG_ASSERT(type_ == OT_Number && has_lower_ == true); - return lower_strict_; - } - /** get the Number version of the lower bound - can be called for - * OT_Number */ - virtual Number LowerNumber() const - { - DBG_ASSERT(has_lower_ == true && type_ == OT_Number); - return lower_; - } - /** set the Number version of the lower bound - can be called for - * OT_Number */ - virtual void SetLowerNumber(const Number& lower, const bool& strict) - { - DBG_ASSERT(type_ == OT_Number); - lower_ = lower; - lower_strict_ = strict, has_lower_ = true; - } - /** get the Integer version of the lower bound can be called for - * OT_Integer*/ - virtual Index LowerInteger() const - { - DBG_ASSERT(has_lower_ == true && type_ == OT_Integer); - return (Index)lower_; - } - /** set the Integer version of the lower bound - can be called for - * OT_Integer */ - virtual void SetLowerInteger(const Index& lower) - { - DBG_ASSERT(type_ == OT_Integer); - lower_ = (Number)lower; - has_lower_ = true; - } - /** check if the option has an upper bound - can be called for - * OT_Number & OT_Integer*/ - virtual const bool& HasUpper() const - { - DBG_ASSERT(type_ == OT_Number || type_ == OT_Integer); - return has_upper_; - } - /** check if the upper bound is strict - can be called for - * OT_Number */ - virtual const bool& UpperStrict() const - { - DBG_ASSERT(type_ == OT_Number && has_upper_ == true); - return upper_strict_; - } - /** get the Number version of the upper bound - can be called for - * OT_Number */ - virtual Number UpperNumber() const - { - DBG_ASSERT(has_upper_ == true && type_ == OT_Number); - return upper_; - } - /** set the Number version of the upper bound - can be called for - * OT_Number */ - virtual void SetUpperNumber(const Number& upper, const bool& strict) - { - DBG_ASSERT(type_ == OT_Number); - upper_ = upper; - upper_strict_ = strict; - has_upper_ = true; - } - /** get the Integer version of the upper bound - can be called for - * OT_Integer*/ - virtual Index UpperInteger() const - { - DBG_ASSERT(has_upper_ == true && type_ == OT_Integer); - return (Index)upper_; - } - /** set the Integer version of the upper bound - can be called for - * OT_Integer */ - virtual void SetUpperInteger(const Index& upper) - { - DBG_ASSERT(type_ == OT_Integer); - upper_ = (Number)upper; - has_upper_ = true; - } - /** method to add valid string entries - can be called for - * OT_String */ - virtual void AddValidStringSetting(const std::string value, - const std::string description) - { - DBG_ASSERT(type_ == OT_String); - valid_strings_.push_back(string_entry(value, description)); - } - /** get the default as a Number - can be called for OT_Number */ - virtual Number DefaultNumber() const - { - DBG_ASSERT(type_ == OT_Number); - return default_number_; - } - /** Set the default as a Number - can be called for OT_Number */ - virtual void SetDefaultNumber(const Number& default_value) - { - DBG_ASSERT(type_ == OT_Number); - default_number_ = default_value; - } - /** get the default as an Integer - can be called for OT_Integer*/ - virtual Index DefaultInteger() const - { - DBG_ASSERT(type_ == OT_Integer); - return (Index)default_number_; - } - /** Set the default as an Integer - can be called for - OT_Integer */ - virtual void SetDefaultInteger(const Index& default_value) - { - DBG_ASSERT(type_ == OT_Integer); - default_number_ = (Number)default_value; - } - /** get the default as a string - can be called for OT_String */ - virtual std::string DefaultString() const - { - DBG_ASSERT(type_ == OT_String); - return default_string_; - } - /** get the default as a string, but as the index of the string in - * the list - helps map from a string to an enum- can be called - * for OT_String */ - virtual Index DefaultStringAsEnum() const - { - DBG_ASSERT(type_ == OT_String); - return MapStringSettingToEnum(default_string_); - } - /** Set the default as a string - can be called for OT_String */ - virtual void SetDefaultString(const std::string& default_value) - { - DBG_ASSERT(type_ == OT_String); - default_string_ = default_value; - } - /** Check if the Number value is a valid setting - can be called - * for OT_Number */ - virtual bool IsValidNumberSetting(const Number& value) const - { - DBG_ASSERT(type_ == OT_Number); - if (has_lower_ && ((lower_strict_ == true && value <= lower_) || - (lower_strict_ == false && value < lower_))) { - return false; - } - if (has_upper_ && ((upper_strict_ == true && value >= upper_) || - (upper_strict_ == false && value > upper_))) { - return false; - } - return true; - } - /** Check if the Integer value is a valid setting - can be called - * for OT_Integer */ - virtual bool IsValidIntegerSetting(const Index& value) const - { - DBG_ASSERT(type_ == OT_Integer); - if (has_lower_ && value < lower_) { - return false; - } - if (has_upper_ && value > upper_) { - return false; - } - return true; - } - /** Check if the String value is a valid setting - can be called - * for OT_String */ - virtual bool IsValidStringSetting(const std::string& value) const; - - /** Map a user setting (allowing any case) to the case used when - * the setting was registered. - */ - virtual std::string MapStringSetting(const std::string& value) const; - - /** Map a user setting (allowing any case) to the index of the - * matched setting in the list of string settings. Helps map a - * string setting to an enumeration. - */ - virtual Index MapStringSettingToEnum(const std::string& value) const; - //@} - - /** output a description of the option */ - virtual void OutputDescription(const Journalist& jnlst) const; - /** output a more concise version */ - virtual void OutputShortDescription(const Journalist& jnlst) const; - /** output a latex version */ - virtual void OutputLatexDescription(const Journalist& jnlst) const; - - private: - std::string name_; - std::string short_description_; - std::string long_description_; - std::string registering_category_; - RegisteredOptionType type_; - - bool has_lower_; - bool lower_strict_; - Number lower_; - bool has_upper_; - bool upper_strict_; - Number upper_; - Number default_number_; - - void MakeValidLatexString(std::string source, std::string& dest) const; - std::string MakeValidLatexNumber(Number value) const; - - /** Compare two strings and return true if they are equal (case - insensitive comparison) */ - bool string_equal_insensitive(const std::string& s1, - const std::string& s2) const; - - /** class to hold the valid string settings for a string option */ - class string_entry - { - public: - string_entry(const std::string& value, const std::string& description) - : value_(value), description_(description) - {} - std::string value_; - std::string description_; - }; - - std::vector valid_strings_; - std::string default_string_; - - /** Has the information as how many-th option this one was - * registered. */ - const Index counter_; - - static Index next_counter_; - }; - - /** Class for storing registered options. Used for validation and - * documentation. - */ - class RegisteredOptions : public ReferencedObject - { - public: - /** Constructors / Destructors */ - //@{ - /** Standard Constructor */ - RegisteredOptions() - : - current_registering_category_("Uncategorized") - {} - - /** Standard Destructor */ - virtual ~RegisteredOptions() - {} - //@} - - DECLARE_STD_EXCEPTION(OPTION_ALREADY_REGISTERED); - - /** Methods to interact with registered options */ - //@{ - /** set the registering class. All subsequent options will be - * added with the registered class */ - virtual void SetRegisteringCategory(const std::string& registering_category) - { - current_registering_category_ = registering_category; - } - - /** retrieve the value of the current registering category */ - virtual std::string RegisteringCategory() - { - return current_registering_category_; - } - - /** Add a Number option (with no restrictions) */ - virtual void AddNumberOption(const std::string& name, - const std::string& short_description, - Number default_value, - const std::string& long_description=""); - /** Add a Number option (with a lower bound) */ - virtual void AddLowerBoundedNumberOption(const std::string& name, - const std::string& short_description, - Number lower, bool strict, - Number default_value, - const std::string& long_description=""); - /** Add a Number option (with a upper bound) */ - virtual void AddUpperBoundedNumberOption(const std::string& name, - const std::string& short_description, - Number upper, bool strict, - Number default_value, - const std::string& long_description=""); - /** Add a Number option (with a both bounds) */ - virtual void AddBoundedNumberOption(const std::string& name, - const std::string& short_description, - Number lower, bool lower_strict, - Number upper, bool upper_strict, - Number default_value, - const std::string& long_description=""); - /** Add a Integer option (with no restrictions) */ - virtual void AddIntegerOption(const std::string& name, - const std::string& short_description, - Index default_value, - const std::string& long_description=""); - /** Add a Integer option (with a lower bound) */ - virtual void AddLowerBoundedIntegerOption(const std::string& name, - const std::string& short_description, - Index lower, Index default_value, - const std::string& long_description=""); - /** Add a Integer option (with a upper bound) */ - virtual void AddUpperBoundedIntegerOption(const std::string& name, - const std::string& short_description, - Index upper, Index default_value, - const std::string& long_description=""); - /** Add a Integer option (with a both bounds) */ - virtual void AddBoundedIntegerOption(const std::string& name, - const std::string& short_description, - Index lower, Index upper, - Index default_value, - const std::string& long_description=""); - - /** Add a String option (with no restrictions) */ - virtual void AddStringOption(const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::vector& settings, - const std::vector& descriptions, - const std::string& long_description=""); - /** Methods that make adding string options with only a few - * entries easier */ - virtual void AddStringOption1(const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& long_description=""); - virtual void AddStringOption2(const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& long_description=""); - virtual void AddStringOption3(const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& long_description=""); - virtual void AddStringOption4(const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& setting4, - const std::string& description4, - const std::string& long_description=""); - virtual void AddStringOption5(const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& setting4, - const std::string& description4, - const std::string& setting5, - const std::string& description5, - const std::string& long_description=""); - virtual void AddStringOption6(const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& setting4, - const std::string& description4, - const std::string& setting5, - const std::string& description5, - const std::string& setting6, - const std::string& description6, - const std::string& long_description=""); - virtual void AddStringOption7(const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& setting4, - const std::string& description4, - const std::string& setting5, - const std::string& description5, - const std::string& setting6, - const std::string& description6, - const std::string& setting7, - const std::string& description7, - const std::string& long_description=""); - virtual void AddStringOption8(const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& setting4, - const std::string& description4, - const std::string& setting5, - const std::string& description5, - const std::string& setting6, - const std::string& description6, - const std::string& setting7, - const std::string& description7, - const std::string& setting8, - const std::string& description8, - const std::string& long_description=""); - virtual void AddStringOption9(const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& setting4, - const std::string& description4, - const std::string& setting5, - const std::string& description5, - const std::string& setting6, - const std::string& description6, - const std::string& setting7, - const std::string& description7, - const std::string& setting8, - const std::string& description8, - const std::string& setting9, - const std::string& description9, - const std::string& long_description=""); - virtual void AddStringOption10(const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& setting4, - const std::string& description4, - const std::string& setting5, - const std::string& description5, - const std::string& setting6, - const std::string& description6, - const std::string& setting7, - const std::string& description7, - const std::string& setting8, - const std::string& description8, - const std::string& setting9, - const std::string& description9, - const std::string& setting10, - const std::string& description10, - const std::string& long_description=""); - - /** Get a registered option - this will return NULL if the option - * does not exist */ - virtual SmartPtr GetOption(const std::string& name); - - /** Output documentation for the options - gives a description, - * etc. */ - virtual void OutputOptionDocumentation(const Journalist& jnlst, std::list& categories); - - /** Output documentation in Latex format to include in a latex file */ - virtual void OutputLatexOptionDocumentation(const Journalist& jnlst, std::list& categories); - //@} - - typedef std::map > RegOptionsList; - - /** Giving access to iteratable representation of the registered - * options */ - virtual const RegOptionsList& RegisteredOptionsList () const - { - return registered_options_; - } - - private: - std::string current_registering_category_; - std::map > registered_options_; - }; -} // namespace Ipopt - -#endif +// Copyright (C) 2004, 2007 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpRegOptions.hpp 2189 2013-03-31 15:06:11Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2005-06-18 + +#ifndef __IPREGOPTIONS_HPP__ +#define __IPREGOPTIONS_HPP__ + +#include "IpUtils.hpp" +#include "IpReferenced.hpp" +#include "IpException.hpp" +#include "IpSmartPtr.hpp" + +#include + +namespace Ipopt +{ + + enum RegisteredOptionType + { + OT_Number, + OT_Integer, + OT_String, + OT_Unknown + }; + + /** Base class for registered options. The derived types are more + * specific to a string option or a Number (real) option, etc. + */ + class RegisteredOption : public ReferencedObject + { + public: + /** class to hold the valid string settings for a string option */ + class string_entry + { + public: + string_entry(const std::string& value, const std::string& description) + : value_(value), description_(description) + {} + std::string value_; + std::string description_; + }; + + /** Constructors / Destructors */ + //@{ + RegisteredOption(Index counter) + : + type_(OT_Unknown), + has_lower_(false), + has_upper_(false), + counter_(counter) + {} + + RegisteredOption(const std::string& name, + const std::string& short_description, + const std::string& long_description, + const std::string& registering_category, + Index counter) + : + name_(name), + short_description_(short_description), + long_description_(long_description), + registering_category_(registering_category), + type_(OT_Unknown), + has_lower_(false), + has_upper_(false), + counter_(counter) + {} + + RegisteredOption(const RegisteredOption& copy) + : + name_(copy.name_), + short_description_(copy.short_description_), + long_description_(copy.long_description_), + registering_category_(copy.registering_category_), + type_(copy.type_), + has_lower_(copy.has_lower_), + lower_(copy.lower_), + has_upper_(copy.has_upper_), + upper_(copy.upper_), + valid_strings_(copy.valid_strings_), + counter_(copy.counter_) + {} + + virtual ~RegisteredOption() + {} + //@} + + DECLARE_STD_EXCEPTION(ERROR_CONVERTING_STRING_TO_ENUM); + + /** Standard Get / Set Methods */ + //@{ + /** Get the option's name (tag in the input file) */ + virtual const std::string& Name() const + { + return name_; + } + /** Set the option's name (tag in the input file) */ + virtual void SetName(const std::string& name) + { + name_ = name; + } + /** Get the short description */ + virtual const std::string& ShortDescription() const + { + return short_description_; + } + /** Get the long description */ + virtual const std::string& LongDescription() const + { + return long_description_; + } + /** Set the short description */ + virtual void SetShortDescription(const std::string& short_description) + { + short_description_ = short_description; + } + /** Set the long description */ + virtual void SetLongDescription(const std::string& long_description) + { + long_description_ = long_description; + } + /** Get the registering class */ + virtual const std::string& RegisteringCategory() const + { + return registering_category_; + } + /** Set the registering class */ + virtual void SetRegisteringCategory(const std::string& registering_category) + { + registering_category_ = registering_category; + } + /** Get the Option's type */ + virtual const RegisteredOptionType& Type() const + { + return type_; + } + /** Get the Option's type */ + virtual void SetType(const RegisteredOptionType& type) + { + type_ = type; + } + /** Counter */ + virtual Index Counter() const + { + return counter_; + } + //@} + + /** @name Get / Set methods valid for specific types - NOTE: the Type + * must be set before calling these methods. + */ + //@{ + /** check if the option has a lower bound - can be called for + * OT_Number & OT_Integer*/ + virtual const bool& HasLower() const + { + DBG_ASSERT(type_ == OT_Number || type_ == OT_Integer); + return has_lower_; + } + /** check if the lower bound is strict - can be called for + OT_Number */ + virtual const bool& LowerStrict() const + { + DBG_ASSERT(type_ == OT_Number && has_lower_ == true); + return lower_strict_; + } + /** get the Number version of the lower bound - can be called for + * OT_Number */ + virtual Number LowerNumber() const + { + DBG_ASSERT(has_lower_ == true && type_ == OT_Number); + return lower_; + } + /** set the Number version of the lower bound - can be called for + * OT_Number */ + virtual void SetLowerNumber(const Number& lower, const bool& strict) + { + DBG_ASSERT(type_ == OT_Number); + lower_ = lower; + lower_strict_ = strict, has_lower_ = true; + } + /** get the Integer version of the lower bound can be called for + * OT_Integer*/ + virtual Index LowerInteger() const + { + DBG_ASSERT(has_lower_ == true && type_ == OT_Integer); + return (Index)lower_; + } + /** set the Integer version of the lower bound - can be called for + * OT_Integer */ + virtual void SetLowerInteger(const Index& lower) + { + DBG_ASSERT(type_ == OT_Integer); + lower_ = (Number)lower; + has_lower_ = true; + } + /** check if the option has an upper bound - can be called for + * OT_Number & OT_Integer*/ + virtual const bool& HasUpper() const + { + DBG_ASSERT(type_ == OT_Number || type_ == OT_Integer); + return has_upper_; + } + /** check if the upper bound is strict - can be called for + * OT_Number */ + virtual const bool& UpperStrict() const + { + DBG_ASSERT(type_ == OT_Number && has_upper_ == true); + return upper_strict_; + } + /** get the Number version of the upper bound - can be called for + * OT_Number */ + virtual Number UpperNumber() const + { + DBG_ASSERT(has_upper_ == true && type_ == OT_Number); + return upper_; + } + /** set the Number version of the upper bound - can be called for + * OT_Number */ + virtual void SetUpperNumber(const Number& upper, const bool& strict) + { + DBG_ASSERT(type_ == OT_Number); + upper_ = upper; + upper_strict_ = strict; + has_upper_ = true; + } + /** get the Integer version of the upper bound - can be called for + * OT_Integer*/ + virtual Index UpperInteger() const + { + DBG_ASSERT(has_upper_ == true && type_ == OT_Integer); + return (Index)upper_; + } + /** set the Integer version of the upper bound - can be called for + * OT_Integer */ + virtual void SetUpperInteger(const Index& upper) + { + DBG_ASSERT(type_ == OT_Integer); + upper_ = (Number)upper; + has_upper_ = true; + } + /** method to add valid string entries - can be called for + * OT_String */ + virtual void AddValidStringSetting(const std::string value, + const std::string description) + { + DBG_ASSERT(type_ == OT_String); + valid_strings_.push_back(string_entry(value, description)); + } + /** get the default as a Number - can be called for OT_Number */ + virtual Number DefaultNumber() const + { + DBG_ASSERT(type_ == OT_Number); + return default_number_; + } + /** Set the default as a Number - can be called for OT_Number */ + virtual void SetDefaultNumber(const Number& default_value) + { + DBG_ASSERT(type_ == OT_Number); + default_number_ = default_value; + } + /** get the default as an Integer - can be called for OT_Integer*/ + virtual Index DefaultInteger() const + { + DBG_ASSERT(type_ == OT_Integer); + return (Index)default_number_; + } + /** Set the default as an Integer - can be called for + OT_Integer */ + virtual void SetDefaultInteger(const Index& default_value) + { + DBG_ASSERT(type_ == OT_Integer); + default_number_ = (Number)default_value; + } + /** get the default as a string - can be called for OT_String */ + virtual std::string DefaultString() const + { + DBG_ASSERT(type_ == OT_String); + return default_string_; + } + /** get the default as a string, but as the index of the string in + * the list - helps map from a string to an enum- can be called + * for OT_String */ + virtual Index DefaultStringAsEnum() const + { + DBG_ASSERT(type_ == OT_String); + return MapStringSettingToEnum(default_string_); + } + /** Set the default as a string - can be called for OT_String */ + virtual void SetDefaultString(const std::string& default_value) + { + DBG_ASSERT(type_ == OT_String); + default_string_ = default_value; + } + /** get the valid string settings - can be called for OT_String */ + virtual std::vector GetValidStrings() const + { + DBG_ASSERT(type_ == OT_String); + return valid_strings_; + } + /** Check if the Number value is a valid setting - can be called + * for OT_Number */ + virtual bool IsValidNumberSetting(const Number& value) const + { + DBG_ASSERT(type_ == OT_Number); + if (has_lower_ && ((lower_strict_ == true && value <= lower_) || + (lower_strict_ == false && value < lower_))) { + return false; + } + if (has_upper_ && ((upper_strict_ == true && value >= upper_) || + (upper_strict_ == false && value > upper_))) { + return false; + } + return true; + } + /** Check if the Integer value is a valid setting - can be called + * for OT_Integer */ + virtual bool IsValidIntegerSetting(const Index& value) const + { + DBG_ASSERT(type_ == OT_Integer); + if (has_lower_ && value < lower_) { + return false; + } + if (has_upper_ && value > upper_) { + return false; + } + return true; + } + /** Check if the String value is a valid setting - can be called + * for OT_String */ + virtual bool IsValidStringSetting(const std::string& value) const; + + /** Map a user setting (allowing any case) to the case used when + * the setting was registered. + */ + virtual std::string MapStringSetting(const std::string& value) const; + + /** Map a user setting (allowing any case) to the index of the + * matched setting in the list of string settings. Helps map a + * string setting to an enumeration. + */ + virtual Index MapStringSettingToEnum(const std::string& value) const; + //@} + + /** output a description of the option */ + virtual void OutputDescription(const Journalist& jnlst) const; + /** output a more concise version */ + virtual void OutputShortDescription(const Journalist& jnlst) const; + /** output a latex version */ + virtual void OutputLatexDescription(const Journalist& jnlst) const; + + private: + std::string name_; + std::string short_description_; + std::string long_description_; + std::string registering_category_; + RegisteredOptionType type_; + + bool has_lower_; + bool lower_strict_; + Number lower_; + bool has_upper_; + bool upper_strict_; + Number upper_; + Number default_number_; + + void MakeValidLatexString(std::string source, std::string& dest) const; + std::string MakeValidLatexNumber(Number value) const; + + /** Compare two strings and return true if they are equal (case + insensitive comparison) */ + bool string_equal_insensitive(const std::string& s1, + const std::string& s2) const; + + std::vector valid_strings_; + std::string default_string_; + + /** Has the information as how many-th option this one was + * registered. */ + const Index counter_; + }; + + /** Class for storing registered options. Used for validation and + * documentation. + */ + class RegisteredOptions : public ReferencedObject + { + public: + /** Constructors / Destructors */ + //@{ + /** Standard Constructor */ + RegisteredOptions() + : + next_counter_(0), + current_registering_category_("Uncategorized") + {} + + /** Standard Destructor */ + virtual ~RegisteredOptions() + {} + //@} + + DECLARE_STD_EXCEPTION(OPTION_ALREADY_REGISTERED); + + /** Methods to interact with registered options */ + //@{ + /** set the registering class. All subsequent options will be + * added with the registered class */ + virtual void SetRegisteringCategory(const std::string& registering_category) + { + current_registering_category_ = registering_category; + } + + /** retrieve the value of the current registering category */ + virtual std::string RegisteringCategory() + { + return current_registering_category_; + } + + /** Add a Number option (with no restrictions) */ + virtual void AddNumberOption(const std::string& name, + const std::string& short_description, + Number default_value, + const std::string& long_description=""); + /** Add a Number option (with a lower bound) */ + virtual void AddLowerBoundedNumberOption(const std::string& name, + const std::string& short_description, + Number lower, bool strict, + Number default_value, + const std::string& long_description=""); + /** Add a Number option (with a upper bound) */ + virtual void AddUpperBoundedNumberOption(const std::string& name, + const std::string& short_description, + Number upper, bool strict, + Number default_value, + const std::string& long_description=""); + /** Add a Number option (with a both bounds) */ + virtual void AddBoundedNumberOption(const std::string& name, + const std::string& short_description, + Number lower, bool lower_strict, + Number upper, bool upper_strict, + Number default_value, + const std::string& long_description=""); + /** Add a Integer option (with no restrictions) */ + virtual void AddIntegerOption(const std::string& name, + const std::string& short_description, + Index default_value, + const std::string& long_description=""); + /** Add a Integer option (with a lower bound) */ + virtual void AddLowerBoundedIntegerOption(const std::string& name, + const std::string& short_description, + Index lower, Index default_value, + const std::string& long_description=""); + /** Add a Integer option (with a upper bound) */ + virtual void AddUpperBoundedIntegerOption(const std::string& name, + const std::string& short_description, + Index upper, Index default_value, + const std::string& long_description=""); + /** Add a Integer option (with a both bounds) */ + virtual void AddBoundedIntegerOption(const std::string& name, + const std::string& short_description, + Index lower, Index upper, + Index default_value, + const std::string& long_description=""); + + /** Add a String option (with no restrictions) */ + virtual void AddStringOption(const std::string& name, + const std::string& short_description, + const std::string& default_value, + const std::vector& settings, + const std::vector& descriptions, + const std::string& long_description=""); + /** Methods that make adding string options with only a few + * entries easier */ + virtual void AddStringOption1(const std::string& name, + const std::string& short_description, + const std::string& default_value, + const std::string& setting1, + const std::string& description1, + const std::string& long_description=""); + virtual void AddStringOption2(const std::string& name, + const std::string& short_description, + const std::string& default_value, + const std::string& setting1, + const std::string& description1, + const std::string& setting2, + const std::string& description2, + const std::string& long_description=""); + virtual void AddStringOption3(const std::string& name, + const std::string& short_description, + const std::string& default_value, + const std::string& setting1, + const std::string& description1, + const std::string& setting2, + const std::string& description2, + const std::string& setting3, + const std::string& description3, + const std::string& long_description=""); + virtual void AddStringOption4(const std::string& name, + const std::string& short_description, + const std::string& default_value, + const std::string& setting1, + const std::string& description1, + const std::string& setting2, + const std::string& description2, + const std::string& setting3, + const std::string& description3, + const std::string& setting4, + const std::string& description4, + const std::string& long_description=""); + virtual void AddStringOption5(const std::string& name, + const std::string& short_description, + const std::string& default_value, + const std::string& setting1, + const std::string& description1, + const std::string& setting2, + const std::string& description2, + const std::string& setting3, + const std::string& description3, + const std::string& setting4, + const std::string& description4, + const std::string& setting5, + const std::string& description5, + const std::string& long_description=""); + virtual void AddStringOption6(const std::string& name, + const std::string& short_description, + const std::string& default_value, + const std::string& setting1, + const std::string& description1, + const std::string& setting2, + const std::string& description2, + const std::string& setting3, + const std::string& description3, + const std::string& setting4, + const std::string& description4, + const std::string& setting5, + const std::string& description5, + const std::string& setting6, + const std::string& description6, + const std::string& long_description=""); + virtual void AddStringOption7(const std::string& name, + const std::string& short_description, + const std::string& default_value, + const std::string& setting1, + const std::string& description1, + const std::string& setting2, + const std::string& description2, + const std::string& setting3, + const std::string& description3, + const std::string& setting4, + const std::string& description4, + const std::string& setting5, + const std::string& description5, + const std::string& setting6, + const std::string& description6, + const std::string& setting7, + const std::string& description7, + const std::string& long_description=""); + virtual void AddStringOption8(const std::string& name, + const std::string& short_description, + const std::string& default_value, + const std::string& setting1, + const std::string& description1, + const std::string& setting2, + const std::string& description2, + const std::string& setting3, + const std::string& description3, + const std::string& setting4, + const std::string& description4, + const std::string& setting5, + const std::string& description5, + const std::string& setting6, + const std::string& description6, + const std::string& setting7, + const std::string& description7, + const std::string& setting8, + const std::string& description8, + const std::string& long_description=""); + virtual void AddStringOption9(const std::string& name, + const std::string& short_description, + const std::string& default_value, + const std::string& setting1, + const std::string& description1, + const std::string& setting2, + const std::string& description2, + const std::string& setting3, + const std::string& description3, + const std::string& setting4, + const std::string& description4, + const std::string& setting5, + const std::string& description5, + const std::string& setting6, + const std::string& description6, + const std::string& setting7, + const std::string& description7, + const std::string& setting8, + const std::string& description8, + const std::string& setting9, + const std::string& description9, + const std::string& long_description=""); + virtual void AddStringOption10(const std::string& name, + const std::string& short_description, + const std::string& default_value, + const std::string& setting1, + const std::string& description1, + const std::string& setting2, + const std::string& description2, + const std::string& setting3, + const std::string& description3, + const std::string& setting4, + const std::string& description4, + const std::string& setting5, + const std::string& description5, + const std::string& setting6, + const std::string& description6, + const std::string& setting7, + const std::string& description7, + const std::string& setting8, + const std::string& description8, + const std::string& setting9, + const std::string& description9, + const std::string& setting10, + const std::string& description10, + const std::string& long_description=""); + + /** Get a registered option - this will return NULL if the option + * does not exist */ + virtual SmartPtr GetOption(const std::string& name); + + /** Output documentation for the options - gives a description, + * etc. */ + virtual void OutputOptionDocumentation(const Journalist& jnlst, std::list& categories); + + /** Output documentation in Latex format to include in a latex file */ + virtual void OutputLatexOptionDocumentation(const Journalist& jnlst, std::list& categories); + //@} + + typedef std::map > RegOptionsList; + + /** Giving access to iteratable representation of the registered + * options */ + virtual const RegOptionsList& RegisteredOptionsList () const + { + return registered_options_; + } + + private: + Index next_counter_; + std::string current_registering_category_; + std::map > registered_options_; + }; +} // namespace Ipopt + +#endif diff --git a/thirdparty/windows/include/coin/IpReturnCodes.h b/thirdparty/windows/include/coin/IpReturnCodes.h index 54cf0ae..7d98103 100644 --- a/thirdparty/windows/include/coin/IpReturnCodes.h +++ b/thirdparty/windows/include/coin/IpReturnCodes.h @@ -1,18 +1,18 @@ -/*********************************************************************** -// Copyright (C) 2004, 2006 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpReturnCodes.h 735 2006-06-04 06:10:05Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 -************************************************************************/ - -#ifndef __IPRETURNCODES_H__ -#define __IPRETURNCODES_H__ - -/* include from a common include file */ - -#include "IpReturnCodes_inc.h" - -#endif +/*********************************************************************** +// Copyright (C) 2004, 2006 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpReturnCodes.h 1861 2010-12-21 21:34:47Z andreasw $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 +************************************************************************/ + +#ifndef __IPRETURNCODES_H__ +#define __IPRETURNCODES_H__ + +/* include from a common include file */ + +#include "IpReturnCodes_inc.h" + +#endif diff --git a/thirdparty/windows/include/coin/IpReturnCodes.hpp b/thirdparty/windows/include/coin/IpReturnCodes.hpp index 8c688b7..7ad2649 100644 --- a/thirdparty/windows/include/coin/IpReturnCodes.hpp +++ b/thirdparty/windows/include/coin/IpReturnCodes.hpp @@ -1,21 +1,21 @@ -/*********************************************************************** -// Copyright (C) 2006 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpReturnCodes.hpp 1324 2008-09-16 14:19:26Z andreasw $ -// -// Authors: Andreas Waechter IBM 2006-03-01 -************************************************************************/ - -#ifndef __IPRETURNCODES_HPP__ -#define __IPRETURNCODES_HPP__ - -/* include from a common include file */ - -namespace Ipopt -{ -#include "IpReturnCodes_inc.h" -} - -#endif +/*********************************************************************** +// Copyright (C) 2006 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpReturnCodes.hpp 1861 2010-12-21 21:34:47Z andreasw $ +// +// Authors: Andreas Waechter IBM 2006-03-01 +************************************************************************/ + +#ifndef __IPRETURNCODES_HPP__ +#define __IPRETURNCODES_HPP__ + +/* include from a common include file */ + +namespace Ipopt +{ +#include "IpReturnCodes_inc.h" +} + +#endif diff --git a/thirdparty/windows/include/coin/IpReturnCodes.inc b/thirdparty/windows/include/coin/IpReturnCodes.inc index 033d47f..f0d6379 100644 --- a/thirdparty/windows/include/coin/IpReturnCodes.inc +++ b/thirdparty/windows/include/coin/IpReturnCodes.inc @@ -1,70 +1,70 @@ -C Copyright (C) 2005, 2009 International Business Machines and others. -C All Rights Reserved. -C This code is published under the Common Public License. -C -C $Id: IpReturnCodes.inc 1430 2009-04-20 20:58:25Z andreasw $ -C -C Author: Andreas Waechter IBM 2005-08-11 -C - INTEGER IP_SOLVE_SUCCEEDED - PARAMETER( IP_SOLVE_SUCCEEDED = 0 ) - - INTEGER IP_ACCEPTABLE_LEVEL - PARAMETER( IP_ACCEPTABLE_LEVEL = 1 ) - - INTEGER IP_INFEASIBLE_PROBLEM - PARAMETER( IP_INFEASIBLE_PROBLEM = 2 ) - - INTEGER IP_SEARCH_DIRECTION_TOO_SMALL - PARAMETER( IP_SEARCH_DIRECTION_TOO_SMALL = 3 ) - - INTEGER IP_DIVERGING_ITERATES - PARAMETER( IP_DIVERGING_ITERATES = 4 ) - - INTEGER IP_USER_REQUESTED_STOP - PARAMETER( IP_USER_REQUESTED_STOP = 5 ) - - INTEGER IP_FEASIBLE_POINT_FOUND - PARAMETER( IP_FEASIBLE_POINT_FOUND = 6 ) - - INTEGER IP_ITERATION_EXCEEDED - PARAMETER( IP_ITERATION_EXCEEDED = -1 ) - - INTEGER IP_RESTORATION_FAILED - PARAMETER( IP_RESTORATION_FAILED = -2 ) - - INTEGER IP_ERROR_IN_STEP_COMPUTATION - PARAMETER( IP_ERROR_IN_STEP_COMPUTATION = -3 ) - - INTEGER IP_CPUTIME_EXCEEDED - PARAMETER( IP_CPUTIME_EXCEEDED = -4 ) - - INTEGER IP_NOT_ENOUGH_DEGREES_OF_FRE - PARAMETER( IP_NOT_ENOUGH_DEGREES_OF_FRE = -10 ) - - INTEGER IP_INVALID_PROBLEM_DEFINITION - PARAMETER( IP_INVALID_PROBLEM_DEFINITION = -11) - - INTEGER IP_INVALID_OPTION - PARAMETER( IP_INVALID_OPTION = -12 ) - - INTEGER IP_INVALID_NUMBER_DETECTED - PARAMETER( IP_INVALID_NUMBER_DETECTED = -13 ) - - INTEGER IP_UNRECOVERABLE_EXCEPTION - PARAMETER( IP_UNRECOVERABLE_EXCEPTION = -100 ) - - INTEGER IP_NON_IPOPT_EXCEPTION - PARAMETER( IP_NON_IPOPT_EXCEPTION = -101 ) - - INTEGER IP_INSUFFICIENT_MEMORY - PARAMETER( IP_INSUFFICIENT_MEMORY = -102 ) - - INTEGER IP_INTERNAL_ERROR - PARAMETER( IP_INTERNAL_ERROR = -199 ) - - INTEGER IP_REGULAR_MODE - PARAMETER( IP_REGULAR_MODE = 0 ) - - INTEGER IP_RESTORATION_PHASE_MODE - PARAMETER( IP_RESTORATION_PHASE_MODE = 1 ) +C Copyright (C) 2005, 2009 International Business Machines and others. +C All Rights Reserved. +C This code is published under the Eclipse Public License. +C +C $Id: IpReturnCodes.inc 1861 2010-12-21 21:34:47Z andreasw $ +C +C Author: Andreas Waechter IBM 2005-08-11 +C + INTEGER IP_SOLVE_SUCCEEDED + PARAMETER( IP_SOLVE_SUCCEEDED = 0 ) + + INTEGER IP_ACCEPTABLE_LEVEL + PARAMETER( IP_ACCEPTABLE_LEVEL = 1 ) + + INTEGER IP_INFEASIBLE_PROBLEM + PARAMETER( IP_INFEASIBLE_PROBLEM = 2 ) + + INTEGER IP_SEARCH_DIRECTION_TOO_SMALL + PARAMETER( IP_SEARCH_DIRECTION_TOO_SMALL = 3 ) + + INTEGER IP_DIVERGING_ITERATES + PARAMETER( IP_DIVERGING_ITERATES = 4 ) + + INTEGER IP_USER_REQUESTED_STOP + PARAMETER( IP_USER_REQUESTED_STOP = 5 ) + + INTEGER IP_FEASIBLE_POINT_FOUND + PARAMETER( IP_FEASIBLE_POINT_FOUND = 6 ) + + INTEGER IP_ITERATION_EXCEEDED + PARAMETER( IP_ITERATION_EXCEEDED = -1 ) + + INTEGER IP_RESTORATION_FAILED + PARAMETER( IP_RESTORATION_FAILED = -2 ) + + INTEGER IP_ERROR_IN_STEP_COMPUTATION + PARAMETER( IP_ERROR_IN_STEP_COMPUTATION = -3 ) + + INTEGER IP_CPUTIME_EXCEEDED + PARAMETER( IP_CPUTIME_EXCEEDED = -4 ) + + INTEGER IP_NOT_ENOUGH_DEGREES_OF_FRE + PARAMETER( IP_NOT_ENOUGH_DEGREES_OF_FRE = -10 ) + + INTEGER IP_INVALID_PROBLEM_DEFINITION + PARAMETER( IP_INVALID_PROBLEM_DEFINITION = -11) + + INTEGER IP_INVALID_OPTION + PARAMETER( IP_INVALID_OPTION = -12 ) + + INTEGER IP_INVALID_NUMBER_DETECTED + PARAMETER( IP_INVALID_NUMBER_DETECTED = -13 ) + + INTEGER IP_UNRECOVERABLE_EXCEPTION + PARAMETER( IP_UNRECOVERABLE_EXCEPTION = -100 ) + + INTEGER IP_NON_IPOPT_EXCEPTION + PARAMETER( IP_NON_IPOPT_EXCEPTION = -101 ) + + INTEGER IP_INSUFFICIENT_MEMORY + PARAMETER( IP_INSUFFICIENT_MEMORY = -102 ) + + INTEGER IP_INTERNAL_ERROR + PARAMETER( IP_INTERNAL_ERROR = -199 ) + + INTEGER IP_REGULAR_MODE + PARAMETER( IP_REGULAR_MODE = 0 ) + + INTEGER IP_RESTORATION_PHASE_MODE + PARAMETER( IP_RESTORATION_PHASE_MODE = 1 ) diff --git a/thirdparty/windows/include/coin/IpReturnCodes_inc.h b/thirdparty/windows/include/coin/IpReturnCodes_inc.h index 2de94bb..8a9b228 100644 --- a/thirdparty/windows/include/coin/IpReturnCodes_inc.h +++ b/thirdparty/windows/include/coin/IpReturnCodes_inc.h @@ -1,46 +1,46 @@ -/*********************************************************************** -// Copyright (C) 2004, 2009 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpReturnCodes_inc.h 1430 2009-04-20 20:58:25Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 -************************************************************************/ - -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ -/* !!!!!!!!!!!!!!!! REMEMBER TO UPDATE IpReturnCodes.inc !!!!!!!!!!!!!!!! */ -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ - -/** Return codes for the Optimize call for an application */ -enum ApplicationReturnStatus - { - Solve_Succeeded=0, - Solved_To_Acceptable_Level=1, - Infeasible_Problem_Detected=2, - Search_Direction_Becomes_Too_Small=3, - Diverging_Iterates=4, - User_Requested_Stop=5, - Feasible_Point_Found=6, - - Maximum_Iterations_Exceeded=-1, - Restoration_Failed=-2, - Error_In_Step_Computation=-3, - Maximum_CpuTime_Exceeded=-4, - Not_Enough_Degrees_Of_Freedom=-10, - Invalid_Problem_Definition=-11, - Invalid_Option=-12, - Invalid_Number_Detected=-13, - - Unrecoverable_Exception=-100, - NonIpopt_Exception_Thrown=-101, - Insufficient_Memory=-102, - Internal_Error=-199 - }; - -/** enum to indicate the mode in which the algorithm is */ -enum AlgorithmMode - { - RegularMode=0, - RestorationPhaseMode=1 - }; +/*********************************************************************** +// Copyright (C) 2004, 2009 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpReturnCodes_inc.h 2216 2013-04-14 17:06:00Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 +************************************************************************/ + +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ +/* !!!!!!!!! REMEMBER TO UPDATE IpReturnCodes.inc and Ipopt.java !!!!!!!! */ +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ + +/** Return codes for the Optimize call for an application */ +enum ApplicationReturnStatus + { + Solve_Succeeded=0, + Solved_To_Acceptable_Level=1, + Infeasible_Problem_Detected=2, + Search_Direction_Becomes_Too_Small=3, + Diverging_Iterates=4, + User_Requested_Stop=5, + Feasible_Point_Found=6, + + Maximum_Iterations_Exceeded=-1, + Restoration_Failed=-2, + Error_In_Step_Computation=-3, + Maximum_CpuTime_Exceeded=-4, + Not_Enough_Degrees_Of_Freedom=-10, + Invalid_Problem_Definition=-11, + Invalid_Option=-12, + Invalid_Number_Detected=-13, + + Unrecoverable_Exception=-100, + NonIpopt_Exception_Thrown=-101, + Insufficient_Memory=-102, + Internal_Error=-199 + }; + +/** enum to indicate the mode in which the algorithm is */ +enum AlgorithmMode + { + RegularMode=0, + RestorationPhaseMode=1 + }; diff --git a/thirdparty/windows/include/coin/IpSmartPtr.hpp b/thirdparty/windows/include/coin/IpSmartPtr.hpp index ef7e705..263fddf 100644 --- a/thirdparty/windows/include/coin/IpSmartPtr.hpp +++ b/thirdparty/windows/include/coin/IpSmartPtr.hpp @@ -1,670 +1,734 @@ -// Copyright (C) 2004, 2007 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpSmartPtr.hpp 1019 2007-06-24 03:52:34Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPSMARTPTR_HPP__ -#define __IPSMARTPTR_HPP__ - -#include "IpReferenced.hpp" - -#include "IpDebug.hpp" -#if COIN_IPOPT_CHECKLEVEL > 2 -# define IP_DEBUG_SMARTPTR -#endif - -namespace Ipopt -{ - - /** Template class for Smart Pointers. - * A SmartPtr behaves much like a raw pointer, but manages the lifetime - * of an object, deleting the object automatically. This class implements - * a reference-counting, intrusive smart pointer design, where all - * objects pointed to must inherit off of ReferencedObject, which - * stores the reference count. Although this is intrusive (native types - * and externally authored classes require wrappers to be referenced - * by smart pointers), it is a safer design. A more detailed discussion of - * these issues follows after the usage information. - * - * Usage Example: - * Note: to use the SmartPtr, all objects to which you point MUST - * inherit off of ReferencedObject. - * - * \verbatim - * - * In MyClass.hpp... - * - * #include "IpReferenced.hpp" - - * namespace Ipopt { - * - * class MyClass : public ReferencedObject // must derive from ReferencedObject - * { - * ... - * } - * } // namespace Ipopt - * - * - * In my_usage.cpp... - * - * #include "IpSmartPtr.hpp" - * #include "MyClass.hpp" - * - * void func(AnyObject& obj) - * { - * SmartPtr ptr_to_myclass = new MyClass(...); - * // ptr_to_myclass now points to a new MyClass, - * // and the reference count is 1 - * - * ... - * - * obj.SetMyClass(ptr_to_myclass); - * // Here, let's assume that AnyObject uses a - * // SmartPtr internally here. - * // Now, both ptr_to_myclass and the internal - * // SmartPtr in obj point to the same MyClass object - * // and its reference count is 2. - * - * ... - * - * // No need to delete ptr_to_myclass, this - * // will be done automatically when the - * // reference count drops to zero. - * - * } - * - * \endverbatim - * - * It is not necessary to use SmartPtr's in all cases where an - * object is used that has been allocated "into" a SmartPtr. It is - * possible to just pass objects by reference or regular pointers, - * even if lower down in the stack a SmartPtr is to be held on to. - * Everything should work fine as long as a pointer created by "new" - * is immediately passed into a SmartPtr, and if SmartPtr's are used - * to hold on to objects. - * - * Other Notes: - * The SmartPtr implements both dereference operators -> & *. - * The SmartPtr does NOT implement a conversion operator to - * the raw pointer. Use the GetRawPtr() method when this - * is necessary. Make sure that the raw pointer is NOT - * deleted. - * The SmartPtr implements the comparison operators == & != - * for a variety of types. Use these instead of - * \verbatim - * if (GetRawPtr(smrt_ptr) == ptr) // Don't use this - * \endverbatim - * SmartPtr's, as currently implemented, do NOT handle circular references. - * For example: consider a higher level object using SmartPtrs to point to - * A and B, but A and B also point to each other (i.e. A has a SmartPtr - * to B and B has a SmartPtr to A). In this scenario, when the higher - * level object is finished with A and B, their reference counts will - * never drop to zero (since they reference each other) and they - * will not be deleted. This can be detected by memory leak tools like - * valgrind. If the circular reference is necessary, the problem can be - * overcome by a number of techniques: - * - * 1) A and B can have a method that "releases" each other, that is - * they set their internal SmartPtrs to NULL. - * \verbatim - * void AClass::ReleaseCircularReferences() - * { - * smart_ptr_to_B = NULL; - * } - * \endverbatim - * Then, the higher level class can call these methods before - * it is done using A & B. - * - * 2) Raw pointers can be used in A and B to reference each other. - * Here, an implicit assumption is made that the lifetime is - * controlled by the higher level object and that A and B will - * both exist in a controlled manner. Although this seems - * dangerous, in many situations, this type of referencing - * is very controlled and this is reasonably safe. - * - * 3) This SmartPtr class could be redesigned with the Weak/Strong - * design concept. Here, the SmartPtr is identified as being - * Strong (controls lifetime of the object) or Weak (merely - * referencing the object). The Strong SmartPtr increments - * (and decrements) the reference count in ReferencedObject - * but the Weak SmartPtr does not. In the example above, - * the higher level object would have Strong SmartPtrs to - * A and B, but A and B would have Weak SmartPtrs to each - * other. Then, when the higher level object was done with - * A and B, they would be deleted. The Weak SmartPtrs in A - * and B would not decrement the reference count and would, - * of course, not delete the object. This idea is very similar - * to item (2), where it is implied that the sequence of events - * is controlled such that A and B will not call anything using - * their pointers following the higher level delete (i.e. in - * their destructors!). This is somehow safer, however, because - * code can be written (however expensive) to perform run-time - * detection of this situation. For example, the ReferencedObject - * could store pointers to all Weak SmartPtrs that are referencing - * it and, in its destructor, tell these pointers that it is - * dying. They could then set themselves to NULL, or set an - * internal flag to detect usage past this point. - * - * Comments on Non-Intrusive Design: - * In a non-intrusive design, the reference count is stored somewhere other - * than the object being referenced. This means, unless the reference - * counting pointer is the first referencer, it must get a pointer to the - * referenced object from another smart pointer (so it has access to the - * reference count location). In this non-intrusive design, if we are - * pointing to an object with a smart pointer (or a number of smart - * pointers), and we then give another smart pointer the address through - * a RAW pointer, we will have two independent, AND INCORRECT, reference - * counts. To avoid this pitfall, we use an intrusive reference counting - * technique where the reference count is stored in the object being - * referenced. - */ - template - class SmartPtr : public Referencer - { - public: -#define dbg_smartptr_verbosity 0 - - /**@name Constructors/Destructors */ - //@{ - /** Default constructor, initialized to NULL */ - SmartPtr(); - - /** Copy constructor, initialized from copy */ - SmartPtr(const SmartPtr& copy); - - /** Constructor, initialized from T* ptr */ - SmartPtr(T* ptr); - - /** Destructor, automatically decrements the - * reference count, deletes the object if - * necessary.*/ - ~SmartPtr(); - //@} - - /**@name Overloaded operators. */ - //@{ - /** Overloaded arrow operator, allows the user to call - * methods using the contained pointer. */ - T* operator->() const; - - /** Overloaded dereference operator, allows the user - * to dereference the contained pointer. */ - T& operator*() const; - - /** Overloaded equals operator, allows the user to - * set the value of the SmartPtr from a raw pointer */ - SmartPtr& operator=(T* rhs); - - /** Overloaded equals operator, allows the user to - * set the value of the SmartPtr from another - * SmartPtr */ - SmartPtr& operator=(const SmartPtr& rhs); - - /** Overloaded equality comparison operator, allows the - * user to compare the value of two SmartPtrs */ - template - friend - bool operator==(const SmartPtr& lhs, const SmartPtr& rhs); - - /** Overloaded equality comparison operator, allows the - * user to compare the value of a SmartPtr with a raw pointer. */ - template - friend - bool operator==(const SmartPtr& lhs, U2* raw_rhs); - - /** Overloaded equality comparison operator, allows the - * user to compare the value of a raw pointer with a SmartPtr. */ - template - friend - bool operator==(U1* lhs, const SmartPtr& raw_rhs); - - /** Overloaded in-equality comparison operator, allows the - * user to compare the value of two SmartPtrs */ - template - friend - bool operator!=(const SmartPtr& lhs, const SmartPtr& rhs); - - /** Overloaded in-equality comparison operator, allows the - * user to compare the value of a SmartPtr with a raw pointer. */ - template - friend - bool operator!=(const SmartPtr& lhs, U2* raw_rhs); - - /** Overloaded in-equality comparison operator, allows the - * user to compare the value of a SmartPtr with a raw pointer. */ - template - friend - bool operator!=(U1* lhs, const SmartPtr& raw_rhs); - //@} - - /**@name friend method declarations. */ - //@{ - /** Returns the raw pointer contained. - * Use to get the value of - * the raw ptr (i.e. to pass to other - * methods/functions, etc.) - * Note: This method does NOT copy, - * therefore, modifications using this - * value modify the underlying object - * contained by the SmartPtr, - * NEVER delete this returned value. - */ - template - friend - U* GetRawPtr(const SmartPtr& smart_ptr); - - /** Returns a const pointer */ - template - friend - SmartPtr ConstPtr(const SmartPtr& smart_ptr); - - /** Returns true if the SmartPtr is NOT NULL. - * Use this to check if the SmartPtr is not null - * This is preferred to if(GetRawPtr(sp) != NULL) - */ - template - friend - bool IsValid(const SmartPtr& smart_ptr); - - /** Returns true if the SmartPtr is NULL. - * Use this to check if the SmartPtr IsNull. - * This is preferred to if(GetRawPtr(sp) == NULL) - */ - template - friend - bool IsNull(const SmartPtr& smart_ptr); - //@} - - private: - /**@name Private Data/Methods */ - //@{ - /** Actual raw pointer to the object. */ - T* ptr_; - - /** Set the value of the internal raw pointer - * from another raw pointer, releasing the - * previously referenced object if necessary. */ - SmartPtr& SetFromRawPtr_(T* rhs); - - /** Set the value of the internal raw pointer - * from a SmartPtr, releasing the previously referenced - * object if necessary. */ - SmartPtr& SetFromSmartPtr_(const SmartPtr& rhs); - - /** Release the currently referenced object. */ - void ReleasePointer_(); - //@} - }; - - /**@name SmartPtr friend function declarations.*/ - //@{ - template - U* GetRawPtr(const SmartPtr& smart_ptr); - - template - SmartPtr ConstPtr(const SmartPtr& smart_ptr); - - template - bool IsNull(const SmartPtr& smart_ptr); - - template - bool IsValid(const SmartPtr& smart_ptr); - - template - bool operator==(const SmartPtr& lhs, const SmartPtr& rhs); - - template - bool operator==(const SmartPtr& lhs, U2* raw_rhs); - - template - bool operator==(U1* lhs, const SmartPtr& raw_rhs); - - template - bool operator!=(const SmartPtr& lhs, const SmartPtr& rhs); - - template - bool operator!=(const SmartPtr& lhs, U2* raw_rhs); - - template - bool operator!=(U1* lhs, const SmartPtr& raw_rhs); - - //@} - - - template - SmartPtr::SmartPtr() - : - ptr_(NULL) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_METH("SmartPtr::SmartPtr()", dbg_smartptr_verbosity); -#endif - -#ifdef CHECK_SMARTPTR - - const ReferencedObject* trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ - = ptr_; - trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = NULL; -#endif - - } - - - template - SmartPtr::SmartPtr(const SmartPtr& copy) - : - ptr_(NULL) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_METH("SmartPtr::SmartPtr(const SmartPtr& copy)", dbg_smartptr_verbosity); -#endif - -#ifdef CHECK_SMARTPTR - - const ReferencedObject* trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ - = ptr_; - trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = NULL; -#endif - - (void) SetFromSmartPtr_(copy); - } - - - template - SmartPtr::SmartPtr(T* ptr) - : - ptr_(NULL) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_METH("SmartPtr::SmartPtr(T* ptr)", dbg_smartptr_verbosity); -#endif - -#ifdef CHECK_SMARTPTR - - const ReferencedObject* trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ - = ptr_; - trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = NULL; -#endif - - (void) SetFromRawPtr_(ptr); - } - - template - SmartPtr::~SmartPtr() - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_METH("SmartPtr::~SmartPtr(T* ptr)", dbg_smartptr_verbosity); -#endif - - ReleasePointer_(); - } - - - template - T* SmartPtr::operator->() const - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_METH("T* SmartPtr::operator->()", dbg_smartptr_verbosity); -#endif - - // cannot deref a null pointer -#if COIN_IPOPT_CHECKLEVEL > 0 - - assert(ptr_); -#endif - - return ptr_; - } - - - template - T& SmartPtr::operator*() const - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_METH("T& SmartPtr::operator*()", dbg_smartptr_verbosity); -#endif - - // cannot dereference a null pointer -#if COIN_IPOPT_CHECKLEVEL > 0 - - assert(ptr_); -#endif - - return *ptr_; - } - - - template - SmartPtr& SmartPtr::operator=(T* rhs) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_METH("SmartPtr& SmartPtr::operator=(T* rhs)", dbg_smartptr_verbosity); -#endif - - return SetFromRawPtr_(rhs); - } - - - template - SmartPtr& SmartPtr::operator=(const SmartPtr& rhs) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_METH( - "SmartPtr& SmartPtr::operator=(const SmartPtr& rhs)", - dbg_smartptr_verbosity); -#endif - - return SetFromSmartPtr_(rhs); - } - - - template - SmartPtr& SmartPtr::SetFromRawPtr_(T* rhs) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_METH( - "SmartPtr& SmartPtr::SetFromRawPtr_(T* rhs)", dbg_smartptr_verbosity); -#endif - - // Release any old pointer - ReleasePointer_(); - - if (rhs != NULL) { - rhs->AddRef(this); - ptr_ = rhs; - } - - return *this; - } - - template - SmartPtr& SmartPtr::SetFromSmartPtr_(const SmartPtr& rhs) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_METH( - "SmartPtr& SmartPtr::SetFromSmartPtr_(const SmartPtr& rhs)", - dbg_smartptr_verbosity); -#endif - - T* ptr = GetRawPtr(rhs); - /* AW: I changed this so that NULL is correctly copied from the - right hand side */ - // if (ptr != NULL) { - // SetFromRawPtr_(ptr); - // } - SetFromRawPtr_(ptr); - - return (*this); - } - - - template - void SmartPtr::ReleasePointer_() - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_METH( - "void SmartPtr::ReleasePointer()", - dbg_smartptr_verbosity); -#endif - - if (ptr_) { - ptr_->ReleaseRef(this); - if (ptr_->ReferenceCount() == 0) { - delete ptr_; - } - ptr_ = NULL; - } - } - - - template - U* GetRawPtr(const SmartPtr& smart_ptr) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_FUN( - "T* GetRawPtr(const SmartPtr& smart_ptr)", - 0); -#endif - - return smart_ptr.ptr_; - } - - template - SmartPtr ConstPtr(const SmartPtr& smart_ptr) - { - // compiler should implicitly cast - return GetRawPtr(smart_ptr); - } - - template - bool IsValid(const SmartPtr& smart_ptr) - { - return !IsNull(smart_ptr); - } - - template - bool IsNull(const SmartPtr& smart_ptr) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_FUN( - "bool IsNull(const SmartPtr& smart_ptr)", - 0); -#endif - - return (smart_ptr.ptr_ == NULL); - } - - - template - bool ComparePointers(const U1* lhs, const U2* rhs) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_FUN( - "bool ComparePtrs(const U1* lhs, const U2* rhs)", - dbg_smartptr_verbosity); -#endif - - if (lhs == rhs) { - return true; - } - - // Even if lhs and rhs point to the same object - // with different interfaces U1 and U2, we cannot guarantee that - // the value of the pointers will be equivalent. We can - // guarantee this if we convert to void* - const void* v_lhs = static_cast(lhs); - const void* v_rhs = static_cast(rhs); - if (v_lhs == v_rhs) { - return true; - } - - // They must not be the same - return false; - } - - template - bool operator==(const SmartPtr& lhs, const SmartPtr& rhs) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_FUN( - "bool operator==(const SmartPtr& lhs, const SmartPtr& rhs)", - dbg_smartptr_verbosity); -#endif - - U1* raw_lhs = GetRawPtr(lhs); - U2* raw_rhs = GetRawPtr(rhs); - return ComparePointers(raw_lhs, raw_rhs); - } - - template - bool operator==(const SmartPtr& lhs, U2* raw_rhs) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_FUN( - "bool operator==(SmartPtr& lhs, U2* rhs)", - dbg_smartptr_verbosity); -#endif - - U1* raw_lhs = GetRawPtr(lhs); - return ComparePointers(raw_lhs, raw_rhs); - } - - template - bool operator==(U1* raw_lhs, const SmartPtr& rhs) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_FUN( - "bool operator==(U1* raw_lhs, SmartPtr& rhs)", - dbg_smartptr_verbosity); -#endif - - const U2* raw_rhs = GetRawPtr(rhs); - return ComparePointers(raw_lhs, raw_rhs); - } - - template - bool operator!=(const SmartPtr& lhs, const SmartPtr& rhs) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_FUN( - "bool operator!=(const SmartPtr& lhs, const SmartPtr& rhs)", - dbg_smartptr_verbosity); -#endif - - bool retValue = operator==(lhs, rhs); - return !retValue; - } - - template - bool operator!=(const SmartPtr& lhs, U2* raw_rhs) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_FUN( - "bool operator!=(SmartPtr& lhs, U2* rhs)", - dbg_smartptr_verbosity); -#endif - - bool retValue = operator==(lhs, raw_rhs); - return !retValue; - } - - template - bool operator!=(U1* raw_lhs, const SmartPtr& rhs) - { -#ifdef IP_DEBUG_SMARTPTR - DBG_START_FUN( - "bool operator!=(U1* raw_lhs, SmartPtr& rhs)", - dbg_smartptr_verbosity); -#endif - - bool retValue = operator==(raw_lhs, rhs); - return !retValue; - } - -} // namespace Ipopt - -#endif - +// Copyright (C) 2004, 2011 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpSmartPtr.hpp 2182 2013-03-30 20:02:18Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPSMARTPTR_HPP__ +#define __IPSMARTPTR_HPP__ + +#include "IpReferenced.hpp" + +#include "IpDebug.hpp" +#if COIN_IPOPT_CHECKLEVEL > 2 +# define IP_DEBUG_SMARTPTR +#endif +#ifndef IPOPT_UNUSED +# if defined(__GNUC__) +# define IPOPT_UNUSED __attribute__((unused)) +# else +# define IPOPT_UNUSED +# endif +#endif + +namespace Ipopt +{ + + /** Template class for Smart Pointers. + * A SmartPtr behaves much like a raw pointer, but manages the lifetime + * of an object, deleting the object automatically. This class implements + * a reference-counting, intrusive smart pointer design, where all + * objects pointed to must inherit off of ReferencedObject, which + * stores the reference count. Although this is intrusive (native types + * and externally authored classes require wrappers to be referenced + * by smart pointers), it is a safer design. A more detailed discussion of + * these issues follows after the usage information. + * + * Usage Example: + * Note: to use the SmartPtr, all objects to which you point MUST + * inherit off of ReferencedObject. + * + * \verbatim + * + * In MyClass.hpp... + * + * #include "IpReferenced.hpp" + + * namespace Ipopt { + * + * class MyClass : public ReferencedObject // must derive from ReferencedObject + * { + * ... + * } + * } // namespace Ipopt + * + * + * In my_usage.cpp... + * + * #include "IpSmartPtr.hpp" + * #include "MyClass.hpp" + * + * void func(AnyObject& obj) + * { + * SmartPtr ptr_to_myclass = new MyClass(...); + * // ptr_to_myclass now points to a new MyClass, + * // and the reference count is 1 + * + * ... + * + * obj.SetMyClass(ptr_to_myclass); + * // Here, let's assume that AnyObject uses a + * // SmartPtr internally here. + * // Now, both ptr_to_myclass and the internal + * // SmartPtr in obj point to the same MyClass object + * // and its reference count is 2. + * + * ... + * + * // No need to delete ptr_to_myclass, this + * // will be done automatically when the + * // reference count drops to zero. + * + * } + * + * \endverbatim + * + * It is not necessary to use SmartPtr's in all cases where an + * object is used that has been allocated "into" a SmartPtr. It is + * possible to just pass objects by reference or regular pointers, + * even if lower down in the stack a SmartPtr is to be held on to. + * Everything should work fine as long as a pointer created by "new" + * is immediately passed into a SmartPtr, and if SmartPtr's are used + * to hold on to objects. + * + * Other Notes: + * The SmartPtr implements both dereference operators -> & *. + * The SmartPtr does NOT implement a conversion operator to + * the raw pointer. Use the GetRawPtr() method when this + * is necessary. Make sure that the raw pointer is NOT + * deleted. + * The SmartPtr implements the comparison operators == & != + * for a variety of types. Use these instead of + * \verbatim + * if (GetRawPtr(smrt_ptr) == ptr) // Don't use this + * \endverbatim + * SmartPtr's, as currently implemented, do NOT handle circular references. + * For example: consider a higher level object using SmartPtrs to point to + * A and B, but A and B also point to each other (i.e. A has a SmartPtr + * to B and B has a SmartPtr to A). In this scenario, when the higher + * level object is finished with A and B, their reference counts will + * never drop to zero (since they reference each other) and they + * will not be deleted. This can be detected by memory leak tools like + * valgrind. If the circular reference is necessary, the problem can be + * overcome by a number of techniques: + * + * 1) A and B can have a method that "releases" each other, that is + * they set their internal SmartPtrs to NULL. + * \verbatim + * void AClass::ReleaseCircularReferences() + * { + * smart_ptr_to_B = NULL; + * } + * \endverbatim + * Then, the higher level class can call these methods before + * it is done using A & B. + * + * 2) Raw pointers can be used in A and B to reference each other. + * Here, an implicit assumption is made that the lifetime is + * controlled by the higher level object and that A and B will + * both exist in a controlled manner. Although this seems + * dangerous, in many situations, this type of referencing + * is very controlled and this is reasonably safe. + * + * 3) This SmartPtr class could be redesigned with the Weak/Strong + * design concept. Here, the SmartPtr is identified as being + * Strong (controls lifetime of the object) or Weak (merely + * referencing the object). The Strong SmartPtr increments + * (and decrements) the reference count in ReferencedObject + * but the Weak SmartPtr does not. In the example above, + * the higher level object would have Strong SmartPtrs to + * A and B, but A and B would have Weak SmartPtrs to each + * other. Then, when the higher level object was done with + * A and B, they would be deleted. The Weak SmartPtrs in A + * and B would not decrement the reference count and would, + * of course, not delete the object. This idea is very similar + * to item (2), where it is implied that the sequence of events + * is controlled such that A and B will not call anything using + * their pointers following the higher level delete (i.e. in + * their destructors!). This is somehow safer, however, because + * code can be written (however expensive) to perform run-time + * detection of this situation. For example, the ReferencedObject + * could store pointers to all Weak SmartPtrs that are referencing + * it and, in its destructor, tell these pointers that it is + * dying. They could then set themselves to NULL, or set an + * internal flag to detect usage past this point. + * + * Comments on Non-Intrusive Design: + * In a non-intrusive design, the reference count is stored somewhere other + * than the object being referenced. This means, unless the reference + * counting pointer is the first referencer, it must get a pointer to the + * referenced object from another smart pointer (so it has access to the + * reference count location). In this non-intrusive design, if we are + * pointing to an object with a smart pointer (or a number of smart + * pointers), and we then give another smart pointer the address through + * a RAW pointer, we will have two independent, AND INCORRECT, reference + * counts. To avoid this pitfall, we use an intrusive reference counting + * technique where the reference count is stored in the object being + * referenced. + */ + template + class SmartPtr : public Referencer + { + public: +#define ipopt_dbg_smartptr_verbosity 0 + + /**@name Constructors/Destructors */ + //@{ + /** Default constructor, initialized to NULL */ + SmartPtr(); + + /** Copy constructor, initialized from copy of type T */ + SmartPtr(const SmartPtr& copy); + + /** Copy constructor, initialized from copy of type U */ + template + SmartPtr(const SmartPtr& copy); + + /** Constructor, initialized from T* ptr */ + SmartPtr(T* ptr); + + /** Destructor, automatically decrements the + * reference count, deletes the object if + * necessary.*/ + ~SmartPtr(); + //@} + + /**@name Overloaded operators. */ + //@{ + /** Overloaded arrow operator, allows the user to call + * methods using the contained pointer. */ + T* operator->() const; + + /** Overloaded dereference operator, allows the user + * to dereference the contained pointer. */ + T& operator*() const; + + /** Overloaded equals operator, allows the user to + * set the value of the SmartPtr from a raw pointer */ + SmartPtr& operator=(T* rhs); + + /** Overloaded equals operator, allows the user to + * set the value of the SmartPtr from another + * SmartPtr */ + SmartPtr& operator=(const SmartPtr& rhs); + + /** Overloaded equals operator, allows the user to + * set the value of the SmartPtr from another + * SmartPtr of a different type */ + template + SmartPtr& operator=(const SmartPtr& rhs); + + /** Overloaded equality comparison operator, allows the + * user to compare the value of two SmartPtrs */ + template + friend + bool operator==(const SmartPtr& lhs, const SmartPtr& rhs); + + /** Overloaded equality comparison operator, allows the + * user to compare the value of a SmartPtr with a raw pointer. */ + template + friend + bool operator==(const SmartPtr& lhs, U2* raw_rhs); + + /** Overloaded equality comparison operator, allows the + * user to compare the value of a raw pointer with a SmartPtr. */ + template + friend + bool operator==(U1* lhs, const SmartPtr& raw_rhs); + + /** Overloaded in-equality comparison operator, allows the + * user to compare the value of two SmartPtrs */ + template + friend + bool operator!=(const SmartPtr& lhs, const SmartPtr& rhs); + + /** Overloaded in-equality comparison operator, allows the + * user to compare the value of a SmartPtr with a raw pointer. */ + template + friend + bool operator!=(const SmartPtr& lhs, U2* raw_rhs); + + /** Overloaded in-equality comparison operator, allows the + * user to compare the value of a SmartPtr with a raw pointer. */ + template + friend + bool operator!=(U1* lhs, const SmartPtr& raw_rhs); + + /** Overloaded less-than comparison operator, allows the + * user to compare the value of two SmartPtrs */ + template + friend + bool operator<(const SmartPtr& lhs, const SmartPtr& rhs); + //@} + + /**@name friend method declarations. */ + //@{ + /** Returns the raw pointer contained. + * Use to get the value of + * the raw ptr (i.e. to pass to other + * methods/functions, etc.) + * Note: This method does NOT copy, + * therefore, modifications using this + * value modify the underlying object + * contained by the SmartPtr, + * NEVER delete this returned value. + */ + template + friend + U* GetRawPtr(const SmartPtr& smart_ptr); + + /** Returns a const pointer */ + template + friend + SmartPtr ConstPtr(const SmartPtr& smart_ptr); + + /** Returns true if the SmartPtr is NOT NULL. + * Use this to check if the SmartPtr is not null + * This is preferred to if(GetRawPtr(sp) != NULL) + */ + template + friend + bool IsValid(const SmartPtr& smart_ptr); + + /** Returns true if the SmartPtr is NULL. + * Use this to check if the SmartPtr IsNull. + * This is preferred to if(GetRawPtr(sp) == NULL) + */ + template + friend + bool IsNull(const SmartPtr& smart_ptr); + //@} + + private: + /**@name Private Data/Methods */ + //@{ + /** Actual raw pointer to the object. */ + T* ptr_; + + /** Set the value of the internal raw pointer + * from another raw pointer, releasing the + * previously referenced object if necessary. */ + SmartPtr& SetFromRawPtr_(T* rhs); + + /** Set the value of the internal raw pointer + * from a SmartPtr, releasing the previously referenced + * object if necessary. */ + SmartPtr& SetFromSmartPtr_(const SmartPtr& rhs); + + /** Release the currently referenced object. */ + void ReleasePointer_(); + //@} + }; + + /**@name SmartPtr friend function declarations.*/ + //@{ + template + U* GetRawPtr(const SmartPtr& smart_ptr); + + template + SmartPtr ConstPtr(const SmartPtr& smart_ptr); + + template + bool IsNull(const SmartPtr& smart_ptr); + + template + bool IsValid(const SmartPtr& smart_ptr); + + template + bool operator==(const SmartPtr& lhs, const SmartPtr& rhs); + + template + bool operator==(const SmartPtr& lhs, U2* raw_rhs); + + template + bool operator==(U1* lhs, const SmartPtr& raw_rhs); + + template + bool operator!=(const SmartPtr& lhs, const SmartPtr& rhs); + + template + bool operator!=(const SmartPtr& lhs, U2* raw_rhs); + + template + bool operator!=(U1* lhs, const SmartPtr& raw_rhs); + + //@} + + + template + SmartPtr::SmartPtr() + : + ptr_(0) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_METH("SmartPtr::SmartPtr()", ipopt_dbg_smartptr_verbosity); +#endif + +#ifndef NDEBUG + const ReferencedObject* IPOPT_UNUSED trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = ptr_; +#endif + + } + + + template + SmartPtr::SmartPtr(const SmartPtr& copy) + : + ptr_(0) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_METH("SmartPtr::SmartPtr(const SmartPtr& copy)", ipopt_dbg_smartptr_verbosity); +#endif + +#ifndef NDEBUG + const ReferencedObject* IPOPT_UNUSED trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = ptr_; +#endif + + (void) SetFromSmartPtr_(copy); + } + + + template + template + SmartPtr::SmartPtr(const SmartPtr& copy) + : + ptr_(0) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_METH("SmartPtr::SmartPtr(const SmartPtr& copy)", ipopt_dbg_smartptr_verbosity); +#endif + +#ifndef NDEBUG + const ReferencedObject* IPOPT_UNUSED trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = ptr_; +#endif + + (void) SetFromSmartPtr_(GetRawPtr(copy)); + } + + + template + SmartPtr::SmartPtr(T* ptr) + : + ptr_(0) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_METH("SmartPtr::SmartPtr(T* ptr)", ipopt_dbg_smartptr_verbosity); +#endif + +#ifndef NDEBUG + const ReferencedObject* IPOPT_UNUSED trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = ptr_; +#endif + + (void) SetFromRawPtr_(ptr); + } + + template + SmartPtr::~SmartPtr() + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_METH("SmartPtr::~SmartPtr(T* ptr)", ipopt_dbg_smartptr_verbosity); +#endif + + ReleasePointer_(); + } + + + template + T* SmartPtr::operator->() const + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_METH("T* SmartPtr::operator->()", ipopt_dbg_smartptr_verbosity); +#endif + + // cannot deref a null pointer +#if COIN_IPOPT_CHECKLEVEL > 0 + assert(ptr_); +#endif + + return ptr_; + } + + + template + T& SmartPtr::operator*() const + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_METH("T& SmartPtr::operator*()", ipopt_dbg_smartptr_verbosity); +#endif + + // cannot dereference a null pointer +#if COIN_IPOPT_CHECKLEVEL > 0 + assert(ptr_); +#endif + + return *ptr_; + } + + + template + SmartPtr& SmartPtr::operator=(T* rhs) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_METH("SmartPtr& SmartPtr::operator=(T* rhs)", ipopt_dbg_smartptr_verbosity); +#endif + + return SetFromRawPtr_(rhs); + } + + + template + SmartPtr& SmartPtr::operator=(const SmartPtr& rhs) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_METH( + "SmartPtr& SmartPtr::operator=(const SmartPtr& rhs)", + ipopt_dbg_smartptr_verbosity); +#endif + + return SetFromSmartPtr_(rhs); + } + + + template + template + SmartPtr& SmartPtr::operator=(const SmartPtr& rhs) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_METH( + "SmartPtr& SmartPtr::operator=(const SmartPtr& rhs)", + ipopt_dbg_smartptr_verbosity); +#endif + + return SetFromSmartPtr_(GetRawPtr(rhs)); + } + + + template + SmartPtr& SmartPtr::SetFromRawPtr_(T* rhs) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_METH( + "SmartPtr& SmartPtr::SetFromRawPtr_(T* rhs)", ipopt_dbg_smartptr_verbosity); +#endif + + if (rhs != 0) + rhs->AddRef(this); + + // Release any old pointer + ReleasePointer_(); + + ptr_ = rhs; + + return *this; + } + + template + SmartPtr& SmartPtr::SetFromSmartPtr_(const SmartPtr& rhs) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_METH( + "SmartPtr& SmartPtr::SetFromSmartPtr_(const SmartPtr& rhs)", + ipopt_dbg_smartptr_verbosity); +#endif + + SetFromRawPtr_(GetRawPtr(rhs)); + + return (*this); + } + + + template + void SmartPtr::ReleasePointer_() + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_METH( + "void SmartPtr::ReleasePointer()", + ipopt_dbg_smartptr_verbosity); +#endif + + if (ptr_) { + ptr_->ReleaseRef(this); + if (ptr_->ReferenceCount() == 0) + delete ptr_; + } + } + + + template + U* GetRawPtr(const SmartPtr& smart_ptr) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_FUN( + "T* GetRawPtr(const SmartPtr& smart_ptr)", + 0); +#endif + + return smart_ptr.ptr_; + } + + template + SmartPtr ConstPtr(const SmartPtr& smart_ptr) + { + // compiler should implicitly cast + return GetRawPtr(smart_ptr); + } + + template + bool IsValid(const SmartPtr& smart_ptr) + { + return !IsNull(smart_ptr); + } + + template + bool IsNull(const SmartPtr& smart_ptr) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_FUN( + "bool IsNull(const SmartPtr& smart_ptr)", + 0); +#endif + + return (smart_ptr.ptr_ == 0); + } + + + template + bool ComparePointers(const U1* lhs, const U2* rhs) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_FUN( + "bool ComparePtrs(const U1* lhs, const U2* rhs)", + ipopt_dbg_smartptr_verbosity); +#endif + + // Even if lhs and rhs point to the same object + // with different interfaces U1 and U2, we cannot guarantee that + // the value of the pointers will be equivalent. We can + // guarantee this if we convert to ReferencedObject* (see also #162) + const ReferencedObject* v_lhs = lhs; + const ReferencedObject* v_rhs = rhs; + + return v_lhs == v_rhs; + } + + template + bool operator==(const SmartPtr& lhs, const SmartPtr& rhs) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_FUN( + "bool operator==(const SmartPtr& lhs, const SmartPtr& rhs)", + ipopt_dbg_smartptr_verbosity); +#endif + + U1* raw_lhs = GetRawPtr(lhs); + U2* raw_rhs = GetRawPtr(rhs); + return ComparePointers(raw_lhs, raw_rhs); + } + + template + bool operator==(const SmartPtr& lhs, U2* raw_rhs) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_FUN( + "bool operator==(SmartPtr& lhs, U2* rhs)", + ipopt_dbg_smartptr_verbosity); +#endif + + U1* raw_lhs = GetRawPtr(lhs); + return ComparePointers(raw_lhs, raw_rhs); + } + + template + bool operator==(U1* raw_lhs, const SmartPtr& rhs) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_FUN( + "bool operator==(U1* raw_lhs, SmartPtr& rhs)", + ipopt_dbg_smartptr_verbosity); +#endif + + const U2* raw_rhs = GetRawPtr(rhs); + return ComparePointers(raw_lhs, raw_rhs); + } + + template + bool operator!=(const SmartPtr& lhs, const SmartPtr& rhs) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_FUN( + "bool operator!=(const SmartPtr& lhs, const SmartPtr& rhs)", + ipopt_dbg_smartptr_verbosity); +#endif + + bool retValue = operator==(lhs, rhs); + return !retValue; + } + + template + bool operator!=(const SmartPtr& lhs, U2* raw_rhs) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_FUN( + "bool operator!=(SmartPtr& lhs, U2* rhs)", + ipopt_dbg_smartptr_verbosity); +#endif + + bool retValue = operator==(lhs, raw_rhs); + return !retValue; + } + + template + bool operator!=(U1* raw_lhs, const SmartPtr& rhs) + { +#ifdef IP_DEBUG_SMARTPTR + DBG_START_FUN( + "bool operator!=(U1* raw_lhs, SmartPtr& rhs)", + ipopt_dbg_smartptr_verbosity); +#endif + + bool retValue = operator==(raw_lhs, rhs); + return !retValue; + } + + template + void swap(SmartPtr& a, SmartPtr& b) + { +#ifdef IP_DEBUG_REFERENCED + SmartPtr tmp(a); + a = b; + b = tmp; +#else + std::swap(a.prt_, b.ptr_); +#endif + } + + template + bool operator<(const SmartPtr& lhs, const SmartPtr& rhs) + { + return lhs.ptr_ < rhs.ptr_; + } + + template + bool operator> (const SmartPtr& lhs, const SmartPtr& rhs) + { + return rhs < lhs; + } + + template bool + operator<=(const SmartPtr& lhs, const SmartPtr& rhs) + { + return !( rhs < lhs ); + } + + template bool + operator>=(const SmartPtr& lhs, const SmartPtr& rhs) + { + return !( lhs < rhs ); + } +} // namespace Ipopt + +#undef ipopt_dbg_smartptr_verbosity + +#endif diff --git a/thirdparty/windows/include/coin/IpSolveStatistics.hpp b/thirdparty/windows/include/coin/IpSolveStatistics.hpp index e248939..f4fa774 100644 --- a/thirdparty/windows/include/coin/IpSolveStatistics.hpp +++ b/thirdparty/windows/include/coin/IpSolveStatistics.hpp @@ -1,136 +1,150 @@ -// Copyright (C) 2005, 2006 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpSolveStatistics.hpp 1587 2009-10-27 16:09:21Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2005-08-15 - -#ifndef __IPSOLVESTATISTICS_HPP__ -#define __IPSOLVESTATISTICS_HPP__ - -#include "IpReferenced.hpp" -#include "IpSmartPtr.hpp" - -namespace Ipopt -{ - // forward declaration (to avoid inclusion of too many header files) - class IpoptNLP; - class IpoptData; - class IpoptCalculatedQuantities; - - /** This class collects statistics about an optimziation run, such - * as iteration count, final infeasibilities etc. It is meant to - * provide such information to a user of Ipopt during the - * finalize_solution call. - */ - class SolveStatistics : public ReferencedObject - { - public: - /**@name Constructors/Destructors */ - //@{ - /** Default constructor. It takes in those collecting Ipopt - * objects that can provide the statistics information. Those - * statistics are retrieved at the time of the constructor - * call. */ - SolveStatistics(const SmartPtr& ip_nlp, - const SmartPtr& ip_data, - const SmartPtr& ip_cq); - - /** Default destructor */ - virtual ~SolveStatistics() - {} - //@} - - /** @name Accessor methods for retrieving different kind of solver - * statistics information */ - //@{ - /** Iteration counts. */ - virtual Index IterationCount() const; - /** Total CPU time, including function evaluations. */ - virtual Number TotalCPUTime() const; - /** Number of NLP function evaluations. */ - virtual void NumberOfEvaluations(Index& num_obj_evals, - Index& num_constr_evals, - Index& num_obj_grad_evals, - Index& num_constr_jac_evals, - Index& num_hess_evals) const; - /** Unscaled solution infeasibilities */ - virtual void Infeasibilities(Number& dual_inf, - Number& constr_viol, - Number& complementarity, - Number& kkt_error) const; - /** Scaled solution infeasibilities */ - virtual void ScaledInfeasibilities(Number& scaled_dual_inf, - Number& scaled_constr_viol, - Number& scaled_complementarity, - Number& scaled_kkt_error) const; - /** Final value of objective function */ - virtual Number FinalObjective() const; - /** Final scaled value of objective function */ - virtual Number FinalScaledObjective() const; - //@} - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - SolveStatistics(); - - /** Copy Constructor */ - SolveStatistics(const SolveStatistics&); - - /** Overloaded Equals Operator */ - void operator=(const SolveStatistics&); - //@} - - /** @name Fields for storing the statistics data */ - //@{ - /** Number of iterations. */ - Index num_iters_; - /* Total CPU time */ - Number total_cpu_time_; - /** Number of objective function evaluations. */ - Index num_obj_evals_; - /** Number of constraints evaluations (max of equality and - * inequality) */ - Index num_constr_evals_; - /** Number of objective gradient evaluations. */ - Index num_obj_grad_evals_; - /** Number of constraint Jacobian evaluations. */ - Index num_constr_jac_evals_; - /** Number of Lagrangian Hessian evaluations. */ - Index num_hess_evals_; - - /** Final scaled value of objective function */ - Number scaled_obj_val_; - /** Final unscaled value of objective function */ - Number obj_val_; - /** Final scaled dual infeasibility (max-norm) */ - Number scaled_dual_inf_; - /** Final unscaled dual infeasibility (max-norm) */ - Number dual_inf_; - /** Final scaled constraint violation (max-norm) */ - Number scaled_constr_viol_; - /** Final unscaled constraint violation (max-norm) */ - Number constr_viol_; - /** Final scaled complementarity error (max-norm) */ - Number scaled_compl_; - /** Final unscaled complementarity error (max-norm) */ - Number compl_; - /** Final overall scaled KKT error (max-norm) */ - Number scaled_kkt_error_; - /** Final overall unscaled KKT error (max-norm) */ - Number kkt_error_; - //@} - }; - -} // namespace Ipopt - -#endif +// Copyright (C) 2005, 2009 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpSolveStatistics.hpp 1861 2010-12-21 21:34:47Z andreasw $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2005-08-15 + +#ifndef __IPSOLVESTATISTICS_HPP__ +#define __IPSOLVESTATISTICS_HPP__ + +#include "IpReferenced.hpp" +#include "IpSmartPtr.hpp" + +namespace Ipopt +{ + // forward declaration (to avoid inclusion of too many header files) + class IpoptNLP; + class IpoptData; + class IpoptCalculatedQuantities; + + /** This class collects statistics about an optimziation run, such + * as iteration count, final infeasibilities etc. It is meant to + * provide such information to a user of Ipopt during the + * finalize_solution call. + */ + class SolveStatistics : public ReferencedObject + { + public: + /**@name Constructors/Destructors */ + //@{ + /** Default constructor. It takes in those collecting Ipopt + * objects that can provide the statistics information. Those + * statistics are retrieved at the time of the constructor + * call. */ + SolveStatistics(const SmartPtr& ip_nlp, + const SmartPtr& ip_data, + const SmartPtr& ip_cq); + + /** Default destructor */ + virtual ~SolveStatistics() + {} + //@} + + /** @name Accessor methods for retrieving different kind of solver + * statistics information */ + //@{ + /** Iteration counts. */ + virtual Index IterationCount() const; + /** Total CPU time, including function evaluations. */ + virtual Number TotalCpuTime() const; + /** Total CPU time, including function evaluations. Included for + * backward compatibility. */ + Number TotalCPUTime() const + { + return TotalCpuTime(); + } + /** Total System time, including function evaluations. */ + virtual Number TotalSysTime() const; + /** Total wall clock time, including function evaluations. */ + virtual Number TotalWallclockTime() const; + /** Number of NLP function evaluations. */ + virtual void NumberOfEvaluations(Index& num_obj_evals, + Index& num_constr_evals, + Index& num_obj_grad_evals, + Index& num_constr_jac_evals, + Index& num_hess_evals) const; + /** Unscaled solution infeasibilities */ + virtual void Infeasibilities(Number& dual_inf, + Number& constr_viol, + Number& complementarity, + Number& kkt_error) const; + /** Scaled solution infeasibilities */ + virtual void ScaledInfeasibilities(Number& scaled_dual_inf, + Number& scaled_constr_viol, + Number& scaled_complementarity, + Number& scaled_kkt_error) const; + /** Final value of objective function */ + virtual Number FinalObjective() const; + /** Final scaled value of objective function */ + virtual Number FinalScaledObjective() const; + //@} + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + SolveStatistics(); + + /** Copy Constructor */ + SolveStatistics(const SolveStatistics&); + + /** Overloaded Equals Operator */ + void operator=(const SolveStatistics&); + //@} + + /** @name Fields for storing the statistics data */ + //@{ + /** Number of iterations. */ + Index num_iters_; + /* Total CPU time */ + Number total_cpu_time_; + /* Total system time */ + Number total_sys_time_; + /* Total wall clock time */ + Number total_wallclock_time_; + /** Number of objective function evaluations. */ + Index num_obj_evals_; + /** Number of constraints evaluations (max of equality and + * inequality) */ + Index num_constr_evals_; + /** Number of objective gradient evaluations. */ + Index num_obj_grad_evals_; + /** Number of constraint Jacobian evaluations. */ + Index num_constr_jac_evals_; + /** Number of Lagrangian Hessian evaluations. */ + Index num_hess_evals_; + + /** Final scaled value of objective function */ + Number scaled_obj_val_; + /** Final unscaled value of objective function */ + Number obj_val_; + /** Final scaled dual infeasibility (max-norm) */ + Number scaled_dual_inf_; + /** Final unscaled dual infeasibility (max-norm) */ + Number dual_inf_; + /** Final scaled constraint violation (max-norm) */ + Number scaled_constr_viol_; + /** Final unscaled constraint violation (max-norm) */ + Number constr_viol_; + /** Final scaled complementarity error (max-norm) */ + Number scaled_compl_; + /** Final unscaled complementarity error (max-norm) */ + Number compl_; + /** Final overall scaled KKT error (max-norm) */ + Number scaled_kkt_error_; + /** Final overall unscaled KKT error (max-norm) */ + Number kkt_error_; + //@} + }; + +} // namespace Ipopt + +#endif diff --git a/thirdparty/windows/include/coin/IpStdCInterface.h b/thirdparty/windows/include/coin/IpStdCInterface.h index 151a8f5..ef96ca4 100644 --- a/thirdparty/windows/include/coin/IpStdCInterface.h +++ b/thirdparty/windows/include/coin/IpStdCInterface.h @@ -1,235 +1,271 @@ -/************************************************************************* - Copyright (C) 2004, 2006 International Business Machines and others. - All Rights Reserved. - This code is published under the Common Public License. - - $Id: IpStdCInterface.h 1586 2009-10-27 15:55:03Z andreasw $ - - Authors: Carl Laird, Andreas Waechter IBM 2004-09-02 - *************************************************************************/ - -#ifndef __IPSTDCINTERFACE_H__ -#define __IPSTDCINTERFACE_H__ - -#ifndef IPOPT_EXPORT -#ifdef _MSC_VER -#ifdef IPOPT_DLL -#define IPOPT_EXPORT(type) __declspec(dllexport) type __cdecl -#else -#define IPOPT_EXPORT(type) type __cdecl -#endif -#else -#define IPOPT_EXPORT(type) type -#endif -#endif - -#ifdef __cplusplus -extern "C" -{ -#endif - - /** Type for all number. We need to make sure that this is - identical with what is defined in Common/IpTypes.hpp */ - typedef double Number; - - /** Type for all incides. We need to make sure that this is - identical with what is defined in Common/IpTypes.hpp */ - typedef int Index; - - /** Type for all integers. We need to make sure that this is - identical with what is defined in Common/IpTypes.hpp */ - typedef int Int; - - /* This includes the SolverReturn enum type */ -#include "IpReturnCodes.h" - - /** Structure collecting all information about the problem - * definition and solve statistics etc. This is defined in the - * source file. */ - struct IpoptProblemInfo; - - /** Pointer to a Ipopt Problem. */ - typedef struct IpoptProblemInfo* IpoptProblem; - - /** define a boolean type for C */ - typedef int Bool; -#ifndef TRUE -# define TRUE (1) -#endif -#ifndef FALSE -# define FALSE (0) -#endif - - /** A pointer for anything that is to be passed between the called - * and individual callback function */ - typedef void * UserDataPtr; - - /** Type defining the callback function for evaluating the value of - * the objective function. Return value should be set to false if - * there was a problem doing the evaluation. */ - typedef Bool (*Eval_F_CB)(Index n, Number* x, Bool new_x, - Number* obj_value, UserDataPtr user_data); - - /** Type defining the callback function for evaluating the gradient of - * the objective function. Return value should be set to false if - * there was a problem doing the evaluation. */ - typedef Bool (*Eval_Grad_F_CB)(Index n, Number* x, Bool new_x, - Number* grad_f, UserDataPtr user_data); - - /** Type defining the callback function for evaluating the value of - * the constraint functions. Return value should be set to false if - * there was a problem doing the evaluation. */ - typedef Bool (*Eval_G_CB)(Index n, Number* x, Bool new_x, - Index m, Number* g, UserDataPtr user_data); - - /** Type defining the callback function for evaluating the Jacobian of - * the constrant functions. Return value should be set to false if - * there was a problem doing the evaluation. */ - typedef Bool (*Eval_Jac_G_CB)(Index n, Number *x, Bool new_x, - Index m, Index nele_jac, - Index *iRow, Index *jCol, Number *values, - UserDataPtr user_data); - - /** Type defining the callback function for evaluating the Hessian of - * the Lagrangian function. Return value should be set to false if - * there was a problem doing the evaluation. */ - typedef Bool (*Eval_H_CB)(Index n, Number *x, Bool new_x, Number obj_factor, - Index m, Number *lambda, Bool new_lambda, - Index nele_hess, Index *iRow, Index *jCol, - Number *values, UserDataPtr user_data); - - /** Function for creating a new Ipopt Problem object. This function - * returns an object that can be passed to the IpoptSolve call. It - * contains the basic definition of the optimization problem, such - * as number of variables and constraints, bounds on variables and - * constraints, information about the derivatives, and the callback - * function for the computation of the optimization problem - * functions and derivatives. During this call, the options file - * PARAMS.DAT is read as well. - * - * If NULL is returned, there was a problem with one of the inputs - * or reading the options file. */ - IPOPT_EXPORT(IpoptProblem) CreateIpoptProblem( - Index n /** Number of optimization variables */ - , Number* x_L /** Lower bounds on variables. This array of - size n is copied internally, so that the - caller can change the incoming data after - return without that IpoptProblem is - modified. Any value less or equal than - the number specified by option - 'nlp_lower_bound_inf' is interpreted to - be minus infinity. */ - , Number* x_U /** Upper bounds on variables. This array of - size n is copied internally, so that the - caller can change the incoming data after - return without that IpoptProblem is - modified. Any value greater or equal - than the number specified by option - 'nlp_upper_bound_inf' is interpreted to - be plus infinity. */ - , Index m /** Number of constraints. */ - , Number* g_L /** Lower bounds on constraints. This array of - size m is copied internally, so that the - caller can change the incoming data after - return without that IpoptProblem is - modified. Any value less or equal than - the number specified by option - 'nlp_lower_bound_inf' is interpreted to - be minus infinity. */ - , Number* g_U /** Upper bounds on constraints. This array of - size m is copied internally, so that the - caller can change the incoming data after - return without that IpoptProblem is - modified. Any value greater or equal - than the number specified by option - 'nlp_upper_bound_inf' is interpreted to - be plus infinity. */ - , Index nele_jac /** Number of non-zero elements in constraint - Jacobian. */ - , Index nele_hess /** Number of non-zero elements in Hessian of - Lagrangian. */ - , Index index_style /** indexing style for iRow & jCol, - 0 for C style, 1 for Fortran style */ - , Eval_F_CB eval_f /** Callback function for evaluating - objective function */ - , Eval_G_CB eval_g /** Callback function for evaluating - constraint functions */ - , Eval_Grad_F_CB eval_grad_f - /** Callback function for evaluating gradient - of objective function */ - , Eval_Jac_G_CB eval_jac_g - /** Callback function for evaluating Jacobian - of constraint functions */ - , Eval_H_CB eval_h /** Callback function for evaluating Hessian - of Lagrangian function */ - ); - - /** Method for freeing a previously created IpoptProblem. After - freeing an IpoptProblem, it cannot be used anymore. */ - IPOPT_EXPORT(void) FreeIpoptProblem(IpoptProblem ipopt_problem); - - - /** Function for adding a string option. Returns FALSE the option - * could not be set (e.g., if keyword is unknown) */ - IPOPT_EXPORT(Bool) AddIpoptStrOption(IpoptProblem ipopt_problem, char* keyword, char* val); - - /** Function for adding a Number option. Returns FALSE the option - * could not be set (e.g., if keyword is unknown) */ - IPOPT_EXPORT(Bool) AddIpoptNumOption(IpoptProblem ipopt_problem, char* keyword, Number val); - - /** Function for adding an Int option. Returns FALSE the option - * could not be set (e.g., if keyword is unknown) */ - IPOPT_EXPORT(Bool) AddIpoptIntOption(IpoptProblem ipopt_problem, char* keyword, Int val); - - /** Function for opening an output file for a given name with given - * printlevel. Returns false, if there was a problem opening the - * file. */ - IPOPT_EXPORT(Bool) OpenIpoptOutputFile(IpoptProblem ipopt_problem, char* file_name, - Int print_level); - - /** Optional function for setting scaling parameter for the NLP. - * This corresponds to the get_scaling_parameters method in TNLP. - * If the pointers x_scaling or g_scaling are NULL, then no scaling - * for x resp. g is done. */ - IPOPT_EXPORT(Bool) SetIpoptProblemScaling(IpoptProblem ipopt_problem, - Number obj_scaling, - Number* x_scaling, - Number* g_scaling); - - /** Function calling the Ipopt optimization algorithm for a problem - previously defined with CreateIpoptProblem. The return - specified outcome of the optimization procedure (e.g., success, - failure etc). - */ - IPOPT_EXPORT(enum ApplicationReturnStatus) IpoptSolve( - IpoptProblem ipopt_problem - /** Problem that is to be optimized. Ipopt - will use the options previously specified with - AddIpoptOption (etc) for this problem. */ - , Number* x /** Input: Starting point - Output: Optimal solution */ - , Number* g /** Values of constraint at final point - (output only - ignored if set to NULL) */ - , Number* obj_val /** Final value of objective function - (output only - ignored if set to NULL) */ - , Number* mult_g /** Final multipliers for constraints - (output only - ignored if set to NULL) */ - , Number* mult_x_L /** Final multipliers for lower variable bounds - (output only - ignored if set to NULL) */ - , Number* mult_x_U /** Final multipliers for upper variable bounds - (output only - ignored if set to NULL) */ - , UserDataPtr user_data - /** Pointer to user data. This will be - passed unmodified to the callback - functions. */ - ); - - /** - void IpoptStatisticsCounts; - - void IpoptStatisticsInfeasibilities; */ -#ifdef __cplusplus -} /* extern "C" { */ -#endif - -#endif +/************************************************************************* + Copyright (C) 2004, 2010 International Business Machines and others. + All Rights Reserved. + This code is published under the Eclipse Public License. + + $Id: IpStdCInterface.h 2082 2012-02-16 03:00:34Z andreasw $ + + Authors: Carl Laird, Andreas Waechter IBM 2004-09-02 + *************************************************************************/ + +#ifndef __IPSTDCINTERFACE_H__ +#define __IPSTDCINTERFACE_H__ + +#ifndef IPOPT_EXPORT +#ifdef _MSC_VER +#ifdef IPOPT_DLL +#define IPOPT_EXPORT(type) __declspec(dllexport) type __cdecl +#else +#define IPOPT_EXPORT(type) type __cdecl +#endif +#else +#define IPOPT_EXPORT(type) type +#endif +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** Type for all number. We need to make sure that this is + identical with what is defined in Common/IpTypes.hpp */ + typedef double Number; + + /** Type for all incides. We need to make sure that this is + identical with what is defined in Common/IpTypes.hpp */ + typedef int Index; + + /** Type for all integers. We need to make sure that this is + identical with what is defined in Common/IpTypes.hpp */ + typedef int Int; + + /* This includes the SolverReturn enum type */ +#include "IpReturnCodes.h" + + /** Structure collecting all information about the problem + * definition and solve statistics etc. This is defined in the + * source file. */ + struct IpoptProblemInfo; + + /** Pointer to a Ipopt Problem. */ + typedef struct IpoptProblemInfo* IpoptProblem; + + /** define a boolean type for C */ + typedef int Bool; +#ifndef TRUE +# define TRUE (1) +#endif +#ifndef FALSE +# define FALSE (0) +#endif + + /** A pointer for anything that is to be passed between the called + * and individual callback function */ + typedef void * UserDataPtr; + + /** Type defining the callback function for evaluating the value of + * the objective function. Return value should be set to false if + * there was a problem doing the evaluation. */ + typedef Bool (*Eval_F_CB)(Index n, Number* x, Bool new_x, + Number* obj_value, UserDataPtr user_data); + + /** Type defining the callback function for evaluating the gradient of + * the objective function. Return value should be set to false if + * there was a problem doing the evaluation. */ + typedef Bool (*Eval_Grad_F_CB)(Index n, Number* x, Bool new_x, + Number* grad_f, UserDataPtr user_data); + + /** Type defining the callback function for evaluating the value of + * the constraint functions. Return value should be set to false if + * there was a problem doing the evaluation. */ + typedef Bool (*Eval_G_CB)(Index n, Number* x, Bool new_x, + Index m, Number* g, UserDataPtr user_data); + + /** Type defining the callback function for evaluating the Jacobian of + * the constrant functions. Return value should be set to false if + * there was a problem doing the evaluation. */ + typedef Bool (*Eval_Jac_G_CB)(Index n, Number *x, Bool new_x, + Index m, Index nele_jac, + Index *iRow, Index *jCol, Number *values, + UserDataPtr user_data); + + /** Type defining the callback function for evaluating the Hessian of + * the Lagrangian function. Return value should be set to false if + * there was a problem doing the evaluation. */ + typedef Bool (*Eval_H_CB)(Index n, Number *x, Bool new_x, Number obj_factor, + Index m, Number *lambda, Bool new_lambda, + Index nele_hess, Index *iRow, Index *jCol, + Number *values, UserDataPtr user_data); + + /** Type defining the callback function for giving intermediate + * execution control to the user. If set, it is called once per + * iteration, providing the user with some information on the state + * of the optimization. This can be used to print some + * user-defined output. It also gives the user a way to terminate + * the optimization prematurely. If this method returns false, + * Ipopt will terminate the optimization. */ + typedef Bool (*Intermediate_CB)(Index alg_mod, /* 0 is regular, 1 is resto */ + Index iter_count, Number obj_value, + Number inf_pr, Number inf_du, + Number mu, Number d_norm, + Number regularization_size, + Number alpha_du, Number alpha_pr, + Index ls_trials, UserDataPtr user_data); + + /** Function for creating a new Ipopt Problem object. This function + * returns an object that can be passed to the IpoptSolve call. It + * contains the basic definition of the optimization problem, such + * as number of variables and constraints, bounds on variables and + * constraints, information about the derivatives, and the callback + * function for the computation of the optimization problem + * functions and derivatives. During this call, the options file + * PARAMS.DAT is read as well. + * + * If NULL is returned, there was a problem with one of the inputs + * or reading the options file. */ + IPOPT_EXPORT(IpoptProblem) CreateIpoptProblem( + Index n /** Number of optimization variables */ + , Number* x_L /** Lower bounds on variables. This array of + size n is copied internally, so that the + caller can change the incoming data after + return without that IpoptProblem is + modified. Any value less or equal than + the number specified by option + 'nlp_lower_bound_inf' is interpreted to + be minus infinity. */ + , Number* x_U /** Upper bounds on variables. This array of + size n is copied internally, so that the + caller can change the incoming data after + return without that IpoptProblem is + modified. Any value greater or equal + than the number specified by option + 'nlp_upper_bound_inf' is interpreted to + be plus infinity. */ + , Index m /** Number of constraints. */ + , Number* g_L /** Lower bounds on constraints. This array of + size m is copied internally, so that the + caller can change the incoming data after + return without that IpoptProblem is + modified. Any value less or equal than + the number specified by option + 'nlp_lower_bound_inf' is interpreted to + be minus infinity. */ + , Number* g_U /** Upper bounds on constraints. This array of + size m is copied internally, so that the + caller can change the incoming data after + return without that IpoptProblem is + modified. Any value greater or equal + than the number specified by option + 'nlp_upper_bound_inf' is interpreted to + be plus infinity. */ + , Index nele_jac /** Number of non-zero elements in constraint + Jacobian. */ + , Index nele_hess /** Number of non-zero elements in Hessian of + Lagrangian. */ + , Index index_style /** indexing style for iRow & jCol, + 0 for C style, 1 for Fortran style */ + , Eval_F_CB eval_f /** Callback function for evaluating + objective function */ + , Eval_G_CB eval_g /** Callback function for evaluating + constraint functions */ + , Eval_Grad_F_CB eval_grad_f + /** Callback function for evaluating gradient + of objective function */ + , Eval_Jac_G_CB eval_jac_g + /** Callback function for evaluating Jacobian + of constraint functions */ + , Eval_H_CB eval_h /** Callback function for evaluating Hessian + of Lagrangian function */ + ); + + /** Method for freeing a previously created IpoptProblem. After + freeing an IpoptProblem, it cannot be used anymore. */ + IPOPT_EXPORT(void) FreeIpoptProblem(IpoptProblem ipopt_problem); + + + /** Function for adding a string option. Returns FALSE the option + * could not be set (e.g., if keyword is unknown) */ + IPOPT_EXPORT(Bool) AddIpoptStrOption(IpoptProblem ipopt_problem, char* keyword, char* val); + + /** Function for adding a Number option. Returns FALSE the option + * could not be set (e.g., if keyword is unknown) */ + IPOPT_EXPORT(Bool) AddIpoptNumOption(IpoptProblem ipopt_problem, char* keyword, Number val); + + /** Function for adding an Int option. Returns FALSE the option + * could not be set (e.g., if keyword is unknown) */ + IPOPT_EXPORT(Bool) AddIpoptIntOption(IpoptProblem ipopt_problem, char* keyword, Int val); + + /** Function for opening an output file for a given name with given + * printlevel. Returns false, if there was a problem opening the + * file. */ + IPOPT_EXPORT(Bool) OpenIpoptOutputFile(IpoptProblem ipopt_problem, char* file_name, + Int print_level); + + /** Optional function for setting scaling parameter for the NLP. + * This corresponds to the get_scaling_parameters method in TNLP. + * If the pointers x_scaling or g_scaling are NULL, then no scaling + * for x resp. g is done. */ + IPOPT_EXPORT(Bool) SetIpoptProblemScaling(IpoptProblem ipopt_problem, + Number obj_scaling, + Number* x_scaling, + Number* g_scaling); + + /** Setting a callback function for the "intermediate callback" + * method in the TNLP. This gives control back to the user once + * per iteration. If set, it provides the user with some + * information on the state of the optimization. This can be used + * to print some user-defined output. It also gives the user a way + * to terminate the optimization prematurely. If the callback + * method returns false, Ipopt will terminate the optimization. + * Calling this set method to set the CB pointer to NULL disables + * the intermediate callback functionality. */ + IPOPT_EXPORT(Bool) SetIntermediateCallback(IpoptProblem ipopt_problem, + Intermediate_CB intermediate_cb); + + /** Function calling the Ipopt optimization algorithm for a problem + previously defined with CreateIpoptProblem. The return + specified outcome of the optimization procedure (e.g., success, + failure etc). + */ + IPOPT_EXPORT(enum ApplicationReturnStatus) IpoptSolve( + IpoptProblem ipopt_problem + /** Problem that is to be optimized. Ipopt + will use the options previously specified with + AddIpoptOption (etc) for this problem. */ + , Number* x /** Input: Starting point + Output: Optimal solution */ + , Number* g /** Values of constraint at final point + (output only - ignored if set to NULL) */ + , Number* obj_val /** Final value of objective function + (output only - ignored if set to NULL) */ + , Number* mult_g /** Input: Initial values for the constraint + multipliers (only if warm start option + is chosen) + Output: Final multipliers for constraints + (ignored if set to NULL) */ + , Number* mult_x_L /** Input: Initial values for the multipliers for + lower variable bounds (only if warm start + option is chosen) + Output: Final multipliers for lower variable + bounds (ignored if set to NULL) */ + , Number* mult_x_U /** Input: Initial values for the multipliers for + upper variable bounds (only if warm start + option is chosen) + Output: Final multipliers for upper variable + bounds (ignored if set to NULL) */ + , UserDataPtr user_data + /** Pointer to user data. This will be + passed unmodified to the callback + functions. */ + ); + + /** + void IpoptStatisticsCounts; + + void IpoptStatisticsInfeasibilities; */ +#ifdef __cplusplus +} /* extern "C" { */ +#endif + +#endif diff --git a/thirdparty/windows/include/coin/IpSymMatrix.hpp b/thirdparty/windows/include/coin/IpSymMatrix.hpp index 736541e..ea74a02 100644 --- a/thirdparty/windows/include/coin/IpSymMatrix.hpp +++ b/thirdparty/windows/include/coin/IpSymMatrix.hpp @@ -1,159 +1,162 @@ -// Copyright (C) 2004, 2008 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpSymMatrix.hpp 1280 2008-08-10 21:19:31Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPSYMMATRIX_HPP__ -#define __IPSYMMATRIX_HPP__ - -#include "IpUtils.hpp" -#include "IpMatrix.hpp" - -namespace Ipopt -{ - - /* forward declarations */ - class SymMatrixSpace; - - /** This is the base class for all derived symmetric matrix types. - */ - class SymMatrix : public Matrix - { - public: - /** @name Constructor/Destructor */ - //@{ - /** Constructor, taking the owner_space. - */ - SymMatrix(const SymMatrixSpace* owner_space); - - /** Destructor */ - virtual ~SymMatrix() - {} - //@} - - /** @name Information about the size of the matrix */ - //@{ - /** Dimension of the matrix (number of rows and columns) */ - Index Dim() const; - //@} - - SmartPtr OwnerSymMatrixSpace() const; - - protected: - /** @name Overloaded methods from Matrix. */ - //@{ - /** Since the matrix is - * symmetric, it is only necessary to implement the - * MultVectorImpl method in a class that inherits from this base - * class. If the TransMultVectorImpl is called, this base class - * automatically calls MultVectorImpl instead. */ - virtual void TransMultVectorImpl(Number alpha, const Vector& x, Number beta, - Vector& y) const - { - // Since this matrix is symetric, this is the same operation as - // MultVector - MultVector(alpha, x, beta, y); - } - /** Since the matrix is symmetric, the row and column max norms - * are identical */ - virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const - { - ComputeRowAMaxImpl(cols_norms, init); - } - //@} - - private: - /** Copy of the owner space ptr as a SymMatrixSpace instead - * of a MatrixSpace - */ - const SymMatrixSpace* owner_space_; - }; - - - /** SymMatrixSpace base class, corresponding to the SymMatrix base - * class. */ - class SymMatrixSpace : public MatrixSpace - { - public: - /** @name Constructors/Destructors */ - //@{ - /** Constructor, given the dimension (identical to the number of - * rows and columns). - */ - SymMatrixSpace(Index dim) - : - MatrixSpace(dim,dim) - {} - - /** Destructor */ - virtual ~SymMatrixSpace() - {} - //@} - - /** Pure virtual method for creating a new matrix of this specific - * type. */ - virtual SymMatrix* MakeNewSymMatrix() const=0; - - /** Overloaded MakeNew method for the MatrixSpace base class. - */ - virtual Matrix* MakeNew() const - { - return MakeNewSymMatrix(); - } - - /** Accessor method for the dimension of the matrices in this - * matrix space. - */ - Index Dim() const - { - DBG_ASSERT(NRows() == NCols()); - return NRows(); - } - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** default constructor */ - SymMatrixSpace(); - - /* Copy constructor */ - SymMatrixSpace(const SymMatrixSpace&); - - /** Overloaded Equals Operator */ - SymMatrixSpace& operator=(const SymMatrixSpace&); - //@} - - }; - - /* inline methods */ - inline - SymMatrix::SymMatrix(const SymMatrixSpace* owner_space) - : - Matrix(owner_space), - owner_space_(owner_space) - {} - - inline - Index SymMatrix::Dim() const - { - return owner_space_->Dim(); - } - - inline - SmartPtr SymMatrix::OwnerSymMatrixSpace() const - { - return owner_space_; - } - -} // namespace Ipopt - -#endif +// Copyright (C) 2004, 2008 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpSymMatrix.hpp 2161 2013-01-01 20:39:05Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPSYMMATRIX_HPP__ +#define __IPSYMMATRIX_HPP__ + +#include "IpUtils.hpp" +#include "IpMatrix.hpp" + +namespace Ipopt +{ + + /* forward declarations */ + class SymMatrixSpace; + + /** This is the base class for all derived symmetric matrix types. + */ + class SymMatrix : public Matrix + { + public: + /** @name Constructor/Destructor */ + //@{ + /** Constructor, taking the owner_space. + */ + inline + SymMatrix(const SymMatrixSpace* owner_space); + + /** Destructor */ + virtual ~SymMatrix() + {} + //@} + + /** @name Information about the size of the matrix */ + //@{ + /** Dimension of the matrix (number of rows and columns) */ + inline + Index Dim() const; + //@} + + inline + SmartPtr OwnerSymMatrixSpace() const; + + protected: + /** @name Overloaded methods from Matrix. */ + //@{ + /** Since the matrix is + * symmetric, it is only necessary to implement the + * MultVectorImpl method in a class that inherits from this base + * class. If the TransMultVectorImpl is called, this base class + * automatically calls MultVectorImpl instead. */ + virtual void TransMultVectorImpl(Number alpha, const Vector& x, Number beta, + Vector& y) const + { + // Since this matrix is symetric, this is the same operation as + // MultVector + MultVector(alpha, x, beta, y); + } + /** Since the matrix is symmetric, the row and column max norms + * are identical */ + virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const + { + ComputeRowAMaxImpl(cols_norms, init); + } + //@} + + private: + /** Copy of the owner space ptr as a SymMatrixSpace instead + * of a MatrixSpace + */ + const SymMatrixSpace* owner_space_; + }; + + + /** SymMatrixSpace base class, corresponding to the SymMatrix base + * class. */ + class SymMatrixSpace : public MatrixSpace + { + public: + /** @name Constructors/Destructors */ + //@{ + /** Constructor, given the dimension (identical to the number of + * rows and columns). + */ + SymMatrixSpace(Index dim) + : + MatrixSpace(dim,dim) + {} + + /** Destructor */ + virtual ~SymMatrixSpace() + {} + //@} + + /** Pure virtual method for creating a new matrix of this specific + * type. */ + virtual SymMatrix* MakeNewSymMatrix() const=0; + + /** Overloaded MakeNew method for the MatrixSpace base class. + */ + virtual Matrix* MakeNew() const + { + return MakeNewSymMatrix(); + } + + /** Accessor method for the dimension of the matrices in this + * matrix space. + */ + Index Dim() const + { + DBG_ASSERT(NRows() == NCols()); + return NRows(); + } + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** default constructor */ + SymMatrixSpace(); + + /* Copy constructor */ + SymMatrixSpace(const SymMatrixSpace&); + + /** Overloaded Equals Operator */ + SymMatrixSpace& operator=(const SymMatrixSpace&); + //@} + + }; + + /* inline methods */ + inline + SymMatrix::SymMatrix(const SymMatrixSpace* owner_space) + : + Matrix(owner_space), + owner_space_(owner_space) + {} + + inline + Index SymMatrix::Dim() const + { + return owner_space_->Dim(); + } + + inline + SmartPtr SymMatrix::OwnerSymMatrixSpace() const + { + return owner_space_; + } + +} // namespace Ipopt + +#endif diff --git a/thirdparty/windows/include/coin/IpTNLP.hpp b/thirdparty/windows/include/coin/IpTNLP.hpp index c97ba88..b00325c 100644 --- a/thirdparty/windows/include/coin/IpTNLP.hpp +++ b/thirdparty/windows/include/coin/IpTNLP.hpp @@ -1,279 +1,301 @@ -// Copyright (C) 2004, 2009 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpTNLP.hpp 1462 2009-06-02 04:17:13Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPTNLP_HPP__ -#define __IPTNLP_HPP__ - -#include "IpUtils.hpp" -#include "IpReferenced.hpp" -#include "IpException.hpp" -#include "IpAlgTypes.hpp" -#include "IpReturnCodes.hpp" - -#include - -namespace Ipopt -{ - // forward declarations - class IpoptData; - class IpoptCalculatedQuantities; - class IteratesVector; - - /** Base class for all NLP's that use standard triplet matrix form - * and dense vectors. This is the standard base class for all - * NLP's that use the standard triplet matrix form (as for Harwell - * routines) and dense vectors. The class TNLPAdapter then converts - * this interface to an interface that can be used directly by - * ipopt. - * - * This interface presents the problem form: - * - * min f(x) - * - * s.t. gL <= g(x) <= gU - * - * xL <= x <= xU - * - * In order to specify an equality constraint, set gL_i = gU_i = - * rhs. The value that indicates "infinity" for the bounds - * (i.e. the variable or constraint has no lower bound (-infinity) - * or upper bound (+infinity)) is set through the option - * nlp_lower_bound_inf and nlp_upper_bound_inf. To indicate that a - * variable has no upper or lower bound, set the bound to - * -ipopt_inf or +ipopt_inf respectively - */ - class TNLP : public ReferencedObject - { - public: - /** Type of the constraints*/ - enum LinearityType - { - LINEAR/** Constraint/Variable is linear.*/, - NON_LINEAR/**Constraint/Varaible is non-linear.*/ - }; - - /**@name Constructors/Destructors */ - //@{ - TNLP() - {} - - /** Default destructor */ - virtual ~TNLP() - {} - //@} - - DECLARE_STD_EXCEPTION(INVALID_TNLP); - - /**@name methods to gather information about the NLP */ - //@{ - /** overload this method to return the number of variables - * and constraints, and the number of non-zeros in the jacobian and - * the hessian. The index_style parameter lets you specify C or Fortran - * style indexing for the sparse matrix iRow and jCol parameters. - * C_STYLE is 0-based, and FORTRAN_STYLE is 1-based. - */ - enum IndexStyleEnum { C_STYLE=0, FORTRAN_STYLE=1 }; - virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g, - Index& nnz_h_lag, IndexStyleEnum& index_style)=0; - - typedef std::map > StringMetaDataMapType; - typedef std::map > IntegerMetaDataMapType; - typedef std::map > NumericMetaDataMapType; - - /** overload this method to return any meta data for - * the variables and the constraints */ - virtual bool get_var_con_metadata(Index n, - StringMetaDataMapType& var_string_md, - IntegerMetaDataMapType& var_integer_md, - NumericMetaDataMapType& var_numeric_md, - Index m, - StringMetaDataMapType& con_string_md, - IntegerMetaDataMapType& con_integer_md, - NumericMetaDataMapType& con_numeric_md) - - { - return false; - } - - /** overload this method to return the information about the bound - * on the variables and constraints. The value that indicates - * that a bound does not exist is specified in the parameters - * nlp_lower_bound_inf and nlp_upper_bound_inf. By default, - * nlp_lower_bound_inf is -1e19 and nlp_upper_bound_inf is - * 1e19. (see TNLPAdapter) */ - virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u, - Index m, Number* g_l, Number* g_u)=0; - - /** overload this method to return scaling parameters. This is - * only called if the options are set to retrieve user scaling. - * There, use_x_scaling (or use_g_scaling) should get set to true - * only if the variables (or constraints) are to be scaled. This - * method should return true only if the scaling parameters could - * be provided. - */ - virtual bool get_scaling_parameters(Number& obj_scaling, - bool& use_x_scaling, Index n, - Number* x_scaling, - bool& use_g_scaling, Index m, - Number* g_scaling) - { - return false; - } - - /** overload this method to return the variables linearity - * (TNLP::Linear or TNLP::NonLinear). The var_types - * array should be allocated with length at least n. (default implementation - * just return false and does not fill the array).*/ - virtual bool get_variables_linearity(Index n, LinearityType* var_types) - { - return false; - } - - /** overload this method to return the constraint linearity. - * array should be alocated with length at least n. (default implementation - * just return false and does not fill the array).*/ - virtual bool get_constraints_linearity(Index m, LinearityType* const_types) - { - return false; - } - - /** overload this method to return the starting point. The bool - * variables indicate whether the algorithm wants you to - * initialize x, z_L/z_u, and lambda, respectively. If, for some - * reason, the algorithm wants you to initialize these and you - * cannot, return false, which will cause Ipopt to stop. You - * will have to run Ipopt with different options then. - */ - virtual bool get_starting_point(Index n, bool init_x, Number* x, - bool init_z, Number* z_L, Number* z_U, - Index m, bool init_lambda, - Number* lambda)=0; - - /** overload this method to provide an Ipopt iterate (already in - * the form Ipopt requires it internally) for a warm start. - * Since this is only for expert users, a default dummy - * implementation is provided and returns false. */ - virtual bool get_warm_start_iterate(IteratesVector& warm_start_iterate) - { - return false; - } - - /** overload this method to return the value of the objective function */ - virtual bool eval_f(Index n, const Number* x, bool new_x, - Number& obj_value)=0; - - /** overload this method to return the vector of the gradient of - * the objective w.r.t. x */ - virtual bool eval_grad_f(Index n, const Number* x, bool new_x, - Number* grad_f)=0; - - /** overload this method to return the vector of constraint values */ - virtual bool eval_g(Index n, const Number* x, bool new_x, - Index m, Number* g)=0; - /** overload this method to return the jacobian of the - * constraints. The vectors iRow and jCol only need to be set - * once. The first call is used to set the structure only (iRow - * and jCol will be non-NULL, and values will be NULL) For - * subsequent calls, iRow and jCol will be NULL. */ - virtual bool eval_jac_g(Index n, const Number* x, bool new_x, - Index m, Index nele_jac, Index* iRow, - Index *jCol, Number* values)=0; - - /** overload this method to return the hessian of the - * lagrangian. The vectors iRow and jCol only need to be set once - * (during the first call). The first call is used to set the - * structure only (iRow and jCol will be non-NULL, and values - * will be NULL) For subsequent calls, iRow and jCol will be - * NULL. This matrix is symmetric - specify the lower diagonal - * only. A default implementation is provided, in case the user - * wants to se quasi-Newton approximations to estimate the second - * derivatives and doesn't not neet to implement this method. */ - virtual bool eval_h(Index n, const Number* x, bool new_x, - Number obj_factor, Index m, const Number* lambda, - bool new_lambda, Index nele_hess, - Index* iRow, Index* jCol, Number* values) - { - return false; - } - //@} - - /** @name Solution Methods */ - //@{ - /** This method is called when the algorithm is complete so the TNLP can store/write the solution */ - virtual void 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)=0; - - /** Intermediate Callback method for the user. Providing dummy - * default implementation. For details see IntermediateCallBack - * in IpNLP.hpp. */ - virtual bool intermediate_callback(AlgorithmMode mode, - Index iter, Number obj_value, - Number inf_pr, Number inf_du, - Number mu, Number d_norm, - Number regularization_size, - Number alpha_du, Number alpha_pr, - Index ls_trials, - const IpoptData* ip_data, - IpoptCalculatedQuantities* ip_cq) - { - return true; - } - //@} - - /** @name Methods for quasi-Newton approximation. If the second - * derivatives are approximated by Ipopt, it is better to do this - * only in the space of nonlinear variables. The following - * methods are call by Ipopt if the quasi-Newton approximation is - * selected. If -1 is returned as number of nonlinear variables, - * Ipopt assumes that all variables are nonlinear. Otherwise, it - * calls get_list_of_nonlinear_variables with an array into which - * the indices of the nonlinear variables should be written - the - * array has the lengths num_nonlin_vars, which is identical with - * the return value of get_number_of_nonlinear_variables(). It - * is assumed that the indices are counted starting with 1 in the - * FORTRAN_STYLE, and 0 for the C_STYLE. */ - //@{ - virtual Index get_number_of_nonlinear_variables() - { - return -1; - } - - virtual bool get_list_of_nonlinear_variables(Index num_nonlin_vars, - Index* pos_nonlin_vars) - { - return false; - } - //@} - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - //TNLP(); - - /** Copy Constructor */ - TNLP(const TNLP&); - - /** Overloaded Equals Operator */ - void operator=(const TNLP&); - //@} - }; - -} // namespace Ipopt - -#endif +// Copyright (C) 2004, 2009 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpTNLP.hpp 2212 2013-04-14 14:51:52Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPTNLP_HPP__ +#define __IPTNLP_HPP__ + +#include "IpUtils.hpp" +#include "IpReferenced.hpp" +#include "IpException.hpp" +#include "IpAlgTypes.hpp" +#include "IpReturnCodes.hpp" + +#include + +namespace Ipopt +{ + // forward declarations + class IpoptData; + class IpoptCalculatedQuantities; + class IteratesVector; + + /** Base class for all NLP's that use standard triplet matrix form + * and dense vectors. This is the standard base class for all + * NLP's that use the standard triplet matrix form (as for Harwell + * routines) and dense vectors. The class TNLPAdapter then converts + * this interface to an interface that can be used directly by + * ipopt. + * + * This interface presents the problem form: + * + * min f(x) + * + * s.t. gL <= g(x) <= gU + * + * xL <= x <= xU + * + * In order to specify an equality constraint, set gL_i = gU_i = + * rhs. The value that indicates "infinity" for the bounds + * (i.e. the variable or constraint has no lower bound (-infinity) + * or upper bound (+infinity)) is set through the option + * nlp_lower_bound_inf and nlp_upper_bound_inf. To indicate that a + * variable has no upper or lower bound, set the bound to + * -ipopt_inf or +ipopt_inf respectively + */ + class TNLP : public ReferencedObject + { + public: + /** Type of the constraints*/ + enum LinearityType + { + LINEAR/** Constraint/Variable is linear.*/, + NON_LINEAR/**Constraint/Varaible is non-linear.*/ + }; + + /**@name Constructors/Destructors */ + //@{ + TNLP() + {} + + /** Default destructor */ + virtual ~TNLP() + {} + //@} + + DECLARE_STD_EXCEPTION(INVALID_TNLP); + + /**@name methods to gather information about the NLP */ + //@{ + /** overload this method to return the number of variables + * and constraints, and the number of non-zeros in the jacobian and + * the hessian. The index_style parameter lets you specify C or Fortran + * style indexing for the sparse matrix iRow and jCol parameters. + * C_STYLE is 0-based, and FORTRAN_STYLE is 1-based. + */ + enum IndexStyleEnum { C_STYLE=0, FORTRAN_STYLE=1 }; + virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g, + Index& nnz_h_lag, IndexStyleEnum& index_style)=0; + + typedef std::map > StringMetaDataMapType; + typedef std::map > IntegerMetaDataMapType; + typedef std::map > NumericMetaDataMapType; + + /** overload this method to return any meta data for + * the variables and the constraints */ + virtual bool get_var_con_metadata(Index n, + StringMetaDataMapType& var_string_md, + IntegerMetaDataMapType& var_integer_md, + NumericMetaDataMapType& var_numeric_md, + Index m, + StringMetaDataMapType& con_string_md, + IntegerMetaDataMapType& con_integer_md, + NumericMetaDataMapType& con_numeric_md) + + { + return false; + } + + /** overload this method to return the information about the bound + * on the variables and constraints. The value that indicates + * that a bound does not exist is specified in the parameters + * nlp_lower_bound_inf and nlp_upper_bound_inf. By default, + * nlp_lower_bound_inf is -1e19 and nlp_upper_bound_inf is + * 1e19. (see TNLPAdapter) */ + virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u, + Index m, Number* g_l, Number* g_u)=0; + + /** overload this method to return scaling parameters. This is + * only called if the options are set to retrieve user scaling. + * There, use_x_scaling (or use_g_scaling) should get set to true + * only if the variables (or constraints) are to be scaled. This + * method should return true only if the scaling parameters could + * be provided. + */ + virtual bool get_scaling_parameters(Number& obj_scaling, + bool& use_x_scaling, Index n, + Number* x_scaling, + bool& use_g_scaling, Index m, + Number* g_scaling) + { + return false; + } + + /** overload this method to return the variables linearity + * (TNLP::LINEAR or TNLP::NON_LINEAR). The var_types + * array has been allocated with length at least n. (default implementation + * just return false and does not fill the array).*/ + virtual bool get_variables_linearity(Index n, LinearityType* var_types) + { + return false; + } + + /** overload this method to return the constraint linearity. + * array has been allocated with length at least n. (default implementation + * just return false and does not fill the array).*/ + virtual bool get_constraints_linearity(Index m, LinearityType* const_types) + { + return false; + } + + /** overload this method to return the starting point. The bool + * variables indicate whether the algorithm wants you to + * initialize x, z_L/z_u, and lambda, respectively. If, for some + * reason, the algorithm wants you to initialize these and you + * cannot, return false, which will cause Ipopt to stop. You + * will have to run Ipopt with different options then. + */ + virtual bool get_starting_point(Index n, bool init_x, Number* x, + bool init_z, Number* z_L, Number* z_U, + Index m, bool init_lambda, + Number* lambda)=0; + + /** overload this method to provide an Ipopt iterate (already in + * the form Ipopt requires it internally) for a warm start. + * Since this is only for expert users, a default dummy + * implementation is provided and returns false. */ + virtual bool get_warm_start_iterate(IteratesVector& warm_start_iterate) + { + return false; + } + + /** overload this method to return the value of the objective function */ + virtual bool eval_f(Index n, const Number* x, bool new_x, + Number& obj_value)=0; + + /** overload this method to return the vector of the gradient of + * the objective w.r.t. x */ + virtual bool eval_grad_f(Index n, const Number* x, bool new_x, + Number* grad_f)=0; + + /** overload this method to return the vector of constraint values */ + virtual bool eval_g(Index n, const Number* x, bool new_x, + Index m, Number* g)=0; + /** overload this method to return the jacobian of the + * constraints. The vectors iRow and jCol only need to be set + * once. The first call is used to set the structure only (iRow + * and jCol will be non-NULL, and values will be NULL) For + * subsequent calls, iRow and jCol will be NULL. */ + virtual bool eval_jac_g(Index n, const Number* x, bool new_x, + Index m, Index nele_jac, Index* iRow, + Index *jCol, Number* values)=0; + + /** overload this method to return the hessian of the + * lagrangian. The vectors iRow and jCol only need to be set once + * (during the first call). The first call is used to set the + * structure only (iRow and jCol will be non-NULL, and values + * will be NULL) For subsequent calls, iRow and jCol will be + * NULL. This matrix is symmetric - specify the lower diagonal + * only. A default implementation is provided, in case the user + * wants to se quasi-Newton approximations to estimate the second + * derivatives and doesn't not neet to implement this method. */ + virtual bool eval_h(Index n, const Number* x, bool new_x, + Number obj_factor, Index m, const Number* lambda, + bool new_lambda, Index nele_hess, + Index* iRow, Index* jCol, Number* values) + { + return false; + } + //@} + + /** @name Solution Methods */ + //@{ + /** This method is called when the algorithm is complete so the TNLP can store/write the solution */ + virtual void 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)=0; + /** This method is called just before finalize_solution. With + * this method, the algorithm returns any metadata collected + * during its run, including the metadata provided by the user + * with the above get_var_con_metadata. Each metadata can be of + * type string, integer, and numeric. It can be associated to + * either the variables or the constraints. The metadata that + * was associated with the primal variable vector is stored in + * var_..._md. The metadata associated with the constraint + * multipliers is stored in con_..._md. The metadata associated + * with the bound multipliers is stored in var_..._md, with the + * suffixes "_z_L", and "_z_U", denoting lower and upper + * bounds. */ + virtual void finalize_metadata(Index n, + const StringMetaDataMapType& var_string_md, + const IntegerMetaDataMapType& var_integer_md, + const NumericMetaDataMapType& var_numeric_md, + Index m, + const StringMetaDataMapType& con_string_md, + const IntegerMetaDataMapType& con_integer_md, + const NumericMetaDataMapType& con_numeric_md) + {} + + + /** Intermediate Callback method for the user. Providing dummy + * default implementation. For details see IntermediateCallBack + * in IpNLP.hpp. */ + virtual bool intermediate_callback(AlgorithmMode mode, + Index iter, Number obj_value, + Number inf_pr, Number inf_du, + Number mu, Number d_norm, + Number regularization_size, + Number alpha_du, Number alpha_pr, + Index ls_trials, + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq) + { + return true; + } + //@} + + /** @name Methods for quasi-Newton approximation. If the second + * derivatives are approximated by Ipopt, it is better to do this + * only in the space of nonlinear variables. The following + * methods are call by Ipopt if the quasi-Newton approximation is + * selected. If -1 is returned as number of nonlinear variables, + * Ipopt assumes that all variables are nonlinear. Otherwise, it + * calls get_list_of_nonlinear_variables with an array into which + * the indices of the nonlinear variables should be written - the + * array has the lengths num_nonlin_vars, which is identical with + * the return value of get_number_of_nonlinear_variables(). It + * is assumed that the indices are counted starting with 1 in the + * FORTRAN_STYLE, and 0 for the C_STYLE. */ + //@{ + virtual Index get_number_of_nonlinear_variables() + { + return -1; + } + + virtual bool get_list_of_nonlinear_variables(Index num_nonlin_vars, + Index* pos_nonlin_vars) + { + return false; + } + //@} + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + //TNLP(); + + /** Copy Constructor */ + TNLP(const TNLP&); + + /** Overloaded Equals Operator */ + void operator=(const TNLP&); + //@} + }; + +} // namespace Ipopt + +#endif diff --git a/thirdparty/windows/include/coin/IpTNLPReducer.hpp b/thirdparty/windows/include/coin/IpTNLPReducer.hpp index 2e880f4..44a18eb 100644 --- a/thirdparty/windows/include/coin/IpTNLPReducer.hpp +++ b/thirdparty/windows/include/coin/IpTNLPReducer.hpp @@ -1,180 +1,180 @@ -// Copyright (C) 2008 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpTNLPReducer.hpp 1324 2008-09-16 14:19:26Z andreasw $ -// -// Authors: Andreas Waechter IBM 2008-08-10 - -#ifndef __IPTNLPREDUCER_HPP__ -#define __IPTNLPREDUCER_HPP__ - -#include "IpTNLP.hpp" - -namespace Ipopt -{ - /** This is a wrapper around a given TNLP class that takes out a - * list of constraints that are given to the constructor. It is - * provided for convenience, if one wants to experiment with - * problems that consist of only a subset of the constraints. But - * keep in mind that this is not efficient, since behind the scenes - * we are still evaluation all functions and derivatives, and are - * making copies of the original data. */ - class TNLPReducer : public TNLP - { - public: - /**@name Constructors/Destructors */ - //@{ - /** Constructor is given the indices of the constraints that - * should be taken out of the problem statement, as well as the - * original TNLP. */ - TNLPReducer(TNLP& tnlp, Index n_g_skip, const Index* index_g_skip, - Index n_xL_skip, const Index* index_xL_skip, - Index n_xU_skip, const Index* index_xU_skip, - Index n_x_fix, const Index* index_f_fix); - - /** Default destructor */ - virtual ~TNLPReducer(); - //@} - - /** @name Overloaded methods from TNLP */ - virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g, - Index& nnz_h_lag, IndexStyleEnum& index_style); - - virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u, - Index m, Number* g_l, Number* g_u); - - virtual bool get_scaling_parameters(Number& obj_scaling, - bool& use_x_scaling, Index n, - Number* x_scaling, - bool& use_g_scaling, Index m, - Number* g_scaling); - - virtual bool get_variables_linearity(Index n, LinearityType* var_types); - - virtual bool get_constraints_linearity(Index m, LinearityType* const_types); - - virtual bool get_starting_point(Index n, bool init_x, Number* x, - bool init_z, Number* z_L, Number* z_U, - Index m, bool init_lambda, - Number* lambda); - - virtual bool get_warm_start_iterate(IteratesVector& warm_start_iterate); - - virtual bool eval_f(Index n, const Number* x, bool new_x, - Number& obj_value); - - virtual bool eval_grad_f(Index n, const Number* x, bool new_x, - Number* grad_f); - - virtual bool eval_g(Index n, const Number* x, bool new_x, - Index m, Number* g); - - virtual bool eval_jac_g(Index n, const Number* x, bool new_x, - Index m, Index nele_jac, Index* iRow, - Index *jCol, Number* values); - - virtual bool eval_h(Index n, const Number* x, bool new_x, - Number obj_factor, Index m, const Number* lambda, - bool new_lambda, Index nele_hess, - Index* iRow, Index* jCol, Number* values); - - virtual void 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); - - virtual bool intermediate_callback(AlgorithmMode mode, - Index iter, Number obj_value, - Number inf_pr, Number inf_du, - Number mu, Number d_norm, - Number regularization_size, - Number alpha_du, Number alpha_pr, - Index ls_trials, - const IpoptData* ip_data, - IpoptCalculatedQuantities* ip_cq); - - virtual Index get_number_of_nonlinear_variables(); - - virtual bool get_list_of_nonlinear_variables(Index num_nonlin_vars, - Index* pos_nonlin_vars); - //@} - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - TNLPReducer(); - - /** Copy Constructor */ - TNLPReducer(const TNLPReducer&); - - /** Overloaded Equals Operator */ - void operator=(const TNLPReducer&); - //@} - - /** @name original TNLP */ - //@{ - SmartPtr tnlp_; - Index m_orig_; - Index nnz_jac_g_orig_; - //@} - - /** Number of constraints to be skipped */ - Index n_g_skip_; - - /** Array of indices of the constraints that are to be skipped. - * This is provided at the beginning in the constructor. */ - Index* index_g_skip_; - - /** Index style for original problem. Internally, we use C-Style - * now. */ - IndexStyleEnum index_style_orig_; - - /** Map from original constraints to new constraints. A -1 means - * that a constraint is skipped. */ - Index* g_keep_map_; - - /** Number of constraints in reduced NLP */ - Index m_reduced_; - - /** Number of Jacobian nonzeros in the reduced NLP */ - Index nnz_jac_g_reduced_; - - /** Number of Jacobian nonzeros that are skipped */ - Index nnz_jac_g_skipped_; - - /** Array of Jacobian elements that are to be skipped. This is in - * increasing order. */ - Index* jac_g_skipped_; - - /** Number of lower variable bounds to be skipped. */ - Index n_xL_skip_; - - /** Array of indices of the lower variable bounds to be skipped. */ - Index* index_xL_skip_; - - /** Number of upper variable bounds to be skipped. */ - Index n_xU_skip_; - - /** Array of indices of the upper variable bounds to be skipped. */ - Index* index_xU_skip_; - - /** Number of variables that are to be fixed to initial value. */ - Index n_x_fix_; - - /** Array of indices of the variables that are to be fixed. */ - Index* index_x_fix_; - }; - -} // namespace Ipopt - -#endif +// Copyright (C) 2008 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpTNLPReducer.hpp 1861 2010-12-21 21:34:47Z andreasw $ +// +// Authors: Andreas Waechter IBM 2008-08-10 + +#ifndef __IPTNLPREDUCER_HPP__ +#define __IPTNLPREDUCER_HPP__ + +#include "IpTNLP.hpp" + +namespace Ipopt +{ + /** This is a wrapper around a given TNLP class that takes out a + * list of constraints that are given to the constructor. It is + * provided for convenience, if one wants to experiment with + * problems that consist of only a subset of the constraints. But + * keep in mind that this is not efficient, since behind the scenes + * we are still evaluation all functions and derivatives, and are + * making copies of the original data. */ + class TNLPReducer : public TNLP + { + public: + /**@name Constructors/Destructors */ + //@{ + /** Constructor is given the indices of the constraints that + * should be taken out of the problem statement, as well as the + * original TNLP. */ + TNLPReducer(TNLP& tnlp, Index n_g_skip, const Index* index_g_skip, + Index n_xL_skip, const Index* index_xL_skip, + Index n_xU_skip, const Index* index_xU_skip, + Index n_x_fix, const Index* index_f_fix); + + /** Default destructor */ + virtual ~TNLPReducer(); + //@} + + /** @name Overloaded methods from TNLP */ + virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g, + Index& nnz_h_lag, IndexStyleEnum& index_style); + + virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u, + Index m, Number* g_l, Number* g_u); + + virtual bool get_scaling_parameters(Number& obj_scaling, + bool& use_x_scaling, Index n, + Number* x_scaling, + bool& use_g_scaling, Index m, + Number* g_scaling); + + virtual bool get_variables_linearity(Index n, LinearityType* var_types); + + virtual bool get_constraints_linearity(Index m, LinearityType* const_types); + + virtual bool get_starting_point(Index n, bool init_x, Number* x, + bool init_z, Number* z_L, Number* z_U, + Index m, bool init_lambda, + Number* lambda); + + virtual bool get_warm_start_iterate(IteratesVector& warm_start_iterate); + + virtual bool eval_f(Index n, const Number* x, bool new_x, + Number& obj_value); + + virtual bool eval_grad_f(Index n, const Number* x, bool new_x, + Number* grad_f); + + virtual bool eval_g(Index n, const Number* x, bool new_x, + Index m, Number* g); + + virtual bool eval_jac_g(Index n, const Number* x, bool new_x, + Index m, Index nele_jac, Index* iRow, + Index *jCol, Number* values); + + virtual bool eval_h(Index n, const Number* x, bool new_x, + Number obj_factor, Index m, const Number* lambda, + bool new_lambda, Index nele_hess, + Index* iRow, Index* jCol, Number* values); + + virtual void 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); + + virtual bool intermediate_callback(AlgorithmMode mode, + Index iter, Number obj_value, + Number inf_pr, Number inf_du, + Number mu, Number d_norm, + Number regularization_size, + Number alpha_du, Number alpha_pr, + Index ls_trials, + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq); + + virtual Index get_number_of_nonlinear_variables(); + + virtual bool get_list_of_nonlinear_variables(Index num_nonlin_vars, + Index* pos_nonlin_vars); + //@} + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + TNLPReducer(); + + /** Copy Constructor */ + TNLPReducer(const TNLPReducer&); + + /** Overloaded Equals Operator */ + void operator=(const TNLPReducer&); + //@} + + /** @name original TNLP */ + //@{ + SmartPtr tnlp_; + Index m_orig_; + Index nnz_jac_g_orig_; + //@} + + /** Number of constraints to be skipped */ + Index n_g_skip_; + + /** Array of indices of the constraints that are to be skipped. + * This is provided at the beginning in the constructor. */ + Index* index_g_skip_; + + /** Index style for original problem. Internally, we use C-Style + * now. */ + IndexStyleEnum index_style_orig_; + + /** Map from original constraints to new constraints. A -1 means + * that a constraint is skipped. */ + Index* g_keep_map_; + + /** Number of constraints in reduced NLP */ + Index m_reduced_; + + /** Number of Jacobian nonzeros in the reduced NLP */ + Index nnz_jac_g_reduced_; + + /** Number of Jacobian nonzeros that are skipped */ + Index nnz_jac_g_skipped_; + + /** Array of Jacobian elements that are to be skipped. This is in + * increasing order. */ + Index* jac_g_skipped_; + + /** Number of lower variable bounds to be skipped. */ + Index n_xL_skip_; + + /** Array of indices of the lower variable bounds to be skipped. */ + Index* index_xL_skip_; + + /** Number of upper variable bounds to be skipped. */ + Index n_xU_skip_; + + /** Array of indices of the upper variable bounds to be skipped. */ + Index* index_xU_skip_; + + /** Number of variables that are to be fixed to initial value. */ + Index n_x_fix_; + + /** Array of indices of the variables that are to be fixed. */ + Index* index_x_fix_; + }; + +} // namespace Ipopt + +#endif diff --git a/thirdparty/windows/include/coin/IpTaggedObject.hpp b/thirdparty/windows/include/coin/IpTaggedObject.hpp index b49ef04..51c6c7d 100644 --- a/thirdparty/windows/include/coin/IpTaggedObject.hpp +++ b/thirdparty/windows/include/coin/IpTaggedObject.hpp @@ -1,149 +1,159 @@ -// Copyright (C) 2004, 2006 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpTaggedObject.hpp 1019 2007-06-24 03:52:34Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPTAGGEDOBJECT_HPP__ -#define __IPTAGGEDOBJECT_HPP__ - -#include "IpUtils.hpp" -#include "IpDebug.hpp" -#include "IpReferenced.hpp" -#include "IpObserver.hpp" -#include - -namespace Ipopt -{ - - /** TaggedObject class. - * Often, certain calculations or operations are expensive, - * and it can be very inefficient to perform these calculations - * again if the input to the calculation has not changed - * since the result was last stored. - * This base class provides an efficient mechanism to update - * a tag, indicating that the object has changed. - * Users of a TaggedObject class, need their own Tag data - * member to keep track of the state of the TaggedObject, the - * last time they performed a calculation. A basic use case for - * users of a class inheriting off of TaggedObject follows like - * this: - * - * Initialize your own Tag to zero in constructor. - * - * - * - * Before an expensive calculation, - * check if the TaggedObject has changed, passing in - * your own Tag, indicating the last time you used - * the object for the calculation. If it has changed, - * perform the calculation again, and store the result. - * If it has not changed, simply return the stored result. - * - * Here is a simple example: - \verbatim - if (vector.HasChanged(my_vector_tag_)) { - my_vector_tag_ = vector.GetTag(); - result = PerformExpensiveCalculation(vector); - return result; - } - else { - return result; - } - \endverbatim - * - * Objects derived from TaggedObject: - * Objects derived from TaggedObject must indicate that they have changed to - * the base class using the protected member function ObjectChanged(). For - * example, a Vector class, inside its own set method, MUST call - * ObjectChanged() to update the internally stored tag for comparison. - */ - class TaggedObject : public ReferencedObject, public Subject - { - public: - /** Type for the Tag values */ - typedef unsigned int Tag; - - /** Constructor. */ - TaggedObject() - : - Subject() - { - ObjectChanged(); - } - - /** Destructor. */ - virtual ~TaggedObject() - {} - - /** Users of TaggedObjects call this to - * update their own internal tags every time - * they perform the expensive operation. - */ - Tag GetTag() const - { - return tag_; - } - - /** Users of TaggedObjects call this to - * check if the object HasChanged since - * they last updated their own internal - * tag. - */ - bool HasChanged(const Tag comparison_tag) const - { - return (comparison_tag == tag_) ? false : true; - } - protected: - /** Objects derived from TaggedObject MUST call this - * method every time their internal state changes to - * update the internal tag for comparison - */ - void ObjectChanged() - { - DBG_START_METH("TaggedObject::ObjectChanged()", 0); - tag_ = unique_tag_; - unique_tag_++; - DBG_ASSERT(unique_tag_ < std::numeric_limits::max()); - // The Notify method from the Subject base class notifies all - // registed Observers that this subject has changed. - Notify(Observer::NT_Changed); - } - private: - /**@name Default Compiler Generated Methods (Hidden to avoid - * implicit creation/calling). These methods are not implemented - * and we do not want the compiler to implement them for us, so we - * declare them private and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Copy Constructor */ - TaggedObject(const TaggedObject&); - - /** Overloaded Equals Operator */ - void operator=(const TaggedObject&); - //@} - - /** static data member that is incremented every - * time ANY TaggedObject changes. This allows us - * to obtain a unique Tag when the object changes - */ - static Tag unique_tag_; - - /** The tag indicating the current state of the object. - * We use this to compare against the comparison_tag - * in the HasChanged method. This member is updated - * from the unique_tag_ every time the object changes. - */ - Tag tag_; - - /** The index indicating the cache priority for this - * TaggedObject. If a result that depended on this - * TaggedObject is cached, it will be cached with this - * priority - */ - Index cache_priority_; - }; -} // namespace Ipopt -#endif +// Copyright (C) 2004, 2006 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpTaggedObject.hpp 2276 2013-05-05 12:33:44Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPTAGGEDOBJECT_HPP__ +#define __IPTAGGEDOBJECT_HPP__ + +#include "IpUtils.hpp" +#include "IpDebug.hpp" +#include "IpReferenced.hpp" +#include "IpObserver.hpp" +#include +#include // for std::pair + +namespace Ipopt +{ + + /** TaggedObject class. + * Often, certain calculations or operations are expensive, + * and it can be very inefficient to perform these calculations + * again if the input to the calculation has not changed + * since the result was last stored. + * This base class provides an efficient mechanism to update + * a tag, indicating that the object has changed. + * Users of a TaggedObject class, need their own Tag data + * member to keep track of the state of the TaggedObject, the + * last time they performed a calculation. A basic use case for + * users of a class inheriting from TaggedObject follows like + * this: + * + * 1. Initialize your own Tag by its default constructor. + * + * 2. Before an expensive calculation, + * check if the TaggedObject has changed, passing in + * your own Tag, indicating the last time you used + * the object for the calculation. If it has changed, + * perform the calculation again, and store the result. + * If it has not changed, simply return the stored result. + * + * Here is a simple example: + \verbatim + if (vector.HasChanged(my_vector_tag_)) { + my_vector_tag_ = vector.GetTag(); + result = PerformExpensiveCalculation(vector); + return result; + } + else { + return result; + } + \endverbatim + * + * Objects derived from TaggedObject must indicate that they have changed to + * the base class using the protected member function ObjectChanged(). For + * example, a Vector class, inside its own set method, MUST call + * ObjectChanged() to update the internally stored tag for comparison. + */ + class TaggedObject : public ReferencedObject, public Subject + { + public: + /** Type for the Tag values + * + * To make the tag unique among all objects, we + * include the memory address of the object into the + * tag value. + */ + typedef std::pair Tag; + + /** Constructor. */ + TaggedObject() + : + Subject(), + /* We can initialize the tag counter to 0, because this objects Tag + * will differ from a Tag() object in its first member. */ + tagcount_(0) + { + ObjectChanged(); + } + + /** Destructor. */ + virtual ~TaggedObject() + {} + + /** Users of TaggedObjects call this to + * update their own internal tags every time + * they perform the expensive operation. + */ + Tag GetTag() const + { + return Tag(this, tagcount_); + } + + /** Users of TaggedObjects call this to + * check if the object HasChanged since + * they last updated their own internal + * tag. + */ + bool HasChanged(const Tag comparison_tag) const + { + return (comparison_tag.first != this) || (comparison_tag.second != tagcount_); + } + protected: + /** Objects derived from TaggedObject MUST call this + * method every time their internal state changes to + * update the internal tag for comparison + */ + void ObjectChanged() + { + DBG_START_METH("TaggedObject::ObjectChanged()", 0); + tagcount_++; + DBG_ASSERT(tagcount_ < std::numeric_limits::max()); + // The Notify method from the Subject base class notifies all + // registered Observers that this subject has changed. + Notify(Observer::NT_Changed); + } + private: + /**@name Default Compiler Generated Methods (Hidden to avoid + * implicit creation/calling). These methods are not implemented + * and we do not want the compiler to implement them for us, so we + * declare them private and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Copy Constructor */ + TaggedObject(const TaggedObject&); + + /** Overloaded Equals Operator */ + void operator=(const TaggedObject&); + //@} + + /** The tag indicating the current state of the object. + * We use this to compare against the comparison_tag + * in the HasChanged method. This member is increased + * every time the object changes. + */ + Tag::second_type tagcount_; + + /** The index indicating the cache priority for this + * TaggedObject. If a result that depended on this + * TaggedObject is cached, it will be cached with this + * priority + */ + Index cache_priority_; + }; + + /** The addition of two tags - do not use. + * + * @note Do not use this operator, unless you really know what you are doing. + */ + inline + TaggedObject::Tag operator+(const TaggedObject::Tag& tag1, const TaggedObject::Tag& tag2) + { + return TaggedObject::Tag(tag1.first, tag1.second + tag2.second); + } + +} // namespace Ipopt +#endif diff --git a/thirdparty/windows/include/coin/IpTimedTask.hpp b/thirdparty/windows/include/coin/IpTimedTask.hpp index 3533708..d79469b 100644 --- a/thirdparty/windows/include/coin/IpTimedTask.hpp +++ b/thirdparty/windows/include/coin/IpTimedTask.hpp @@ -1,114 +1,146 @@ -// Copyright (C) 2006 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpTimedTask.hpp 1430 2009-04-20 20:58:25Z andreasw $ -// -// Authors: Andreas Waechter IBM 2005-09-19 - -#ifndef __IPTIMEDTASK_HPP__ -#define __IPTIMEDTASK_HPP__ - -#include "IpUtils.hpp" - -namespace Ipopt -{ - /** This class is used to collect timing information for a - * particular task. */ - class TimedTask - { - public: - /**@name Constructors/Destructors */ - //@{ - /** Default constructor. */ - TimedTask() - : - total_time_(0.), - start_called_(false), - end_called_(true) - {} - - /** Default destructor */ - ~TimedTask() - {} - //@} - - /** Method for resetting time to zero. */ - void Reset() - { - total_time_ = 0.; - start_called_ = false; - end_called_ = true; - } - - /** Method that is called before execution of the task. */ - void Start() - { - DBG_ASSERT(end_called_); - DBG_ASSERT(!start_called_); - end_called_ = false; - start_called_ = true; - start_time_ = CpuTime(); - } - - /** Method that is called after execution of the task. */ - void End() - { - DBG_ASSERT(!end_called_); - DBG_ASSERT(start_called_); - end_called_ = true; - start_called_ = false; - total_time_ += CpuTime() - start_time_; - } - - /** Method that is called after execution of the task for which - * timing might have been started. This only updates the timing - * if the timing has indeed been conducted. This is useful to - * stop timing after catching exceptions. */ - void EndIfStarted() - { - if (start_called_) { - end_called_ = true; - start_called_ = false; - total_time_ += CpuTime() - start_time_; - } - DBG_ASSERT(end_called_); - } - - /** Method returning total time spend for task so far. */ - Number TotalTime() const - { - DBG_ASSERT(end_called_); - return total_time_; - } - - private: - /**@name Default Compiler Generated Methods (Hidden to avoid - * implicit creation/calling). These methods are not - * implemented and we do not want the compiler to implement them - * for us, so we declare them private and do not define - * them. This ensures that they will not be implicitly - * created/called. */ - //@{ - /** Copy Constructor */ - TimedTask(const TimedTask&); - - /** Overloaded Equals Operator */ - void operator=(const TimedTask&); - //@} - - /** Time at beginning of task. */ - Number start_time_; - /** Total time for task measured so far. */ - Number total_time_; - - /** @name fields for debugging */ - //@{ - bool start_called_; - bool end_called_; - //@} - - }; -} // namespace Ipopt - -#endif +// Copyright (C) 2006, 2009 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpTimedTask.hpp 1861 2010-12-21 21:34:47Z andreasw $ +// +// Authors: Andreas Waechter IBM 2005-09-19 + +#ifndef __IPTIMEDTASK_HPP__ +#define __IPTIMEDTASK_HPP__ + +#include "IpUtils.hpp" + +namespace Ipopt +{ + /** This class is used to collect timing information for a + * particular task. */ + class TimedTask + { + public: + /**@name Constructors/Destructors */ + //@{ + /** Default constructor. */ + TimedTask() + : + total_cputime_(0.), + total_systime_(0.), + total_walltime_(0.), + start_called_(false), + end_called_(true) + {} + + /** Default destructor */ + ~TimedTask() + {} + //@} + + /** Method for resetting time to zero. */ + void Reset() + { + total_cputime_ = 0.; + total_systime_ = 0.; + total_walltime_ = 0.; + start_called_ = false; + end_called_ = true; + } + + /** Method that is called before execution of the task. */ + void Start() + { + DBG_ASSERT(end_called_); + DBG_ASSERT(!start_called_); + end_called_ = false; + start_called_ = true; + start_cputime_ = CpuTime(); + start_systime_ = SysTime(); + start_walltime_ = WallclockTime(); + } + + /** Method that is called after execution of the task. */ + void End() + { + DBG_ASSERT(!end_called_); + DBG_ASSERT(start_called_); + end_called_ = true; + start_called_ = false; + total_cputime_ += CpuTime() - start_cputime_; + total_systime_ += SysTime() - start_systime_; + total_walltime_ += WallclockTime() - start_walltime_; + } + + /** Method that is called after execution of the task for which + * timing might have been started. This only updates the timing + * if the timing has indeed been conducted. This is useful to + * stop timing after catching exceptions. */ + void EndIfStarted() + { + if (start_called_) { + end_called_ = true; + start_called_ = false; + total_cputime_ += CpuTime() - start_cputime_; + total_systime_ += SysTime() - start_systime_; + total_walltime_ += WallclockTime() - start_walltime_; + } + DBG_ASSERT(end_called_); + } + + /** Method returning total CPU time spend for task so far. */ + Number TotalCpuTime() const + { + DBG_ASSERT(end_called_); + return total_cputime_; + } + + /** Method returning total system time spend for task so far. */ + Number TotalSysTime() const + { + DBG_ASSERT(end_called_); + return total_systime_; + } + + /** Method returning total wall clock time spend for task so far. */ + Number TotalWallclockTime() const + { + DBG_ASSERT(end_called_); + return total_walltime_; + } + + private: + /**@name Default Compiler Generated Methods (Hidden to avoid + * implicit creation/calling). These methods are not + * implemented and we do not want the compiler to implement them + * for us, so we declare them private and do not define + * them. This ensures that they will not be implicitly + * created/called. */ + //@{ + /** Copy Constructor */ + TimedTask(const TimedTask&); + + /** Overloaded Equals Operator */ + void operator=(const TimedTask&); + //@} + + /** CPU time at beginning of task. */ + Number start_cputime_; + /** Total CPU time for task measured so far. */ + Number total_cputime_; + /** System time at beginning of task. */ + Number start_systime_; + /** Total system time for task measured so far. */ + Number total_systime_; + /** Wall clock time at beginning of task. */ + Number start_walltime_; + /** Total wall clock time for task measured so far. */ + Number total_walltime_; + + /** @name fields for debugging */ + //@{ + bool start_called_; + bool end_called_; + //@} + + }; +} // namespace Ipopt + +#endif diff --git a/thirdparty/windows/include/coin/IpUtils.hpp b/thirdparty/windows/include/coin/IpUtils.hpp index 55c8fd4..092ace6 100644 --- a/thirdparty/windows/include/coin/IpUtils.hpp +++ b/thirdparty/windows/include/coin/IpUtils.hpp @@ -1,125 +1,128 @@ -// Copyright (C) 2004, 2009 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpUtils.hpp 1521 2009-07-15 22:26:15Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPUTILS_HPP__ -#define __IPUTILS_HPP__ - -// Standard Ip Include Files -#include "IpTypes.hpp" -#include "IpDebug.hpp" - -namespace Ipopt -{ - - inline Index Max(Index a, Index b) - { - return ((a) > (b) ? (a) : (b)); - } - - inline Index Max(Index a, Index b, Index c) - { - Index max = Max(a,b); - max = Max(max, c); - return max; - } - - inline Index Max(Index a, Index b, Index c, Index d) - { - Index max = Max(a, b, c); - max = Max(max, d); - return max; - } - - inline Index Min(Index a, Index b) - { - return ((a) < (b) ? (a) : (b)); - } - - inline Index Min(Index a, Index b, Index c) - { - Index min = Min(a,b); - min = Min(min, c); - return min; - } - - inline Index Min(Index a, Index b, Index c, Index d) - { - Index min = Min(a, b, c); - min = Min(min, d); - return min; - } - - /////////////////////////////////////////// - - inline Number Max(Number a, Number b) - { - return ((a) > (b) ? (a) : (b)); - } - - inline Number Max(Number a, Number b, Number c) - { - Number max = Max(a,b); - max = Max(max, c); - return max; - } - - inline Number Max(Number a, Number b, Number c, Number d) - { - Number max = Max(a, b, c); - max = Max(max, d); - return max; - } - - inline Number Min(Number a, Number b) - { - return ((a) < (b) ? (a) : (b)); - } - - inline Number Min(Number a, Number b, Number c) - { - Number min = Min(a,b); - min = Min(min, c); - return min; - } - - inline Number Min(Number a, Number b, Number c, Number d) - { - Number min = Min(a, b, c); - min = Min(min, d); - return min; - } - - /** Function returning true iff the argument is a valid double number - * (not NaN or Inf). */ - bool IsFiniteNumber(Number val); - - /** Function returning a random number between 0 and 1 */ - Number IpRandom01(); - - /** Function resetting the random number generator */ - void IpResetRandom01(); - - /** method determining CPU executed since start of program */ - Number CpuTime(); - - /** Function for getting a string with the current wallclock time */ - double WallclockTime(); - - /** Method for comparing two numbers within machine precision. The - * return value is true if lhs is less or equal the rhs, relaxing - * this inequality by something a little larger than machine - * precision relative to the absolute value of BasVal. */ - bool Compare_le(Number lhs, Number rhs, Number BasVal); - - /** Method for printing a formatted output to a string with given size. - */ - int Snprintf(char* str, long size, const char* format, ...); - -} //namespace Ipopt - -#endif +// Copyright (C) 2004, 2009 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpUtils.hpp 2167 2013-03-08 11:15:38Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPUTILS_HPP__ +#define __IPUTILS_HPP__ + +// Standard Ip Include Files +#include "IpTypes.hpp" +#include "IpDebug.hpp" + +namespace Ipopt +{ + + inline Index Max(Index a, Index b) + { + return ((a) > (b) ? (a) : (b)); + } + + inline Index Max(Index a, Index b, Index c) + { + Index max = Max(a,b); + max = Max(max, c); + return max; + } + + inline Index Max(Index a, Index b, Index c, Index d) + { + Index max = Max(a, b, c); + max = Max(max, d); + return max; + } + + inline Index Min(Index a, Index b) + { + return ((a) < (b) ? (a) : (b)); + } + + inline Index Min(Index a, Index b, Index c) + { + Index min = Min(a,b); + min = Min(min, c); + return min; + } + + inline Index Min(Index a, Index b, Index c, Index d) + { + Index min = Min(a, b, c); + min = Min(min, d); + return min; + } + + /////////////////////////////////////////// + + inline Number Max(Number a, Number b) + { + return ((a) > (b) ? (a) : (b)); + } + + inline Number Max(Number a, Number b, Number c) + { + Number max = Max(a,b); + max = Max(max, c); + return max; + } + + inline Number Max(Number a, Number b, Number c, Number d) + { + Number max = Max(a, b, c); + max = Max(max, d); + return max; + } + + inline Number Min(Number a, Number b) + { + return ((a) < (b) ? (a) : (b)); + } + + inline Number Min(Number a, Number b, Number c) + { + Number min = Min(a,b); + min = Min(min, c); + return min; + } + + inline Number Min(Number a, Number b, Number c, Number d) + { + Number min = Min(a, b, c); + min = Min(min, d); + return min; + } + + /** Function returning true iff the argument is a valid double number + * (not NaN or Inf). */ + bool IsFiniteNumber(Number val); + + /** Function returning a random number between 0 and 1 */ + Number IpRandom01(); + + /** Function resetting the random number generator */ + void IpResetRandom01(); + + /** method determining CPU time */ + Number CpuTime(); + + /** method determining system time */ + Number SysTime(); + + /** method determining wallclock time since first call */ + Number WallclockTime(); + + /** Method for comparing two numbers within machine precision. The + * return value is true if lhs is less or equal the rhs, relaxing + * this inequality by something a little larger than machine + * precision relative to the absolute value of BasVal. */ + bool Compare_le(Number lhs, Number rhs, Number BasVal); + + /** Method for printing a formatted output to a string with given size. + */ + int Snprintf(char* str, long size, const char* format, ...); + +} //namespace Ipopt + +#endif diff --git a/thirdparty/windows/include/coin/IpVector.hpp b/thirdparty/windows/include/coin/IpVector.hpp index 3b35846..147a8bb 100644 --- a/thirdparty/windows/include/coin/IpVector.hpp +++ b/thirdparty/windows/include/coin/IpVector.hpp @@ -1,744 +1,767 @@ -// Copyright (C) 2004, 2008 International Business Machines and others. -// All Rights Reserved. -// This code is published under the Common Public License. -// -// $Id: IpVector.hpp 1316 2008-09-10 18:42:05Z andreasw $ -// -// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -#ifndef __IPVECTOR_HPP__ -#define __IPVECTOR_HPP__ - -#include "IpTypes.hpp" -#include "IpTaggedObject.hpp" -#include "IpCachedResults.hpp" -#include "IpSmartPtr.hpp" -#include "IpJournalist.hpp" -#include "IpException.hpp" - -#include - -namespace Ipopt -{ - /** Exception that can be used to flag unimplemented linear algebra - * methods */ - DECLARE_STD_EXCEPTION(UNIMPLEMENTED_LINALG_METHOD_CALLED); - - /* forward declarations */ - class VectorSpace; - - /** Vector Base Class. - * This is the base class for all derived vector types. Those vectors - * are meant to store entities like iterates, Lagrangian multipliers, - * constraint values etc. The implementation of a vector type depends - * on the computational environment (e.g. just a double array on a shared - * memory machine, or distributed double arrays for a distributed - * memory machine.) - * - * Deriving from Vector: This class inherits from tagged object to - * implement an advanced caching scheme. Because of this, the - * TaggedObject method ObjectChanged() must be called each time the - * Vector changes. If you overload the XXXX_Impl protected methods, - * this taken care of (along with caching if possible) for you. If - * you have additional methods in your derived class that change the - * underlying data (vector values), you MUST remember to call - * ObjectChanged() AFTER making the change! - */ - class Vector : public TaggedObject - { - public: - /** @name Constructor/Destructor */ - //@{ - /** Constructor. It has to be given a pointer to the - * corresponding VectorSpace. - */ - Vector(const VectorSpace* owner_space); - - /** Destructor */ - virtual ~Vector(); - //@} - - /** Create new Vector of the same type with uninitialized data */ - Vector* MakeNew() const; - - /** Create new Vector of the same type and copy the data over */ - Vector* MakeNewCopy() const; - - /**@name Standard BLAS-1 Operations - * (derived classes do NOT overload these - * methods, instead, overload the - * protected versions of these methods). */ - //@{ - /** Copy the data of the vector x into this vector (DCOPY). */ - void Copy(const Vector& x); - - /** Scales the vector by scalar alpha (DSCAL) */ - void Scal(Number alpha); - - /** Add the multiple alpha of vector x to this vector (DAXPY) */ - void Axpy(Number alpha, const Vector &x); - - /** Computes inner product of vector x with this (DDOT) */ - Number Dot(const Vector &x) const; - - /** Computes the 2-norm of this vector (DNRM2) */ - Number Nrm2() const; - - /** Computes the 1-norm of this vector (DASUM) */ - Number Asum() const; - - /** Computes the max-norm of this vector (based on IDAMAX) */ - Number Amax() const; - //@} - - /** @name Additional (Non-BLAS) Vector Methods - * (derived classes do NOT overload these - * methods, instead, overload the - * protected versions of these methods). */ - //@{ - /** Set each element in the vector to the scalar alpha. */ - void Set(Number alpha); - - /** Element-wise division \f$y_i \gets y_i/x_i\f$*/ - void ElementWiseDivide(const Vector& x); - - /** Element-wise multiplication \f$y_i \gets y_i*x_i\f$ */ - void ElementWiseMultiply(const Vector& x); - - /** Element-wise max against entries in x */ - void ElementWiseMax(const Vector& x); - - /** Element-wise min against entries in x */ - void ElementWiseMin(const Vector& x); - - /** Reciprocates the entries in the vector */ - void ElementWiseReciprocal(); - - /** Absolute values of the entries in the vector */ - void ElementWiseAbs(); - - /** Element-wise square root of the entries in the vector */ - void ElementWiseSqrt(); - - /** Replaces the vector values with their sgn values - ( -1 if x_i < 0, 0 if x_i == 0, and 1 if x_i > 0) - */ - void ElementWiseSgn(); - - /** Add scalar to every vector component */ - void AddScalar(Number scalar); - - /** Returns the maximum value in the vector */ - Number Max() const; - - /** Returns the minimum value in the vector */ - Number Min() const; - - /** Returns the sum of the vector entries */ - Number Sum() const; - - /** Returns the sum of the logs of each vector entry */ - Number SumLogs() const; - //@} - - /** @name Methods for specialized operations. A prototype - * implementation is provided, but for efficient implementation - * those should be specially implemented. - */ - //@{ - /** Add one vector, y = a * v1 + c * y. This is automatically - * reduced to call AddTwoVectors. */ - void AddOneVector(Number a, const Vector& v1, Number c); - - /** Add two vectors, y = a * v1 + b * v2 + c * y. Here, this - * vector is y */ - void AddTwoVectors(Number a, const Vector& v1, - Number b, const Vector& v2, Number c); - /** Fraction to the boundary parameter. Computes \f$\alpha = - * \max\{\bar\alpha\in(0,1] : x + \bar\alpha \Delta \geq (1-\tau)x\}\f$ - */ - Number FracToBound(const Vector& delta, Number tau) const; - /** Add the quotient of two vectors, y = a * z/s + c * y. */ - void AddVectorQuotient(Number a, const Vector& z, const Vector& s, - Number c); - //@} - - /** Method for determining if all stored numbers are valid (i.e., - * no Inf or Nan). */ - bool HasValidNumbers() const; - - /** @name Accessor methods */ - //@{ - /** Dimension of the Vector */ - Index Dim() const; - - /** Return the owner VectorSpace*/ - SmartPtr OwnerSpace() const; - //@} - - /** @name Output methods - * (derived classes do NOT overload these - * methods, instead, overload the - * protected versions of these methods). */ - //@{ - /** Print the entire vector */ - void Print(SmartPtr jnlst, - EJournalLevel level, - EJournalCategory category, - const std::string& name, - Index indent=0, - const std::string& prefix="") const; - void Print(const Journalist& jnlst, - EJournalLevel level, - EJournalCategory category, - const std::string& name, - Index indent=0, - const std::string& prefix="") const; - //@} - - protected: - /** @name implementation methods (derived classes MUST - * overload these pure virtual protected methods.) - */ - //@{ - /** Copy the data of the vector x into this vector (DCOPY). */ - virtual void CopyImpl(const Vector& x)=0; - - /** Scales the vector by scalar alpha (DSCAL) */ - virtual void ScalImpl(Number alpha)=0; - - /** Add the multiple alpha of vector x to this vector (DAXPY) */ - virtual void AxpyImpl(Number alpha, const Vector &x)=0; - - /** Computes inner product of vector x with this (DDOT) */ - virtual Number DotImpl(const Vector &x) const =0; - - /** Computes the 2-norm of this vector (DNRM2) */ - virtual Number Nrm2Impl() const =0; - - /** Computes the 1-norm of this vector (DASUM) */ - virtual Number AsumImpl() const =0; - - /** Computes the max-norm of this vector (based on IDAMAX) */ - virtual Number AmaxImpl() const =0; - - /** Set each element in the vector to the scalar alpha. */ - virtual void SetImpl(Number alpha)=0; - - /** Element-wise division \f$y_i \gets y_i/x_i\f$*/ - virtual void ElementWiseDivideImpl(const Vector& x)=0; - - /** Element-wise multiplication \f$y_i \gets y_i*x_i\f$ */ - virtual void ElementWiseMultiplyImpl(const Vector& x)=0; - - /** Element-wise max against entries in x */ - virtual void ElementWiseMaxImpl(const Vector& x)=0; - - /** Element-wise min against entries in x */ - virtual void ElementWiseMinImpl(const Vector& x)=0; - - /** Reciprocates the elements of the vector */ - virtual void ElementWiseReciprocalImpl()=0; - - /** Take elementwise absolute values of the elements of the vector */ - virtual void ElementWiseAbsImpl()=0; - - /** Take elementwise square-root of the elements of the vector */ - virtual void ElementWiseSqrtImpl()=0; - - /** Replaces entries with sgn of the entry */ - virtual void ElementWiseSgnImpl()=0; - - /** Add scalar to every component of vector */ - virtual void AddScalarImpl(Number scalar)=0; - - /** Max value in the vector */ - virtual Number MaxImpl() const=0; - - /** Min number in the vector */ - virtual Number MinImpl() const=0; - - /** Sum of entries in the vector */ - virtual Number SumImpl() const=0; - - /** Sum of logs of entries in the vector */ - virtual Number SumLogsImpl() const=0; - - /** Add two vectors (a * v1 + b * v2). Result is stored in this - vector. */ - virtual void AddTwoVectorsImpl(Number a, const Vector& v1, - Number b, const Vector& v2, Number c); - - /** Fraction to boundary parameter. */ - virtual Number FracToBoundImpl(const Vector& delta, Number tau) const; - - /** Add the quotient of two vectors */ - virtual void AddVectorQuotientImpl(Number a, const Vector& z, - const Vector& s, Number c); - - /** Method for determining if all stored numbers are valid (i.e., - * no Inf or Nan). A default implementation using Asum is - * provided. */ - virtual bool HasValidNumbersImpl() const; - - /** Print the entire vector */ - virtual void PrintImpl(const Journalist& jnlst, - EJournalLevel level, - EJournalCategory category, - const std::string& name, - Index indent, - const std::string& prefix) const =0; - //@} - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default constructor */ - Vector(); - - /** Copy constructor */ - Vector(const Vector&); - - /** Overloaded Equals Operator */ - Vector& operator=(const Vector&); - //@} - - /** Vector Space */ - const SmartPtr owner_space_; - - /**@name CachedResults data members */ - //@{ - /** Cache for dot products */ - mutable CachedResults dot_cache_; - - mutable TaggedObject::Tag nrm2_cache_tag_; - mutable Number cached_nrm2_; - - mutable TaggedObject::Tag asum_cache_tag_; - mutable Number cached_asum_; - - mutable TaggedObject::Tag amax_cache_tag_; - mutable Number cached_amax_; - - mutable TaggedObject::Tag max_cache_tag_; - mutable Number cached_max_; - - mutable TaggedObject::Tag min_cache_tag_; - mutable Number cached_min_; - - mutable TaggedObject::Tag sum_cache_tag_; - mutable Number cached_sum_; - - mutable TaggedObject::Tag sumlogs_cache_tag_; - mutable Number cached_sumlogs_; - - mutable TaggedObject::Tag valid_cache_tag_; - mutable bool cached_valid_; - - // AW: I removed this cache since it gets in the way for the - // quality function search - // /** Cache for FracToBound */ - // mutable CachedResults frac_to_bound_cache_; - //@} - - }; - - /** VectorSpace base class, corresponding to the Vector base class. - * For each Vector implementation, a corresponding VectorSpace has - * to be implemented. A VectorSpace is able to create new Vectors - * of a specific type. The VectorSpace should also store - * information that is common to all Vectors of that type. For - * example, the dimension of a Vector is stored in the VectorSpace - * base class. - */ - class VectorSpace : public ReferencedObject - { - public: - /** @name Constructors/Destructors */ - //@{ - /** Constructor, given the dimension of all vectors generated by - * this VectorSpace. - */ - VectorSpace(Index dim); - - /** Destructor */ - virtual ~VectorSpace() - {} - //@} - - /** Pure virtual method for creating a new Vector of the - * corresponding type. - */ - virtual Vector* MakeNew() const=0; - - /** Accessor function for the dimension of the vectors of this type.*/ - Index Dim() const - { - return dim_; - } - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** default constructor */ - VectorSpace(); - - /** Copy constructor */ - VectorSpace(const VectorSpace&); - - /** Overloaded Equals Operator */ - VectorSpace& operator=(const VectorSpace&); - //@} - - /** Dimension of the vectors in this vector space. */ - const Index dim_; - }; - - /* inline methods */ - inline - Vector::~Vector() - {} - - inline - Vector::Vector(const VectorSpace* owner_space) - : - TaggedObject(), - owner_space_(owner_space), - dot_cache_(10), - nrm2_cache_tag_(0), - asum_cache_tag_(0), - amax_cache_tag_(0), - max_cache_tag_(0), - min_cache_tag_(0), - sum_cache_tag_(0), - sumlogs_cache_tag_(0), - cached_valid_(0) - { - DBG_ASSERT(IsValid(owner_space_)); - } - - inline - Vector* Vector::MakeNew() const - { - return owner_space_->MakeNew(); - } - - inline - Vector* Vector::MakeNewCopy() const - { - // ToDo: We can probably copy also the cached values for Norms etc here - Vector* copy = MakeNew(); - copy->Copy(*this); - return copy; - } - - inline - void Vector::Copy(const Vector& x) - { - CopyImpl(x); - ObjectChanged(); - // Also copy any cached scalar values from the original vector - // ToDo: Check if that is too much overhead - TaggedObject::Tag x_tag = x.GetTag(); - if (x_tag == x.nrm2_cache_tag_) { - nrm2_cache_tag_ = GetTag(); - cached_nrm2_ = x.cached_nrm2_; - } - if (x_tag == x.asum_cache_tag_) { - asum_cache_tag_ = GetTag(); - cached_asum_ = x.cached_asum_; - } - if (x_tag == x.amax_cache_tag_) { - amax_cache_tag_ = GetTag(); - cached_amax_ = x.cached_amax_; - } - if (x_tag == x.max_cache_tag_) { - max_cache_tag_ = GetTag(); - cached_max_ = x.cached_max_; - } - if (x_tag == x.min_cache_tag_) { - min_cache_tag_ = GetTag(); - cached_min_ = x.cached_min_; - } - if (x_tag == x.sum_cache_tag_) { - sum_cache_tag_ = GetTag(); - cached_sum_ = x.cached_sum_; - } - if (x_tag == x.sumlogs_cache_tag_) { - sumlogs_cache_tag_ = GetTag(); - cached_sumlogs_ = x.cached_sumlogs_; - } - } - - inline - void Vector::Axpy(Number alpha, const Vector &x) - { - AxpyImpl(alpha, x); - ObjectChanged(); - } - - inline - Number Vector::Dot(const Vector &x) const - { - // The current implementation of the caching doesn't allow to have - // a dependency of something with itself. Therefore, we use the - // Nrm2 method if the dot product is to be taken with the vector - // itself. Might be more efficient anyway. - if (this==&x) { - Number nrm2 = Nrm2(); - return nrm2*nrm2; - } - Number retValue; - if (!dot_cache_.GetCachedResult2Dep(retValue, this, &x)) { - retValue = DotImpl(x); - dot_cache_.AddCachedResult2Dep(retValue, this, &x); - } - return retValue; - } - - inline - Number Vector::Nrm2() const - { - if (nrm2_cache_tag_ != GetTag()) { - cached_nrm2_ = Nrm2Impl(); - nrm2_cache_tag_ = GetTag(); - } - return cached_nrm2_; - } - - inline - Number Vector::Asum() const - { - if (asum_cache_tag_ != GetTag()) { - cached_asum_ = AsumImpl(); - asum_cache_tag_ = GetTag(); - } - return cached_asum_; - } - - inline - Number Vector::Amax() const - { - if (amax_cache_tag_ != GetTag()) { - cached_amax_ = AmaxImpl(); - amax_cache_tag_ = GetTag(); - } - return cached_amax_; - } - - inline - Number Vector::Sum() const - { - if (sum_cache_tag_ != GetTag()) { - cached_sum_ = SumImpl(); - sum_cache_tag_ = GetTag(); - } - return cached_sum_; - } - - inline - Number Vector::SumLogs() const - { - if (sumlogs_cache_tag_ != GetTag()) { - cached_sumlogs_ = SumLogsImpl(); - sumlogs_cache_tag_ = GetTag(); - } - return cached_sumlogs_; - } - - inline - void Vector::ElementWiseSgn() - { - ElementWiseSgnImpl(); - ObjectChanged(); - } - - inline - void Vector::Set(Number alpha) - { - // Could initialize caches here - SetImpl(alpha); - ObjectChanged(); - } - - inline - void Vector::ElementWiseDivide(const Vector& x) - { - ElementWiseDivideImpl(x); - ObjectChanged(); - } - - inline - void Vector::ElementWiseMultiply(const Vector& x) - { - ElementWiseMultiplyImpl(x); - ObjectChanged(); - } - - inline - void Vector::ElementWiseReciprocal() - { - ElementWiseReciprocalImpl(); - ObjectChanged(); - } - - inline - void Vector::ElementWiseMax(const Vector& x) - { - // Could initialize some caches here - ElementWiseMaxImpl(x); - ObjectChanged(); - } - - inline - void Vector::ElementWiseMin(const Vector& x) - { - // Could initialize some caches here - ElementWiseMinImpl(x); - ObjectChanged(); - } - - inline - void Vector::ElementWiseAbs() - { - // Could initialize some caches here - ElementWiseAbsImpl(); - ObjectChanged(); - } - - inline - void Vector::ElementWiseSqrt() - { - ElementWiseSqrtImpl(); - ObjectChanged(); - } - - inline - void Vector::AddScalar(Number scalar) - { - // Could initialize some caches here - AddScalarImpl(scalar); - ObjectChanged(); - } - - inline - Number Vector::Max() const - { - if (max_cache_tag_ != GetTag()) { - cached_max_ = MaxImpl(); - max_cache_tag_ = GetTag(); - } - return cached_max_; - } - - inline - Number Vector::Min() const - { - if (min_cache_tag_ != GetTag()) { - cached_min_ = MinImpl(); - min_cache_tag_ = GetTag(); - } - return cached_min_; - } - - inline - void Vector::AddOneVector(Number a, const Vector& v1, Number c) - { - AddTwoVectors(a, v1, 0., v1, c); - } - - inline - void Vector::AddTwoVectors(Number a, const Vector& v1, - Number b, const Vector& v2, Number c) - { - AddTwoVectorsImpl(a, v1, b, v2, c); - ObjectChanged(); - } - - inline - Number Vector::FracToBound(const Vector& delta, Number tau) const - { - /* AW: I avoid the caching here, since it leads to overhead in the - quality function search. Caches for this are in - CalculatedQuantities. - Number retValue; - std::vector tdeps(1); - tdeps[0] = δ - std::vector sdeps(1); - sdeps[0] = tau; - if (!frac_to_bound_cache_.GetCachedResult(retValue, tdeps, sdeps)) { - retValue = FracToBoundImpl(delta, tau); - frac_to_bound_cache_.AddCachedResult(retValue, tdeps, sdeps); - } - return retValue; - */ - return FracToBoundImpl(delta, tau); - } - - inline - void Vector::AddVectorQuotient(Number a, const Vector& z, - const Vector& s, Number c) - { - AddVectorQuotientImpl(a, z, s, c); - ObjectChanged(); - } - - inline - bool Vector::HasValidNumbers() const - { - if (valid_cache_tag_ != GetTag()) { - cached_valid_ = HasValidNumbersImpl(); - valid_cache_tag_ = GetTag(); - } - return cached_valid_; - } - - inline - Index Vector::Dim() const - { - return owner_space_->Dim(); - } - - inline - SmartPtr Vector::OwnerSpace() const - { - return owner_space_; - } - - inline - VectorSpace::VectorSpace(Index dim) - : - dim_(dim) - {} - -} // namespace Ipopt - -// Macro definitions for debugging vectors -#if COIN_IPOPT_VERBOSITY == 0 -# define DBG_PRINT_VECTOR(__verbose_level, __vec_name, __vec) -#else -# define DBG_PRINT_VECTOR(__verbose_level, __vec_name, __vec) \ - if (dbg_jrnl.Verbosity() >= (__verbose_level)) { \ - if (dbg_jrnl.Jnlst()!=NULL) { \ - (__vec).Print(dbg_jrnl.Jnlst(), \ - J_ERROR, J_DBG, \ - __vec_name, \ - dbg_jrnl.IndentationLevel()*2, \ - "# "); \ - } \ - } -#endif //if COIN_IPOPT_VERBOSITY == 0 - -#endif +// Copyright (C) 2004, 2008 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// $Id: IpVector.hpp 2276 2013-05-05 12:33:44Z stefan $ +// +// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 + +#ifndef __IPVECTOR_HPP__ +#define __IPVECTOR_HPP__ + +#include "IpTypes.hpp" +#include "IpTaggedObject.hpp" +#include "IpCachedResults.hpp" +#include "IpSmartPtr.hpp" +#include "IpJournalist.hpp" +#include "IpException.hpp" + +#include + +namespace Ipopt +{ + /** Exception that can be used to flag unimplemented linear algebra + * methods */ + DECLARE_STD_EXCEPTION(UNIMPLEMENTED_LINALG_METHOD_CALLED); + + /* forward declarations */ + class VectorSpace; + + /** Vector Base Class. + * This is the base class for all derived vector types. Those vectors + * are meant to store entities like iterates, Lagrangian multipliers, + * constraint values etc. The implementation of a vector type depends + * on the computational environment (e.g. just a double array on a shared + * memory machine, or distributed double arrays for a distributed + * memory machine.) + * + * Deriving from Vector: This class inherits from tagged object to + * implement an advanced caching scheme. Because of this, the + * TaggedObject method ObjectChanged() must be called each time the + * Vector changes. If you overload the XXXX_Impl protected methods, + * this taken care of (along with caching if possible) for you. If + * you have additional methods in your derived class that change the + * underlying data (vector values), you MUST remember to call + * ObjectChanged() AFTER making the change! + */ + class Vector : public TaggedObject + { + public: + /** @name Constructor/Destructor */ + //@{ + /** Constructor. It has to be given a pointer to the + * corresponding VectorSpace. + */ + inline + Vector(const VectorSpace* owner_space); + + /** Destructor */ + inline + virtual ~Vector(); + //@} + + /** Create new Vector of the same type with uninitialized data */ + inline + Vector* MakeNew() const; + + /** Create new Vector of the same type and copy the data over */ + inline + Vector* MakeNewCopy() const; + + /**@name Standard BLAS-1 Operations + * (derived classes do NOT overload these + * methods, instead, overload the + * protected versions of these methods). */ + //@{ + /** Copy the data of the vector x into this vector (DCOPY). */ + inline + void Copy(const Vector& x); + + /** Scales the vector by scalar alpha (DSCAL) */ + void Scal(Number alpha); + + /** Add the multiple alpha of vector x to this vector (DAXPY) */ + inline + void Axpy(Number alpha, const Vector &x); + + /** Computes inner product of vector x with this (DDOT) */ + inline + Number Dot(const Vector &x) const; + + /** Computes the 2-norm of this vector (DNRM2) */ + inline + Number Nrm2() const; + + /** Computes the 1-norm of this vector (DASUM) */ + inline + Number Asum() const; + + /** Computes the max-norm of this vector (based on IDAMAX) */ + inline + Number Amax() const; + //@} + + /** @name Additional (Non-BLAS) Vector Methods + * (derived classes do NOT overload these + * methods, instead, overload the + * protected versions of these methods). */ + //@{ + /** Set each element in the vector to the scalar alpha. */ + inline + void Set(Number alpha); + + /** Element-wise division \f$y_i \gets y_i/x_i\f$*/ + inline + void ElementWiseDivide(const Vector& x); + + /** Element-wise multiplication \f$y_i \gets y_i*x_i\f$ */ + inline + void ElementWiseMultiply(const Vector& x); + + /** Element-wise max against entries in x */ + inline + void ElementWiseMax(const Vector& x); + + /** Element-wise min against entries in x */ + inline + void ElementWiseMin(const Vector& x); + + /** Reciprocates the entries in the vector */ + inline + void ElementWiseReciprocal(); + + /** Absolute values of the entries in the vector */ + inline + void ElementWiseAbs(); + + /** Element-wise square root of the entries in the vector */ + inline + void ElementWiseSqrt(); + + /** Replaces the vector values with their sgn values + ( -1 if x_i < 0, 0 if x_i == 0, and 1 if x_i > 0) + */ + inline + void ElementWiseSgn(); + + /** Add scalar to every vector component */ + inline + void AddScalar(Number scalar); + + /** Returns the maximum value in the vector */ + inline + Number Max() const; + + /** Returns the minimum value in the vector */ + inline + Number Min() const; + + /** Returns the sum of the vector entries */ + inline + Number Sum() const; + + /** Returns the sum of the logs of each vector entry */ + inline + Number SumLogs() const; + //@} + + /** @name Methods for specialized operations. A prototype + * implementation is provided, but for efficient implementation + * those should be specially implemented. + */ + //@{ + /** Add one vector, y = a * v1 + c * y. This is automatically + * reduced to call AddTwoVectors. */ + inline + void AddOneVector(Number a, const Vector& v1, Number c); + + /** Add two vectors, y = a * v1 + b * v2 + c * y. Here, this + * vector is y */ + inline void AddTwoVectors(Number a, const Vector& v1, + Number b, const Vector& v2, Number c); + /** Fraction to the boundary parameter. Computes \f$\alpha = + * \max\{\bar\alpha\in(0,1] : x + \bar\alpha \Delta \geq (1-\tau)x\}\f$ + */ + inline + Number FracToBound(const Vector& delta, Number tau) const; + /** Add the quotient of two vectors, y = a * z/s + c * y. */ + inline + void AddVectorQuotient(Number a, const Vector& z, const Vector& s, + Number c); + //@} + + /** Method for determining if all stored numbers are valid (i.e., + * no Inf or Nan). */ + inline + bool HasValidNumbers() const; + + /** @name Accessor methods */ + //@{ + /** Dimension of the Vector */ + inline + Index Dim() const; + + /** Return the owner VectorSpace*/ + inline + SmartPtr OwnerSpace() const; + //@} + + /** @name Output methods + * (derived classes do NOT overload these + * methods, instead, overload the + * protected versions of these methods). */ + //@{ + /** Print the entire vector */ + void Print(SmartPtr jnlst, + EJournalLevel level, + EJournalCategory category, + const std::string& name, + Index indent=0, + const std::string& prefix="") const; + void Print(const Journalist& jnlst, + EJournalLevel level, + EJournalCategory category, + const std::string& name, + Index indent=0, + const std::string& prefix="") const; + //@} + + protected: + /** @name implementation methods (derived classes MUST + * overload these pure virtual protected methods.) + */ + //@{ + /** Copy the data of the vector x into this vector (DCOPY). */ + virtual void CopyImpl(const Vector& x)=0; + + /** Scales the vector by scalar alpha (DSCAL) */ + virtual void ScalImpl(Number alpha)=0; + + /** Add the multiple alpha of vector x to this vector (DAXPY) */ + virtual void AxpyImpl(Number alpha, const Vector &x)=0; + + /** Computes inner product of vector x with this (DDOT) */ + virtual Number DotImpl(const Vector &x) const =0; + + /** Computes the 2-norm of this vector (DNRM2) */ + virtual Number Nrm2Impl() const =0; + + /** Computes the 1-norm of this vector (DASUM) */ + virtual Number AsumImpl() const =0; + + /** Computes the max-norm of this vector (based on IDAMAX) */ + virtual Number AmaxImpl() const =0; + + /** Set each element in the vector to the scalar alpha. */ + virtual void SetImpl(Number alpha)=0; + + /** Element-wise division \f$y_i \gets y_i/x_i\f$*/ + virtual void ElementWiseDivideImpl(const Vector& x)=0; + + /** Element-wise multiplication \f$y_i \gets y_i*x_i\f$ */ + virtual void ElementWiseMultiplyImpl(const Vector& x)=0; + + /** Element-wise max against entries in x */ + virtual void ElementWiseMaxImpl(const Vector& x)=0; + + /** Element-wise min against entries in x */ + virtual void ElementWiseMinImpl(const Vector& x)=0; + + /** Reciprocates the elements of the vector */ + virtual void ElementWiseReciprocalImpl()=0; + + /** Take elementwise absolute values of the elements of the vector */ + virtual void ElementWiseAbsImpl()=0; + + /** Take elementwise square-root of the elements of the vector */ + virtual void ElementWiseSqrtImpl()=0; + + /** Replaces entries with sgn of the entry */ + virtual void ElementWiseSgnImpl()=0; + + /** Add scalar to every component of vector */ + virtual void AddScalarImpl(Number scalar)=0; + + /** Max value in the vector */ + virtual Number MaxImpl() const=0; + + /** Min number in the vector */ + virtual Number MinImpl() const=0; + + /** Sum of entries in the vector */ + virtual Number SumImpl() const=0; + + /** Sum of logs of entries in the vector */ + virtual Number SumLogsImpl() const=0; + + /** Add two vectors (a * v1 + b * v2). Result is stored in this + vector. */ + virtual void AddTwoVectorsImpl(Number a, const Vector& v1, + Number b, const Vector& v2, Number c); + + /** Fraction to boundary parameter. */ + virtual Number FracToBoundImpl(const Vector& delta, Number tau) const; + + /** Add the quotient of two vectors */ + virtual void AddVectorQuotientImpl(Number a, const Vector& z, + const Vector& s, Number c); + + /** Method for determining if all stored numbers are valid (i.e., + * no Inf or Nan). A default implementation using Asum is + * provided. */ + virtual bool HasValidNumbersImpl() const; + + /** Print the entire vector */ + virtual void PrintImpl(const Journalist& jnlst, + EJournalLevel level, + EJournalCategory category, + const std::string& name, + Index indent, + const std::string& prefix) const =0; + //@} + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default constructor */ + Vector(); + + /** Copy constructor */ + Vector(const Vector&); + + /** Overloaded Equals Operator */ + Vector& operator=(const Vector&); + //@} + + /** Vector Space */ + const SmartPtr owner_space_; + + /**@name CachedResults data members */ + //@{ + /** Cache for dot products */ + mutable CachedResults dot_cache_; + + mutable TaggedObject::Tag nrm2_cache_tag_; + mutable Number cached_nrm2_; + + mutable TaggedObject::Tag asum_cache_tag_; + mutable Number cached_asum_; + + mutable TaggedObject::Tag amax_cache_tag_; + mutable Number cached_amax_; + + mutable TaggedObject::Tag max_cache_tag_; + mutable Number cached_max_; + + mutable TaggedObject::Tag min_cache_tag_; + mutable Number cached_min_; + + mutable TaggedObject::Tag sum_cache_tag_; + mutable Number cached_sum_; + + mutable TaggedObject::Tag sumlogs_cache_tag_; + mutable Number cached_sumlogs_; + + mutable TaggedObject::Tag valid_cache_tag_; + mutable bool cached_valid_; + + // AW: I removed this cache since it gets in the way for the + // quality function search + // /** Cache for FracToBound */ + // mutable CachedResults frac_to_bound_cache_; + //@} + + }; + + /** VectorSpace base class, corresponding to the Vector base class. + * For each Vector implementation, a corresponding VectorSpace has + * to be implemented. A VectorSpace is able to create new Vectors + * of a specific type. The VectorSpace should also store + * information that is common to all Vectors of that type. For + * example, the dimension of a Vector is stored in the VectorSpace + * base class. + */ + class VectorSpace : public ReferencedObject + { + public: + /** @name Constructors/Destructors */ + //@{ + /** Constructor, given the dimension of all vectors generated by + * this VectorSpace. + */ + VectorSpace(Index dim); + + /** Destructor */ + virtual ~VectorSpace() + {} + //@} + + /** Pure virtual method for creating a new Vector of the + * corresponding type. + */ + virtual Vector* MakeNew() const=0; + + /** Accessor function for the dimension of the vectors of this type.*/ + Index Dim() const + { + return dim_; + } + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** default constructor */ + VectorSpace(); + + /** Copy constructor */ + VectorSpace(const VectorSpace&); + + /** Overloaded Equals Operator */ + VectorSpace& operator=(const VectorSpace&); + //@} + + /** Dimension of the vectors in this vector space. */ + const Index dim_; + }; + + /* inline methods */ + inline + Vector::~Vector() + {} + + inline + Vector::Vector(const VectorSpace* owner_space) + : + TaggedObject(), + owner_space_(owner_space), + dot_cache_(10), + cached_valid_(0) + { + DBG_ASSERT(IsValid(owner_space_)); + } + + inline + Vector* Vector::MakeNew() const + { + return owner_space_->MakeNew(); + } + + inline + Vector* Vector::MakeNewCopy() const + { + // ToDo: We can probably copy also the cached values for Norms etc here + Vector* copy = MakeNew(); + copy->Copy(*this); + return copy; + } + + inline + void Vector::Copy(const Vector& x) + { + CopyImpl(x); + ObjectChanged(); + // Also copy any cached scalar values from the original vector + // ToDo: Check if that is too much overhead + TaggedObject::Tag x_tag = x.GetTag(); + if (x_tag == x.nrm2_cache_tag_) { + nrm2_cache_tag_ = GetTag(); + cached_nrm2_ = x.cached_nrm2_; + } + if (x_tag == x.asum_cache_tag_) { + asum_cache_tag_ = GetTag(); + cached_asum_ = x.cached_asum_; + } + if (x_tag == x.amax_cache_tag_) { + amax_cache_tag_ = GetTag(); + cached_amax_ = x.cached_amax_; + } + if (x_tag == x.max_cache_tag_) { + max_cache_tag_ = GetTag(); + cached_max_ = x.cached_max_; + } + if (x_tag == x.min_cache_tag_) { + min_cache_tag_ = GetTag(); + cached_min_ = x.cached_min_; + } + if (x_tag == x.sum_cache_tag_) { + sum_cache_tag_ = GetTag(); + cached_sum_ = x.cached_sum_; + } + if (x_tag == x.sumlogs_cache_tag_) { + sumlogs_cache_tag_ = GetTag(); + cached_sumlogs_ = x.cached_sumlogs_; + } + } + + inline + void Vector::Axpy(Number alpha, const Vector &x) + { + AxpyImpl(alpha, x); + ObjectChanged(); + } + + inline + Number Vector::Dot(const Vector &x) const + { + // The current implementation of the caching doesn't allow to have + // a dependency of something with itself. Therefore, we use the + // Nrm2 method if the dot product is to be taken with the vector + // itself. Might be more efficient anyway. + if (this==&x) { + Number nrm2 = Nrm2(); + return nrm2*nrm2; + } + Number retValue; + if (!dot_cache_.GetCachedResult2Dep(retValue, this, &x)) { + retValue = DotImpl(x); + dot_cache_.AddCachedResult2Dep(retValue, this, &x); + } + return retValue; + } + + inline + Number Vector::Nrm2() const + { + if (nrm2_cache_tag_ != GetTag()) { + cached_nrm2_ = Nrm2Impl(); + nrm2_cache_tag_ = GetTag(); + } + return cached_nrm2_; + } + + inline + Number Vector::Asum() const + { + if (asum_cache_tag_ != GetTag()) { + cached_asum_ = AsumImpl(); + asum_cache_tag_ = GetTag(); + } + return cached_asum_; + } + + inline + Number Vector::Amax() const + { + if (amax_cache_tag_ != GetTag()) { + cached_amax_ = AmaxImpl(); + amax_cache_tag_ = GetTag(); + } + return cached_amax_; + } + + inline + Number Vector::Sum() const + { + if (sum_cache_tag_ != GetTag()) { + cached_sum_ = SumImpl(); + sum_cache_tag_ = GetTag(); + } + return cached_sum_; + } + + inline + Number Vector::SumLogs() const + { + if (sumlogs_cache_tag_ != GetTag()) { + cached_sumlogs_ = SumLogsImpl(); + sumlogs_cache_tag_ = GetTag(); + } + return cached_sumlogs_; + } + + inline + void Vector::ElementWiseSgn() + { + ElementWiseSgnImpl(); + ObjectChanged(); + } + + inline + void Vector::Set(Number alpha) + { + // Could initialize caches here + SetImpl(alpha); + ObjectChanged(); + } + + inline + void Vector::ElementWiseDivide(const Vector& x) + { + ElementWiseDivideImpl(x); + ObjectChanged(); + } + + inline + void Vector::ElementWiseMultiply(const Vector& x) + { + ElementWiseMultiplyImpl(x); + ObjectChanged(); + } + + inline + void Vector::ElementWiseReciprocal() + { + ElementWiseReciprocalImpl(); + ObjectChanged(); + } + + inline + void Vector::ElementWiseMax(const Vector& x) + { + // Could initialize some caches here + ElementWiseMaxImpl(x); + ObjectChanged(); + } + + inline + void Vector::ElementWiseMin(const Vector& x) + { + // Could initialize some caches here + ElementWiseMinImpl(x); + ObjectChanged(); + } + + inline + void Vector::ElementWiseAbs() + { + // Could initialize some caches here + ElementWiseAbsImpl(); + ObjectChanged(); + } + + inline + void Vector::ElementWiseSqrt() + { + ElementWiseSqrtImpl(); + ObjectChanged(); + } + + inline + void Vector::AddScalar(Number scalar) + { + // Could initialize some caches here + AddScalarImpl(scalar); + ObjectChanged(); + } + + inline + Number Vector::Max() const + { + if (max_cache_tag_ != GetTag()) { + cached_max_ = MaxImpl(); + max_cache_tag_ = GetTag(); + } + return cached_max_; + } + + inline + Number Vector::Min() const + { + if (min_cache_tag_ != GetTag()) { + cached_min_ = MinImpl(); + min_cache_tag_ = GetTag(); + } + return cached_min_; + } + + inline + void Vector::AddOneVector(Number a, const Vector& v1, Number c) + { + AddTwoVectors(a, v1, 0., v1, c); + } + + inline + void Vector::AddTwoVectors(Number a, const Vector& v1, + Number b, const Vector& v2, Number c) + { + AddTwoVectorsImpl(a, v1, b, v2, c); + ObjectChanged(); + } + + inline + Number Vector::FracToBound(const Vector& delta, Number tau) const + { + /* AW: I avoid the caching here, since it leads to overhead in the + quality function search. Caches for this are in + CalculatedQuantities. + Number retValue; + std::vector tdeps(1); + tdeps[0] = δ + std::vector sdeps(1); + sdeps[0] = tau; + if (!frac_to_bound_cache_.GetCachedResult(retValue, tdeps, sdeps)) { + retValue = FracToBoundImpl(delta, tau); + frac_to_bound_cache_.AddCachedResult(retValue, tdeps, sdeps); + } + return retValue; + */ + return FracToBoundImpl(delta, tau); + } + + inline + void Vector::AddVectorQuotient(Number a, const Vector& z, + const Vector& s, Number c) + { + AddVectorQuotientImpl(a, z, s, c); + ObjectChanged(); + } + + inline + bool Vector::HasValidNumbers() const + { + if (valid_cache_tag_ != GetTag()) { + cached_valid_ = HasValidNumbersImpl(); + valid_cache_tag_ = GetTag(); + } + return cached_valid_; + } + + inline + Index Vector::Dim() const + { + return owner_space_->Dim(); + } + + inline + SmartPtr Vector::OwnerSpace() const + { + return owner_space_; + } + + inline + VectorSpace::VectorSpace(Index dim) + : + dim_(dim) + {} + +} // namespace Ipopt + +// Macro definitions for debugging vectors +#if COIN_IPOPT_VERBOSITY == 0 +# define DBG_PRINT_VECTOR(__verbose_level, __vec_name, __vec) +#else +# define DBG_PRINT_VECTOR(__verbose_level, __vec_name, __vec) \ + if (dbg_jrnl.Verbosity() >= (__verbose_level)) { \ + if (dbg_jrnl.Jnlst()!=NULL) { \ + (__vec).Print(dbg_jrnl.Jnlst(), \ + J_ERROR, J_DBG, \ + __vec_name, \ + dbg_jrnl.IndentationLevel()*2, \ + "# "); \ + } \ + } +#endif //if COIN_IPOPT_VERBOSITY == 0 + +#endif diff --git a/thirdparty/windows/include/coin/IpoptConfig.h b/thirdparty/windows/include/coin/IpoptConfig.h index 2552d69..4413357 100644 --- a/thirdparty/windows/include/coin/IpoptConfig.h +++ b/thirdparty/windows/include/coin/IpoptConfig.h @@ -1,101 +1,46 @@ -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H -#endif -/* - * Include file for the configuration of Ipopt. - * - * On systems where the code is configured with the configure script - * (i.e., compilation is always done with HAVE_CONFIG_H defined), this - * header file includes the automatically generated header file, and - * undefines macros that might configure with other Config.h files. - * - * On systems that are compiled in other ways (e.g., with the - * Developer Studio), a header files is included to define those - * macros that depend on the operating system and the compiler. The - * macros that define the configuration of the particular user setting - * (e.g., presence of other COIN packages or third party code) are set - * here. The project maintainer needs to remember to update this file - * and choose reasonable defines. A user can modify the default - * setting by editing this file here. - * - */ - -#ifndef __IPOPTCONFIG_H__ -#define __IPOPTCONFIG_H__ - -#ifdef HAVE_CONFIG_H -#include "config_ipopt.h" - -/* undefine macros that could conflict with those in other config.h - files */ -#undef PACKAGE -#undef PACKAGE_BUGREPORT -#undef PACKAGE_NAME -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME -#undef PACKAGE_VERSION -#undef VERSION - -#else /* HAVE_CONFIG_H */ - -/* include the COIN-wide system specific configure header */ -#include "configall_system.h" - -#define IPOPT_VERSION "3.8.0" - -/***************************************************************************/ -/* HERE DEFINE THE CONFIGURATION SPECIFIC MACROS */ -/***************************************************************************/ - -/* Define to the debug sanity check level (0 is no test) */ -#define COIN_IPOPT_CHECKLEVEL 0 - -/* Define to the debug verbosity level (0 is no output) */ -#define COIN_IPOPT_VERBOSITY 0 - -/* If defined, the Ampl Solver Library is available. */ -#define COIN_HAS_ASL 1 - -/* If defined, the BLAS Library is available. */ -#define COIN_HAS_BLAS 1 - -/* Define to 1 if the Ipopt package is used */ -#define COIN_HAS_IPOPT 1 - -/* If defined, the LAPACK Library is available. */ -#define COIN_HAS_LAPACK 1 - -/* Define to 1 if the linear solver loader should be compiled to allow dynamic - loading of shared libraries with linear solvers */ -/* #undef HAVE_LINEARSOLVERLOADER */ - -/* Define to 1 if MA27 is available */ -#define HAVE_MA27 1 - -/* Define to 1 if MA57 is available */ -/* #undef HAVE_MA57 */ - -/* Define to 1 if MC19 is available */ -#define HAVE_MC19 1 - -/* Define to 1 if MUMPS is available */ -/* #undef HAVE_MUMPS */ - -/* Define to 1 if Pardiso is available */ -/* #undef HAVE_PARDISO */ - -/* Define to 1 if you are using the parallel version of Pardiso */ -/* #undef HAVE_PARDISO_PARALLEL */ - -/* Define to 1 if TAUCS is available */ -/* #undef HAVE_TAUCS */ - -/* Define to 1 if WSMP is available */ -/* #undef HAVE_WSMP */ - -#endif /* HAVE_CONFIG_H */ - -/* Type of Fortran integer translated into C */ -typedef FORTRAN_INTEGER_TYPE ipfint; - -#endif /*__IPOPTCONFIG_H__*/ +/* Copyright (C) 2011 + * All Rights Reserved. + * This code is published under the Eclipse Public License. + * + * $Id: IpoptConfig.h 2005 2011-06-06 12:55:16Z stefan $ + * + * Include file for the configuration of Ipopt. + * + * On systems where the code is configured with the configure script + * (i.e., compilation is always done with HAVE_CONFIG_H defined), this + * header file includes the automatically generated header file, and + * undefines macros that might configure with other Config.h files. + * + * On systems that are compiled in other ways (e.g., with the + * Developer Studio), a header files is included to define those + * macros that depend on the operating system and the compiler. The + * macros that define the configuration of the particular user setting + * (e.g., presence of other COIN-OR packages or third party code) are set + * by the files config_*default.h. The project maintainer needs to remember + * to update these file and choose reasonable defines. + * A user can modify the default setting by editing the config_*default.h files. + * + */ + +#ifndef __IPOPTCONFIG_H__ +#define __IPOPTCONFIG_H__ + +#ifdef HAVE_CONFIG_H + +#ifdef IPOPT_BUILD +#include "config.h" +#else +#include "config_ipopt.h" +#endif + +#else /* HAVE_CONFIG_H */ + +#ifdef IPOPT_BUILD +#include "config_default.h" +#else +#include "config_ipopt_default.h" +#endif + +#endif /* HAVE_CONFIG_H */ + +#endif /*__IPOPTCONFIG_H__*/ diff --git a/thirdparty/windows/include/coin/config_ipopt.h b/thirdparty/windows/include/coin/config_ipopt.h index 5de76c8..f3f5653 100644 --- a/thirdparty/windows/include/coin/config_ipopt.h +++ b/thirdparty/windows/include/coin/config_ipopt.h @@ -1,218 +1,6 @@ -/* inc/config_ipopt.h. Generated by configure. */ -/* inc/config_ipopt.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if the inexact linear solver option is included */ -/* #undef BUILD_INEXACT */ - -/* If defined, the Ampl Solver Library is available. */ -#define COIN_HAS_ASL 1 - -/* If defined, the BLAS Library is available. */ -#define COIN_HAS_BLAS 1 - -/* Define to 1 if the Ipopt package is used */ -#define COIN_HAS_IPOPT 1 - -/* If defined, the LAPACK Library is available. */ -#define COIN_HAS_LAPACK 1 - -/* If defined, the METIS library is available. */ -/* #undef COIN_HAS_METIS */ - -/* If defined, the MUMPS Library is available. */ -#define COIN_HAS_MUMPS 1 - -/* Define to the debug sanity check level (0 is no test) */ -#define COIN_IPOPT_CHECKLEVEL 0 - -/* Define to the debug verbosity level (0 is no output) */ -#define COIN_IPOPT_VERBOSITY 0 - -/* Define to dummy `main' function (if any) required to link to the Fortran - libraries. */ -/* #undef F77_DUMMY_MAIN */ - -/* Define to a macro mangling the given C identifier (in lower and upper - case), which must not contain underscores, for linking with Fortran. */ -#define F77_FUNC(name,NAME) name ## _ - -/* As F77_FUNC, but for C identifiers containing underscores. */ -#define F77_FUNC_(name,NAME) name ## __ - -/* Define if F77 and FC dummy `main' functions are identical. */ -/* #undef FC_DUMMY_MAIN_EQ_F77 */ - -/* Define to the C type corresponding to Fortran INTEGER */ -#define FORTRAN_INTEGER_TYPE int - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ASSERT_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_CASSERT 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_CCTYPE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_CFLOAT 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_CIEEEFP */ - -/* Define to 1 if you have the header file. */ -#define HAVE_CMATH 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_CSTDARG 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_CSTDIO 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_CSTDLIB 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_CSTRING 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_CTIME 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_CTYPE_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DLFCN_H */ - -/* Define to 1 if function drand48 is available */ -/* #undef HAVE_DRAND48 */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_FLOAT_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_IEEEFP_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_INTTYPES_H */ - -/* Define to 1 if the linear solver loader should be compiled to allow dynamic - loading of shared libaries with linear solvers */ -#define HAVE_LINEARSOLVERLOADER 1 - -/* Define to 1 if MA27 is available */ -/* #undef HAVE_MA27 */ - -/* Define to 1 if MA28 is available */ -/* #undef HAVE_MA28 */ - -/* Define to 1 if MA57 is available */ -/* #undef HAVE_MA57 */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MATH_H */ - -/* Define to 1 if MC19 is available */ -/* #undef HAVE_MC19 */ - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if Pardiso is available */ -/* #undef HAVE_PARDISO */ - -/* Define to 1 if you are using at least a 4.0 version of Pardiso */ -/* #undef HAVE_PARDISO_NEWINTERFACE */ - -/* Define to 1 if you are using the parallel version of Pardiso */ -/* #undef HAVE_PARDISO_PARALLEL */ - -/* Define to 1 if function rand is available */ -#define HAVE_RAND 1 - -/* Define to 1 if you have the `snprintf' function. */ -/* #undef HAVE_SNPRINTF */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STDARG_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STDINT_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STDIO_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if function std::rand is available */ -#define HAVE_STD__RAND 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STRINGS_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_TIME_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_UNISTD_H */ - -/* Define to 1 if va_copy is avaliable */ -/* #undef HAVE_VA_COPY */ - -/* Define to 1 if you have the `vsnprintf' function. */ -#define HAVE_VSNPRINTF 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_WINDOWS_H 1 - -/* Define to 1 if WSMP is available */ -/* #undef HAVE_WSMP */ - -/* Define to 1 if you have the `_snprintf' function. */ -#define HAVE__SNPRINTF 1 - -/* Define to 1 if you have the `_vsnprintf' function. */ -/* #undef HAVE__VSNPRINTF */ - -/* Define to be the name of C-function for NaNInf check */ -#define MY_C_FINITE _finite - -/* Name of package */ -#define PACKAGE "ipopt" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "http://projects.coin-or.org/Ipopt/newticket" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "Ipopt" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "Ipopt 3.8.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "ipopt" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "3.8.0" - -/* Set to extension for shared libraries in quotes. */ -#define SHAREDLIBEXT "dll" - -/* The size of a `int *', as computed by sizeof. */ -#define SIZEOF_INT_P 4 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "3.8.0" +#include "config_ipopt_default.h" + +/* Define to the C type corresponding to Fortran INTEGER */ +#ifndef FORTRAN_INTEGER_TYPE +#define FORTRAN_INTEGER_TYPE int +#endif diff --git a/thirdparty/windows/include/coin/config_ipopt_default.h b/thirdparty/windows/include/coin/config_ipopt_default.h new file mode 100644 index 0000000..5493dd6 --- /dev/null +++ b/thirdparty/windows/include/coin/config_ipopt_default.h @@ -0,0 +1,17 @@ + +/***************************************************************************/ +/* HERE DEFINE THE PROJECT SPECIFIC PUBLIC MACROS */ +/* These are only in effect in a setting that doesn't use configure */ +/***************************************************************************/ + +/* Version number of project */ +#define IPOPT_VERSION "3.11.0" + +/* Major Version number of project */ +#define IPOPT_VERSION_MAJOR 3 + +/* Minor Version number of project */ +#define IPOPT_VERSION_MINOR 11 + +/* Release Version number of project */ +#define IPOPT_VERSION_RELEASE 0 -- cgit