From fd86d04fdabb5719fff776af7dafe8f42dc39141 Mon Sep 17 00:00:00 2001 From: Harpreet Date: Wed, 16 Dec 2015 16:28:46 +0530 Subject: Bugs from lsqlin and lsqnonneg fixed --- demos/lsqnonneg.dem.sce | 2 +- jar/scilab_en_US_help.jar | Bin 214010 -> 214010 bytes macros/lsqlin.bin | Bin 51108 -> 51508 bytes macros/lsqlin.sci | 18 ++++++++++-------- macros/lsqnonneg.bin | Bin 23532 -> 23408 bytes macros/lsqnonneg.sci | 14 ++++++-------- macros/qpipoptmat.bin | Bin 50868 -> 51224 bytes macros/qpipoptmat.sci | 6 ++++-- sci_gateway/cpp/libFAMOS.so | Bin 122920 -> 122920 bytes sci_gateway/cpp/sci_ipopt.cpp | 2 +- 10 files changed, 22 insertions(+), 20 deletions(-) diff --git a/demos/lsqnonneg.dem.sce b/demos/lsqnonneg.dem.sce index f9d5d78..b61af0a 100644 --- a/demos/lsqnonneg.dem.sce +++ b/demos/lsqnonneg.dem.sce @@ -3,7 +3,7 @@ mode(1) // Demo of lsqnonneg.sci // -A basic lsqnonneg problem +// A basic lsqnonneg problem C = [ 0.0372 0.2869 0.6861 0.7071 diff --git a/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar index 1af3f90..3357bbb 100644 Binary files a/jar/scilab_en_US_help.jar and b/jar/scilab_en_US_help.jar differ diff --git a/macros/lsqlin.bin b/macros/lsqlin.bin index d86e0e1..801025f 100644 Binary files a/macros/lsqlin.bin and b/macros/lsqlin.bin differ diff --git a/macros/lsqlin.sci b/macros/lsqlin.sci index b990c08..4a5fa2d 100644 --- a/macros/lsqlin.sci +++ b/macros/lsqlin.sci @@ -320,18 +320,20 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin (varargin) [xopt,fopt,status,iter,Zl,Zu,lmbda] = solveqp(nbVar,nbCon,Q,p,conMatrix,conLB,conUB,LB,UB,x0,options); xopt = xopt'; - residual = C*xopt-d; + residual = -1*(C*xopt-d); resnorm = residual'*residual; exitflag = status; output = struct("Iterations" , []); output.Iterations = iter; - lambda = struct("lower" , [], .. - "upper" , [], .. - "constraint" , []); - - lambda.lower = Zl; - lambda.upper = Zu; - lambda.constraint = lmbda; + lambda = struct("lower" , [], .. + "upper" , [], .. + "eqlin" , [], .. + "ineqlin" , []); + + lambda.lower = Zl; + lambda.upper = Zu; + lambda.eqlin = lmbda(1:nbConEq); + lambda.ineqlin = lmbda(nbConEq+1:nbCon); select status case 0 then diff --git a/macros/lsqnonneg.bin b/macros/lsqnonneg.bin index e9e1295..cd8a04a 100644 Binary files a/macros/lsqnonneg.bin and b/macros/lsqnonneg.bin differ diff --git a/macros/lsqnonneg.sci b/macros/lsqnonneg.sci index c65b1ba..77e5e44 100644 --- a/macros/lsqnonneg.sci +++ b/macros/lsqnonneg.sci @@ -134,18 +134,16 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg (varargin) [xopt,fopt,status,iter,Zl,Zu,lmbda] = solveqp(nbVar,nbCon,Q,p,conMatrix,conLB,conUB,LB,UB,x0,options); xopt = xopt'; - residual = C*xopt-d; + residual = -1*(C*xopt-d); resnorm = residual'*residual; exitflag = status; output = struct("Iterations" , []); output.Iterations = iter; - lambda = struct("lower" , [], .. - "upper" , [], .. - "constraint" , []); - - lambda.lower = Zl; - lambda.upper = Zu; - lambda.constraint = lmbda; + lambda = struct("lower" , [], .. + "upper" , []); + + lambda.lower = Zl; + lambda.upper = Zu; select status case 0 then diff --git a/macros/qpipoptmat.bin b/macros/qpipoptmat.bin index 98ec979..7a37d9a 100644 Binary files a/macros/qpipoptmat.bin and b/macros/qpipoptmat.bin differ diff --git a/macros/qpipoptmat.sci b/macros/qpipoptmat.sci index 4b8e427..3f58e70 100644 --- a/macros/qpipoptmat.sci +++ b/macros/qpipoptmat.sci @@ -336,11 +336,13 @@ function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin) output.Iterations = iter; lambda = struct("lower" , [], .. "upper" , [], .. - "constraint" , []); + "eqlin" , [], .. + "ineqlin" , []); lambda.lower = Zl; lambda.upper = Zu; - lambda.constraint = lmbda; + lambda.eqlin = lmbda(1:nbConEq); + lambda.ineqlin = lmbda(nbConEq+1:nbCon); select status diff --git a/sci_gateway/cpp/libFAMOS.so b/sci_gateway/cpp/libFAMOS.so index f973a5b..d4464aa 100755 Binary files a/sci_gateway/cpp/libFAMOS.so and b/sci_gateway/cpp/libFAMOS.so differ diff --git a/sci_gateway/cpp/sci_ipopt.cpp b/sci_gateway/cpp/sci_ipopt.cpp index b8e94a4..7094615 100644 --- a/sci_gateway/cpp/sci_ipopt.cpp +++ b/sci_gateway/cpp/sci_ipopt.cpp @@ -233,7 +233,7 @@ int sci_solveqp(char *fname) return 1; } - if (returnDoubleMatrixToScilab(7, 1, 1, Lambda)) + if (returnDoubleMatrixToScilab(7, 1, nCons, Lambda)) { return 1; } -- cgit