exitflag=0 : Optimal Solution Found
diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS
index 4ae0096..8d14e4f 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 5ea5806..9642809 100644
Binary files a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB and b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB differ
diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS b/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS
index deb246c..070a255 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 88014cd..2019f3f 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 8dc6ddf..86fa674 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=1535 id2=1
+TMAP bs=2048 rt=1 fl=-1 id1=1532 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 d8580ce..d43293f 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 0f7fdc9..2981e47 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 @@
- << Symphony Toolbox
+ << FOSSEE Optimization Toolbox
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
@@ -29,7 +29,7 @@
- Symphony Toolbox >> Symphony Toolbox > fgoalattain
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fgoalattain
fgoalattain
@@ -37,51 +37,51 @@
Calling Sequence
- x = fgoalattain(fun,x0,goal,weight)
-x = fgoalattain(fun,x0,goal,weight,A,b)
-x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq)
-x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub)
-x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon)
-x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon,options)
-[x,fval] = fgoalattain(...)
-[x,fval,attainfactor] = fgoalattain(...)
-[x,fval,attainfactor,exitflag] = fgoalattain(...)
-[x,fval,attainfactor,exitflag,output] = fgoalattain(...)
-[x,fval,attainfactor,exitflag,output,lambda] = fgoalattain(...)
+ xopt = fgoalattain(fun,x0,goal,weight)
+xopt = fgoalattain(fun,x0,goal,weight,A,b)
+xopt = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq)
+xopt = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub)
+xopt = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon)
+xopt = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon,options)
+[xopt,fval] = fgoalattain(...)
+[xopt,fval,attainfactor] = fgoalattain(...)
+[xopt,fval,attainfactor,exitflag] = fgoalattain(...)
+[xopt,fval,attainfactor,exitflag,output] = fgoalattain(...)
+[xopt,fval,attainfactor,exitflag,output,lambda] = fgoalattain(...)
Parameters
- fun:
a function that accepts a vector x and returns a vector F
- - x0:
-
a nx1 or 1xn matrix of double, where n is the number of variables.
- - A:
-
a nil x n matrix of double, where n is the number of variables and
- - b:
-
a nil x 1 matrix of double, where nil is the number of linear
- - Aeq:
-
a nel x n matrix of double, where n is the number of variables
- - beq:
-
a nel x 1 matrix of double, where nel is the number of linear
- - lb:
-
a nx1 or 1xn matrix of double, where n is the number of variables.
- - ub:
-
a nx1 or 1xn matrix of double, where n is the number of variables.
+ - x0 :
+
a vector of double, contains initial guess of variables.
+ - A :
+
a matrix of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
+ - b :
+
a vector of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
+ - Aeq :
+
a matrix of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
+ - beq :
+
a vector of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
+ - lb :
+
a vector of double, contains lower bounds of the variables.
+ - ub :
+
a vector of double, contains upper bounds of the variables.
- nonlcon:
a function, the nonlinear constraints
- options :
a list, containing the option for user to specify. See below for details.
- - x:
-
a nx1 matrix of double, the computed solution of the optimization problem
- - fval:
-
a vector of double, the value of functions at x
+ - xopt :
+
a vector of double, the computed solution of the optimization problem.
+ - fopt :
+
a double, the value of the function at x.
- attainfactor:
The amount of over- or underachievement of the goals,γ at the solution.
- - exitflag:
-
a 1x1 matrix of floating point integers, the exit status
- - output:
-
a struct, the details of the optimization process
- - lambda:
-
a struct, the Lagrange multipliers at optimum
+ exitflag :
+ The exit status. See below for details.
+ output :
+ The structure consist of statistics about the optimization. See below for details.
+ lambda :
+ The structure consist of the Lagrange multipliers at the solution of problem. See below for details.
Description
fgoalattain solves the goal attainment problem, which is one formulation for minimizing a multiobjective optimization problem.
@@ -102,14 +102,14 @@ It should be defined as type "list" and contains the following field
GradObj : a function, representing the gradient function of the Objective in Vector Form.
GradCon : a function, representing the gradient of the Non-Linear Constraints (both Equality and Inequality) of the problem. It is declared in such a way that gradient of non-linear inequality constraints are defined first as a separate Matrix (cg of size m2 X n or as an empty), followed by gradient of non-linear equality constraints as a separate Matrix (ceqg of size m2 X n or as an empty) where m2 & m3 are number of non-linear inequality and equality constraints respectively.
Default Values : options = list("MaxIter", [3000], "CpuTime", [600]);
- By default, the gradient options for fminimax are turned off and and fmincon does the gradient opproximation of minmaxObjfun. In case the GradObj option is off and GradConstr option is on, fminimax approximates minmaxObjfun gradient using numderivative toolbox.
+ By default, the gradient options for fminimax are turned off and and fmincon does the gradient opproximation of gattainObjfun. In case the GradObj option is off and GradConstr option is on, fminimax approximates gattainObjfun gradient using numderivative toolbox.
If we can provide exact gradients, we should do so since it improves the convergence speed of the optimization algorithm.
Furthermore, we must enable the "GradObj" option with the statement :
minimaxOptions = list("GradObj",fGrad); |  |  | |
This will let fminimax know that the exact gradient of the objective function is known, so that it can change the calling sequence to the objective function. Note that, fGrad should be mentioned in the form of N x n where n is the number of variables, N is the number of functions in objective function.
The constraint function must have header :
[c, ceq] = confun(x) |  |  | |
-where x is a n x 1 matrix of dominmaxUbles, c is a 1 x nni matrix of doubles and ceq is a 1 x nne matrix of doubles (nni : number of nonlinear inequality constraints, nne : number of nonlinear equality constraints).
+where x is a n x 1 matrix of doubles, c is a 1 x nni matrix of doubles and ceq is a 1 x nne matrix of doubles (nni : number of nonlinear inequality constraints, nne : number of nonlinear equality constraints).
On input, the variable x contains the current point and, on output, the variable c must contain the nonlinear inequality constraints and ceq must contain the nonlinear equality constraints.
By default, the gradient options for fminimax are turned off and and fmincon does the gradient opproximation of confun. In case the GradObj option is on and GradCons option is off, fminimax approximates confun gradient using numderivative toolbox.
If we can provide exact gradients, we should do so since it improves the convergence speed of the optimization algorithm.
@@ -145,7 +145,7 @@ It has type "struct" and contains the following fields.
Examples
- function f1=fun(x)
+ function f1=gattainObjfun(x)
f1(1)=2*x(1)*x(1)+x(2)*x(2)-48*x(1)-40*x(2)+304
f1(2)=-x(1)*x(1)-3*x(2)*x(2)
f1(3)=x(1)+3*x(2)-18
@@ -153,14 +153,12 @@ It has type "struct" and contains the following fields.
f1(5)=x(1)+x(2)-8
endfunction
x0=[-1,1];
-
goal=[-5,-3,-2,-1,-4];
weight=abs(goal)
-
-
-
+
+
-[xopt,fval,attainfactor,exitflag,output,lambda]=fgoalattain(fun,x0,goal,weight) |  |  | |
+[x,fval,attainfactor,exitflag,output,lambda]=fgoalattain(gattainObjfun,x0,goal,weight) |  |  | |
Authors
- Prajwala TM, Sheetal Shalini , 2015
@@ -171,11 +169,11 @@ It has type "struct" and contains the following fields.
|
Report an issue |
- << Symphony Toolbox
+ << FOSSEE Optimization Toolbox
|
- Symphony 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 9b64d03..46755f8 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 @@
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
@@ -29,7 +29,7 @@
- Symphony Toolbox >> Symphony Toolbox > fminbnd
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fminbnd
fminbnd
@@ -114,7 +114,8 @@ It has type "struct" and contains the following fields.
options=list("MaxIter",[1500],"CpuTime", [100],"TolX",[1e-6])
- [x,fval] =fminbnd(f, x1, x2, options) |  |  | |
+[x,fval] =fminbnd(f, x1, x2, options)
+ |  | |
Examples
@@ -128,7 +129,8 @@ It has type "struct" and contains the following fields.
x1 = [0];
x2 = [1000];
-[x,fval,exitflag,output,lambda] =fminbnd(f, x1, x2) |  |  | |
+[x,fval,exitflag,output,lambda] =fminbnd(f, x1, x2)
+ |  | |
Examples
@@ -160,7 +162,7 @@ It has type "struct" and contains the following fields.
|
- Symphony 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 b2b5ca4..ea3077f 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 @@
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
@@ -29,7 +29,7 @@
- Symphony Toolbox >> Symphony Toolbox > fmincon
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fmincon
fmincon
@@ -159,7 +159,8 @@ It has type "struct" and contains the following fields.
options=list("GradObj", fGrad, "Hessian", lHess);
- [x,fval,exitflag,output,lambda,grad,hessian] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options) |  |  | |
+[x,fval,exitflag,output,lambda,grad,hessian] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options)
+ |  | |
Examples
@@ -200,7 +201,8 @@ It has type "struct" and contains the following fields.
options=list("MaxIter", [1500], "CpuTime", [500], "GradObj", fGrad, "Hessian", lHess,"GradCon", cGrad);
-[x,fval,exitflag,output] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options) |  |  | |
+[x,fval,exitflag,output] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options)
+ |  | |
Examples
@@ -225,7 +227,8 @@ It has type "struct" and contains the following fields.
options=list("MaxIter", [1500], "CpuTime", [500]);
-[x,fval,exitflag,output,lambda,grad,hessian] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,[],options) |  |  | |
+[x,fval,exitflag,output,lambda,grad,hessian] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,[],options)
+ |  | |
Examples
@@ -288,7 +291,7 @@ It has type "struct" and contains the following fields.
|
- Symphony 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 2d086ff..a701aa7 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 @@
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
@@ -29,7 +29,7 @@
- Symphony Toolbox >> Symphony Toolbox > fminimax
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fminimax
fminimax
@@ -37,51 +37,49 @@
Calling Sequence
- x = fminimax(fun,x0)
-x = fminimax(fun,x0,A,b)
-x = fminimax(fun,x0,A,b,Aeq,beq)
-x = fminimax(fun,x0,A,b,Aeq,beq,lb,ub)
-x = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfun)
-x = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfun,options)
-[x, fval] = fmincon(.....)
-[x, fval, maxfval]= fmincon(.....)
-[x, fval, maxfval, exitflag]= fmincon(.....)
-[x, fval, maxfval, exitflag, output]= fmincon(.....)
-[x, fval, maxfval, exitflag, output, lambda]= fmincon(.....)
+ xopt = fminimax(fun,x0)
+xopt = fminimax(fun,x0,A,b)
+xopt = fminimax(fun,x0,A,b,Aeq,beq)
+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(.....)
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.
- - x0:
-
a nx1 or 1xn matrix of doubles, where n is the number of variables, the initial guess for the optimization algorithm
- - A:
-
a nil x n matrix of doubles, where n is the number of variables and nil is the number of linear inequalities. If A==[] and b==[], it is assumed that there is no linear inequality constraints. If (A==[] & b<>[]), fminimax generates an error (the same happens if (A<>[] & b==[]))
- - b:
-
a nil x 1 matrix of doubles, where nil is the number of linear inequalities
- - Aeq:
-
a nel x n matrix of doubles, where n is the number of variables and nel is the number of linear equalities. If Aeq==[] and beq==[], it is assumed that there is no linear equality constraints. If (Aeq==[] & beq<>[]), fminimax generates an error (the same happens if (Aeq<>[] & beq==[]))
- - beq:
-
a nel x 1 matrix of doubles, where nel is the number of linear equalities
- - lb:
-
a nx1 or 1xn matrix of doubles, where n is the number of variables. The lower bound for x. If lb==[], then the lower bound is automatically set to -inf
- - ub:
-
a nx1 or 1xn matrix of doubles, where n is the number of variables. The upper bound for x. If ub==[], then the upper bound is automatically set to +inf
+ - x0 :
+
a vector of double, contains initial guess of variables.
+ - A :
+
a matrix of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
+ - b :
+
a vector of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
+ - Aeq :
+
a matrix of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
+ - beq :
+
a vector of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
+ - lb :
+
a vector of double, contains lower bounds of the variables.
+ - ub :
+
a vector of double, contains upper bounds of the variables.
- nonlinfun:
-
function that computes the nonlinear inequality constraints c(x) <= 0 and nonlinear equality constraints ceq(x) = 0.
- - x:
-
a nx1 matrix of doubles, the computed solution of the optimization problem
- - fval:
-
a vector of doubles, the value of fun at x
+ function that computes the nonlinear inequality constraints c⋅x ≤ 0 and nonlinear equality constraints c⋅x = 0.
+ - xopt :
+
a vector of double, the computed solution of the optimization problem.
+ - fopt :
+
a double, the value of the function at x.
- maxfval:
a 1x1 matrix of doubles, the maximum value in vector fval
- - exitflag:
-
a 1x1 matrix of floating point integers, the exit status
- - output:
-
a struct, the details of the optimization process
- - lambda:
-
a struct, the Lagrange multipliers at optimum
- - options:
-
a list, containing the option for user to specify. See below for details.
+ exitflag :
+ The exit status. See below for details.
+ output :
+ The structure consist of statistics about the optimization. See below for details.
+ lambda :
+ The structure consist of the Lagrange multipliers at the solution of problem. See below for details.
Description
fminimax minimizes the worst-case (largest) value of a set of multivariable functions, starting at an initial estimate. This is generally referred to as the minimax problem.
@@ -157,11 +155,11 @@ It has type "struct" and contains the following fields.
x0 = [0.1,0.1];
-
-
+ xopt = [4 4]
+ fopt = [0 -64 -2 -8 0]
maxfopt = 0
- [xopt,fopt,maxfval,exitflag,output,lambda] = fminimax(myfun, x0)
+ [x,fval,maxfval,exitflag,output,lambda] = fminimax(myfun, x0)
|  |  | |
Examples
@@ -206,11 +204,11 @@ It has type "struct" and contains the following fields.
x0 = [0,10];
-
-
+
xopt = [0.92791 7.93551]
+
fopt = [6.73443 -189.778 6.73443 -8.86342 0.86342]
maxfopt = 6.73443
-
[xopt,fopt,maxfval,exitflag,output] = fminimax(myfun,x0,[],[],[],[],[],[], confun, minimaxOptions) |  | |
+[x,fval,maxfval,exitflag,output] = fminimax(myfun,x0,[],[],[],[],[],[], confun, minimaxOptions) |  | |
@@ -225,7 +223,7 @@ It has type "struct" and contains the following fields.
- Symphony 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 7271567..636ea68 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 @@
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
@@ -29,7 +29,7 @@
- Symphony Toolbox >> Symphony Toolbox > fminunc
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > fminunc
fminunc
@@ -114,7 +114,8 @@ It has type "struct" and contains the following fields.
options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", fGrad, "Hessian", fHess);
- [xopt,fopt,exitflag,output,gradient,hessian]=fminunc(f,x0,options) |  |  | |
+[xopt,fopt,exitflag,output,gradient,hessian]=fminunc(f,x0,options)
+ |  | |
Examples
@@ -126,7 +127,8 @@ It has type "struct" and contains the following fields.
x0=[2,1];
-[xopt,fopt]=fminunc(f,x0) |  |  | |
+[xopt,fopt]=fminunc(f,x0)
+ |  | |
Examples
@@ -164,7 +166,7 @@ It has type "struct" and contains the following fields.
|
- Symphony 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 07b853a..7bbe95e 100644
--- a/help/en_US/scilab_en_US_help/index.html
+++ b/help/en_US/scilab_en_US_help/index.html
@@ -28,10 +28,10 @@
- Symphony Toolbox
-
+ FOSSEE Optimization Toolbox
+
-- Symphony Toolbox
+
- FOSSEE Optimization Toolbox
- fgoalattain — Solves a multiobjective goal attainment problem
diff --git a/help/en_US/scilab_en_US_help/jhelpset.hs b/help/en_US/scilab_en_US_help/jhelpset.hs
index 94c2e7e..373577e 100644
--- a/help/en_US/scilab_en_US_help/jhelpset.hs
+++ b/help/en_US/scilab_en_US_help/jhelpset.hs
@@ -2,7 +2,7 @@
-Symphony Toolbox
+FOSSEE Optimization Toolbox
top
diff --git a/help/en_US/scilab_en_US_help/jhelptoc.xml b/help/en_US/scilab_en_US_help/jhelptoc.xml
index 4422b0b..c4d5a12 100644
--- a/help/en_US/scilab_en_US_help/jhelptoc.xml
+++ b/help/en_US/scilab_en_US_help/jhelptoc.xml
@@ -1,8 +1,8 @@
-
-
+
+
diff --git a/help/en_US/scilab_en_US_help/linprog.html b/help/en_US/scilab_en_US_help/linprog.html
index 260b8b3..c47e448 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 @@
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
@@ -29,7 +29,7 @@
- Symphony Toolbox >> Symphony Toolbox > linprog
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > linprog
linprog
@@ -41,7 +41,8 @@
xopt = linprog(c,A,b,Aeq,beq)
xopt = linprog(c,A,b,Aeq,beq,lb,ub)
xopt = linprog(c,A,b,Aeq,beq,lb,ub,param)
-[xopt, fopt, exitflag, output, lambda] = linprog(file)
+xopt = linprog(file)
+xopt = linprog(file,param)
[xopt,fopt,exitflag,output,lambda] = linprog( ... )
Parameters
@@ -77,9 +78,14 @@
Description
OSI-CLP is used for solving the linear programming problems, OSI-CLP is a library written in C++.
Search the minimum of a constrained linear programming problem specified by :
-
-The routine calls Clp for solving the linear programming problem, Clp is a library written in C++.
- The exitflag allows to know the status of the optimization which is given back by Ipopt.
+ 
+ The routine calls Clp for solving the linear programming problem, Clp is a library written in C++.
+ The options allows the user to set various parameters of the Optimization problem.
+It should be defined as type "list" and contains the following fields. In the current version it only contains maxiter.
+ - Syntax : options= list("MaxIter", [---]);
+- MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take.
+- Default Values : options = list("MaxIter", [3000]);
+ The exitflag allows to know the status of the optimization which is given back by CLP.
- exitflag=0 : Optimal Solution Found
- exitflag=1 : Primal Infeasible
- exitflag=2 : Dual Infeasible
@@ -87,7 +93,6 @@ The routine calls Clp for solving the linear programming problem, Clp is a libra
- exitflag=4 : Solution Abandoned
- exitflag=5 : Primal objective limit reached.
- exitflag=6 : Dual objective limit reached.
- For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/
The output data structure contains detailed informations about the optimization process.
It has type "struct" and contains the following fields.
- output.iterations: The number of iterations performed during the search
@@ -95,9 +100,7 @@ It has type "struct" and contains the following fields.
The lambda data structure contains the Lagrange multipliers at the end
of optimization. In the current version the values are returned only when the the solution is optimal.
It has type "struct" and contains the following fields.
- - lambda.lower: The Lagrange multipliers for the lower bound constraints.
-- lambda.upper: The Lagrange multipliers for the upper bound constraints.
-- lambda.eqlin: The Lagrange multipliers for the linear equality constraints.
+- lambda.eqlin: The Lagrange multipliers for the linear equality constraints.
- lambda.ineqlin: The Lagrange multipliers for the linear inequality constraints.
@@ -159,7 +162,7 @@ It has type "struct" and contains the following fields.
Examples
filepath = get_absolute_file_path('linprog.dem.sce');
filepath = filepath + "exmip1.mps"
-[xopt,fopt,exitflag,output,lambda] =linprog(filepath); |  |  | |
+ [xopt,fopt,exitflag,output,lambda] =linprog(filepath) |  |  | |
Authors
- Bhanu Priya Sayal, Guru Pradeep Reddy
@@ -174,7 +177,7 @@ It has type "struct" and contains the following fields.
- Symphony 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 eb1b38d..1343385 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 @@
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
@@ -29,7 +29,7 @@
- Symphony Toolbox >> Symphony Toolbox > lsqlin
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > lsqlin
lsqlin
@@ -82,6 +82,12 @@
Search the minimum of a constrained linear least square problem specified by :

The routine calls Ipopt for solving the linear least square problem, Ipopt is a library written in C++.
+ The options allows the user to set various parameters of the Optimization problem.
+It should be defined as type "list" and contains the following fields.
+ - Syntax : options= list("MaxIter", [---], "CpuTime", [---]);
+- MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take.
+- CpuTime : a Scalar, containing the Maximum amount of CPU Time that the solver should take.
+- Default Values : options = list("MaxIter", [3000], "CpuTime", [600]);
The exitflag allows to know the status of the optimization which is given back by Ipopt.
- exitflag=0 : Optimal Solution Found
- exitflag=1 : Maximum Number of Iterations Exceeded. Output may not be optimal.
@@ -155,7 +161,7 @@ It has type "struct" and contains the following fields.
|
- Symphony 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 8de3559..a095226 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 @@
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
@@ -29,7 +29,7 @@
- Symphony Toolbox >> Symphony Toolbox > lsqnonneg
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > lsqnonneg
lsqnonneg
@@ -63,6 +63,12 @@
Solves nonnegative least-squares curve fitting problems specified by :

The routine calls Ipopt for solving the nonnegative least-squares curve fitting problems, Ipopt is a library written in C++.
+ The options allows the user to set various parameters of the Optimization problem.
+It should be defined as type "list" and contains the following fields.
+ - Syntax : options= list("MaxIter", [---], "CpuTime", [---]);
+- MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take.
+- CpuTime : a Scalar, containing the Maximum amount of CPU Time that the solver should take.
+- Default Values : options = list("MaxIter", [3000], "CpuTime", [600]);
The exitflag allows to know the status of the optimization which is given back by Ipopt.
- exitflag=0 : Optimal Solution Found
- exitflag=1 : Maximum Number of Iterations Exceeded. Output may not be optimal.
@@ -109,7 +115,7 @@ It has type "struct" and contains the following fields.
|
- Symphony 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 19b4e44..1a6911b 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 @@
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
@@ -29,7 +29,7 @@
- Symphony Toolbox >> Symphony Toolbox > qpipopt
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > qpipopt
qpipopt
@@ -80,6 +80,12 @@
Search the minimum of a constrained linear quadratic optimization problem specified by :

The routine calls Ipopt for solving the quadratic problem, Ipopt is a library written in C++.
+ The options allows the user to set various parameters of the Optimization problem.
+It should be defined as type "list" and contains the following fields.
+ - Syntax : options= list("MaxIter", [---], "CpuTime", [---]);
+- MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take.
+- CpuTime : a Scalar, containing the Maximum amount of CPU Time that the solver should take.
+- Default Values : options = list("MaxIter", [3000], "CpuTime", [600]);
The exitflag allows to know the status of the optimization which is given back by Ipopt.
- exitflag=0 : Optimal Solution Found
- exitflag=1 : Maximum Number of Iterations Exceeded. Output may not be optimal.
@@ -155,7 +161,7 @@ It has type "struct" and contains the following fields.
|
- Symphony 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 5a6a5b6..f5498bf 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 @@
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
@@ -29,7 +29,7 @@
- Symphony Toolbox >> Symphony Toolbox > qpipoptmat
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > qpipoptmat
qpipoptmat
@@ -70,8 +70,6 @@
a vector of double, the computed solution of the optimization problem.
fopt :
a double, the value of the function at x.
- residual :
- a vector of double, solution residuals returned as the vector d-C*x.
exitflag :
The exit status. See below for details.
output :
@@ -83,6 +81,12 @@
Search the minimum of a constrained linear quadratic optimization problem specified by :

The routine calls Ipopt for solving the quadratic problem, Ipopt is a library written in C++.
+ The options allows the user to set various parameters of the Optimization problem.
+It should be defined as type "list" and contains the following fields.
+ - Syntax : options= list("MaxIter", [---], "CpuTime", [---]);
+- MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take.
+- CpuTime : a Scalar, containing the Maximum amount of CPU Time that the solver should take.
+- Default Values : options = list("MaxIter", [3000], "CpuTime", [600]);
The exitflag allows to know the status of the optimization which is given back by Ipopt.
- exitflag=0 : Optimal Solution Found
- exitflag=1 : Maximum Number of Iterations Exceeded. Output may not be optimal.
@@ -153,7 +157,7 @@ It has type "struct" and contains the following fields.
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
diff --git a/help/en_US/scilab_en_US_help/section_19f4f1e5726c01d683e8b82be0a7e910.html b/help/en_US/scilab_en_US_help/section_19f4f1e5726c01d683e8b82be0a7e910.html
index 93c9617..b34093f 100644
--- a/help/en_US/scilab_en_US_help/section_19f4f1e5726c01d683e8b82be0a7e910.html
+++ b/help/en_US/scilab_en_US_help/section_19f4f1e5726c01d683e8b82be0a7e910.html
@@ -15,7 +15,7 @@
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
@@ -27,10 +27,10 @@
- Symphony Toolbox >> Symphony Toolbox
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
- fgoalattain — Solves a multiobjective goal attainment problem
@@ -339,7 +339,7 @@
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
diff --git a/help/en_US/scilab_en_US_help/section_508f0b211d17ea6769714cc144e6b731.html b/help/en_US/scilab_en_US_help/section_508f0b211d17ea6769714cc144e6b731.html
index cf8c746..b3b3135 100644
--- a/help/en_US/scilab_en_US_help/section_508f0b211d17ea6769714cc144e6b731.html
+++ b/help/en_US/scilab_en_US_help/section_508f0b211d17ea6769714cc144e6b731.html
@@ -16,7 +16,7 @@
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
@@ -28,7 +28,7 @@
- Symphony Toolbox >> Symphony Toolbox > Symphony Native Functions
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions
Symphony Native Functions
@@ -272,7 +272,7 @@
|
- Symphony Toolbox
+ 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 1c9685e..230d2f8 100644
--- a/help/en_US/scilab_en_US_help/sym_addConstr.html
+++ b/help/en_US/scilab_en_US_help/sym_addConstr.html
@@ -29,7 +29,7 @@
- Symphony Toolbox >> Symphony Toolbox > Symphony Native Functions > sym_addConstr
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > Symphony Native Functions > sym_addConstr
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
@@ -29,7 +29,7 @@
- Symphony Toolbox >> Symphony Toolbox > symphony
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > symphony
symphony
@@ -210,7 +210,7 @@ It has type "struct" and contains the following fields.
|
- Symphony 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 1f6af60..75edb56 100644
--- a/help/en_US/scilab_en_US_help/symphonymat.html
+++ b/help/en_US/scilab_en_US_help/symphonymat.html
@@ -16,7 +16,7 @@
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
@@ -29,7 +29,7 @@
- Symphony Toolbox >> Symphony Toolbox > symphonymat
+ FOSSEE Optimization Toolbox >> FOSSEE Optimization Toolbox > symphonymat
symphonymat
@@ -199,7 +199,7 @@ It has type "struct" and contains the following fields.
|
- Symphony Toolbox
+ FOSSEE Optimization Toolbox
|
diff --git a/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar
index f91daa1..88b99f5 100644
Binary files a/jar/scilab_en_US_help.jar and b/jar/scilab_en_US_help.jar differ
diff --git a/loader.sce b/loader.sce
index 01a4c5f..573167b 100644
--- a/loader.sce
+++ b/loader.sce
@@ -7,4 +7,4 @@ catch
error("Scilab 5.0 or more is required.");
end;
-exec(get_absolute_file_path("loader.sce")+"etc/"+"Symphony.start");
+exec(get_absolute_file_path("loader.sce")+"etc/"+"FOSSEE_Optimization_Toolbox.start");
diff --git a/macros/Checkdims.bin b/macros/Checkdims.bin
new file mode 100644
index 0000000..40e385a
Binary files /dev/null and b/macros/Checkdims.bin differ
diff --git a/macros/Checklhs.bin b/macros/Checklhs.bin
new file mode 100644
index 0000000..7156107
Binary files /dev/null and b/macros/Checklhs.bin differ
diff --git a/macros/Checkrhs.bin b/macros/Checkrhs.bin
new file mode 100644
index 0000000..2c45876
Binary files /dev/null and b/macros/Checkrhs.bin differ
diff --git a/macros/Checktype.bin b/macros/Checktype.bin
new file mode 100644
index 0000000..bbe1585
Binary files /dev/null and b/macros/Checktype.bin differ
diff --git a/macros/Checkvector.bin b/macros/Checkvector.bin
new file mode 100644
index 0000000..dfe03ab
Binary files /dev/null and b/macros/Checkvector.bin differ
diff --git a/macros/buildmacros.sce b/macros/buildmacros.sce
index fe6a619..284bc1c 100644
--- a/macros/buildmacros.sce
+++ b/macros/buildmacros.sce
@@ -9,7 +9,7 @@
// Organization: FOSSEE, IIT Bombay
// Email: toolbox@scilab.in
-tbx_build_macros("Symphony", get_absolute_file_path("buildmacros.sce"));
+tbx_build_macros("FOSSEE_Optimization_Toolbox", get_absolute_file_path("buildmacros.sce"));
clear tbx_build_macros;
diff --git a/macros/fgoalattain.bin b/macros/fgoalattain.bin
new file mode 100644
index 0000000..4889336
Binary files /dev/null and b/macros/fgoalattain.bin differ
diff --git a/macros/fgoalattain.sci b/macros/fgoalattain.sci
index d6bec24..41c0fcc 100644
--- a/macros/fgoalattain.sci
+++ b/macros/fgoalattain.sci
@@ -1,58 +1,47 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2015 - IIT Bombay - FOSSEE
//
-// Authors: Prajwala TM,Sheetal Shalini
-// Organization: FOSSEE, IIT Bombay
-// Email: prajwala.tm@gmail.com,sheetalsh456@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
+// Authors: Prajwala TM,Sheetal Shalini
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
function [x,fval,attainfactor,exitflag,output,lambda] = fgoalattain(varargin)
// Solves a multiobjective goal attainment problem
//
// Calling Sequence
- // x = fgoalattain(fun,x0,goal,weight)
- // x = fgoalattain(fun,x0,goal,weight,A,b)
- // x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq)
- // x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub)
- // x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon)
- // x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon,options)
- // [x,fval] = fgoalattain(...)
- // [x,fval,attainfactor] = fgoalattain(...)
- // [x,fval,attainfactor,exitflag] = fgoalattain(...)
- // [x,fval,attainfactor,exitflag,output] = fgoalattain(...)
- // [x,fval,attainfactor,exitflag,output,lambda] = fgoalattain(...)
+ // xopt = fgoalattain(fun,x0,goal,weight)
+ // xopt = fgoalattain(fun,x0,goal,weight,A,b)
+ // xopt = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq)
+ // xopt = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub)
+ // xopt = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon)
+ // xopt = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon,options)
+ // [xopt,fval] = fgoalattain(...)
+ // [xopt,fval,attainfactor] = fgoalattain(...)
+ // [xopt,fval,attainfactor,exitflag] = fgoalattain(...)
+ // [xopt,fval,attainfactor,exitflag,output] = fgoalattain(...)
+ // [xopt,fval,attainfactor,exitflag,output,lambda] = fgoalattain(...)
//
// Parameters
// fun: a function that accepts a vector x and returns a vector F
- // x0: a nx1 or 1xn matrix of double, where n is the number of variables.
- // The initial guess for the optimization algorithm
- // A: a nil x n matrix of double, where n is the number of variables and
- // nil is the number of linear inequalities.
- //
- // b: a nil x 1 matrix of double, where nil is the number of linear
- // inequalities
- // Aeq: a nel x n matrix of double, where n is the number of variables
- // and nel is the number of linear equalities.
- // beq: a nel x 1 matrix of double, where nel is the number of linear
- // equalities
- // lb: a nx1 or 1xn matrix of double, where n is the number of variables.
- // The lower bound for x. If lb==[], then the lower bound is
- // automatically set to -inf
- // ub: a nx1 or 1xn matrix of double, where n is the number of variables.
- // The upper bound for x. If ub==[], then the upper bound is
- // automatically set to +inf
- // nonlcon: a function, the nonlinear constraints
- // options : a list, containing the option for user to specify. See below for details.
- // x: a nx1 matrix of double, the computed solution of the optimization problem
- // fval: a vector of double, the value of functions at x
- // attainfactor: The amount of over- or underachievement of the goals,γ at the solution.
- // exitflag: a 1x1 matrix of floating point integers, the exit status
- // output: a struct, the details of the optimization process
- // lambda: a struct, the Lagrange multipliers at optimum
+ // x0 : a vector of double, contains initial guess of variables.
+ // A : a matrix of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
+ // b : a vector of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
+ // Aeq : a matrix of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
+ // beq : a vector of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
+ // lb : a vector of double, contains lower bounds of the variables.
+ // ub : a vector of double, contains upper bounds of the variables.
+ // nonlcon: a function, the nonlinear constraints
+ // options : a list, containing the option for user to specify. See below for details.
+ // xopt : a vector of double, the computed solution of the optimization problem.
+ // fopt : a double, the value of the function at x.
+ // attainfactor: The amount of over- or underachievement of the goals,γ at the solution.
+ // exitflag : The exit status. See below for details.
+ // output : The structure consist of statistics about the optimization. See below for details.
+ // lambda : The structure consist of the Lagrange multipliers at the solution of problem. See below for details.
//
// Description
// fgoalattain solves the goal attainment problem, which is one formulation for minimizing a multiobjective optimization problem.
@@ -164,21 +153,12 @@ function [x,fval,attainfactor,exitflag,output,lambda] = fgoalattain(varargin)
// f1(5)=x(1)+x(2)-8
// endfunction
// x0=[-1,1];
- //
// goal=[-5,-3,-2,-1,-4];
// weight=abs(goal)
- // gval =
- // [- 0.0000011
- // - 63.999998
- // - 2.0000002
- // - 8.
- // 3.485D-08]
- // z =
- // [4. 3.99]
- //
- // Run fgoalattain
- // [x,fval,attainfactor,exitflag,output,lambda]=fgoalattain(gattainObjfun,x0,goal,weight)
- //
+ // //gval =[- 0.0000011 -63.999998 -2.0000002 -8 3.485D-08]
+ // //z = [4 3.99]
+ // //Run fgoalattain
+ // [x,fval,attainfactor,exitflag,output,lambda]=fgoalattain(gattainObjfun,x0,goal,weight)
// Authors
// Prajwala TM, Sheetal Shalini , 2015
@@ -311,14 +291,14 @@ function [x,fval,attainfactor,exitflag,output,lambda] = fgoalattain(varargin)
//To check the User Entry for Options and storing it
for i = 1:(size(gattainUserOptions))/2
- select gattainUserOptions(2*i-1)
- case "MaxIter" then
+ select convstr(gattainUserOptions(2*i-1),'l')
+ case "maxiter" then
fgaMaxIter = gattainUserOptions(2*i); //Setting the Maximum Iteration as per user entry
- case "CpuTime" then
+ case "cputime" then
fgaCPU = gattainUserOptions(2*i); //Setting the Maximum CPU Time as per user entry
- case "GradObj" then
+ case "gradobj" then
if (type(gattainUserOptions(2*i))==10) then
if (convstr(gattainUserOptions(2*i))=="off") then
flag1 = 0;
@@ -331,7 +311,7 @@ function [x,fval,attainfactor,exitflag,output,lambda] = fgoalattain(varargin)
gattainFGrad = gattainUserOptions(2*i);
end
- case "GradCon" then
+ case "gradcon" then
if (type(gattainUserOptions(2*i))==10) then
if (convstr(gattainUserOptions(2*i))=="off") then
flag2 = 0;
@@ -479,49 +459,6 @@ function [x,fval,attainfactor,exitflag,output,lambda] = fgoalattain(varargin)
end
endfunction
-
- // disp(gattainStartpoint)
- // disp(gattainObjfun(gattainStartpoint))
- // disp(newObjfun(gattainStartpoint))
- // disp(goal)
- // disp(weight)
- //
- // disp(gattainA)
- // disp(gattainB)
- // disp(gattainAeq)
- // disp(gattainBeq)
- // disp(gattainLb)
- // disp(gattainUb)
- //
- // [f,g] = gattainNonlinfun(gattainStartpoint)
- // disp(f)
- // disp(g)
- // [f,g] = newNonlinfun(gattainStartpoint)
- // disp(f)
- // disp(g)
- //
- // // function foo = CgattainC(z)
- // // [foo,tmp1] = newNonlinfun(z)
- // // endfunction
- // //
- // // function foo = CgattainCEQ(z)
- // // [tmp1,foo] = newNonlinfun(z)
- // // endfunction
- // //
- // // // function handle defining gattainNonlinfun derivative using numderivative
- // // function [dc,dceq] = derrNonlinApp(z)
- // // dc = numderivative(CgattainC,z)
- // // dceq = numderivative(CgattainCEQ,z)
- // // endfunction
- //
- // // [f,g] = derrNonlinApp(gattainStartpoint)
- // // disp(f)
- // // disp(g)
- //
- // [f,g] = newCGrad(gattainStartpoint)
- // disp(f)
- // disp(g)
-
//to be passed as options to fmincon
if (flag1 == 1 | flag2 == 1) then
gattainPassOptions = list("MaxIter", fgaMaxIter, "CpuTime", fgaCPU, "GradCon", newCGrad)
diff --git a/macros/fminbnd.bin b/macros/fminbnd.bin
index df44ca0..97b00fc 100644
Binary files a/macros/fminbnd.bin and b/macros/fminbnd.bin differ
diff --git a/macros/fminbnd.sci b/macros/fminbnd.sci
index c9bf4cc..2c29b03 100644
--- a/macros/fminbnd.sci
+++ b/macros/fminbnd.sci
@@ -253,12 +253,12 @@ function [xopt,fopt,exitflag,output,lambda] = fminbnd (varargin)
//To check the user entry for options and storing it
for i = 1:(size(param))/2
- select param(2*i-1)
- case "MaxIter" then
+ select convstr(param(2*i-1),'l')
+ case "maxiter" then
options(2*i) = param(2*i);
- case "CpuTime" then
+ case "cputime" then
options(2*i) = param(2*i);
- case "TolX" then
+ case "tolx" then
options(2*i) = param(2*i);
else
errmsg = msprintf(gettext("%s: Unrecognized parameter name %s."), "fminbnd", param(2*i-1));
diff --git a/macros/fmincon.bin b/macros/fmincon.bin
index 2e93c02..e1785a4 100644
Binary files a/macros/fmincon.bin and b/macros/fmincon.bin differ
diff --git a/macros/fmincon.sci b/macros/fmincon.sci
index 6e2d064..49adec5 100644
--- a/macros/fmincon.sci
+++ b/macros/fmincon.sci
@@ -673,22 +673,22 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin
//To check the user entry for options and storing it
for i = 1:(size(param))/2
- select param(2*i-1)
- case "MaxIter" then
+ select convstr(param(2*i-1),'l')
+ case "maxiter" then
options(2*i) = param(2*i); //Setting the maximum number of iterations as per user entry
- case "CpuTime" then
+ case "cputime" then
options(2*i) = param(2*i); //Setting the maximum CPU time as per user entry
- case "GradObj" then
+ case "gradobj" then
flag1=1;
fGrad=param(2*i);
- case "Hessian" then
+ case "hessian" then
flag2=1;
lHess=param(2*i);
- case "GradCon" then
+ case "gradcon" then
flag3=1;
cGrad=param(2*i);
else
- errmsg = msprintf(gettext("%s: Unrecognized parameter name %s."), "fminbnd", param(2*i-1));
+ errmsg = msprintf(gettext("%s: Unrecognized parameter name %s."), "fmincon", param(2*i-1));
error(errmsg);
end
end
diff --git a/macros/fminimax.bin b/macros/fminimax.bin
new file mode 100644
index 0000000..8a8a8a4
Binary files /dev/null and b/macros/fminimax.bin differ
diff --git a/macros/fminimax.sci b/macros/fminimax.sci
index 04d0af6..c775b1b 100644
--- a/macros/fminimax.sci
+++ b/macros/fminimax.sci
@@ -1,49 +1,47 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2015 - IIT Bombay - FOSSEE
//
-// Authors: Animesh Baranawal
-// Organization: FOSSEE, IIT Bombay
-// Email: animeshbaranawal@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
+// Authors: Animesh Baranawal
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
function [x,fval,maxfval,exitflag,output,lambda] = fminimax(varargin)
// Solves minimax constraint problem
//
// Calling Sequence
- // x = fminimax(fun,x0)
- // x = fminimax(fun,x0,A,b)
- // x = fminimax(fun,x0,A,b,Aeq,beq)
- // x = fminimax(fun,x0,A,b,Aeq,beq,lb,ub)
- // x = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfun)
- // x = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfun,options)
- // [x, fval] = fmincon(.....)
- // [x, fval, maxfval]= fmincon(.....)
- // [x, fval, maxfval, exitflag]= fmincon(.....)
- // [x, fval, maxfval, exitflag, output]= fmincon(.....)
- // [x, fval, maxfval, exitflag, output, lambda]= fmincon(.....)
+ // xopt = fminimax(fun,x0)
+ // xopt = fminimax(fun,x0,A,b)
+ // xopt = fminimax(fun,x0,A,b,Aeq,beq)
+ // 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(.....)
//
// 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.
- // x0: a nx1 or 1xn matrix of doubles, where n is the number of variables, the initial guess for the optimization algorithm
- // A: a nil x n matrix of doubles, where n is the number of variables and nil is the number of linear inequalities. If A==[] and b==[], it is assumed that there is no linear inequality constraints. If (A==[] & b<>[]), fminimax generates an error (the same happens if (A<>[] & b==[]))
- // b: a nil x 1 matrix of doubles, where nil is the number of linear inequalities
- // Aeq: a nel x n matrix of doubles, where n is the number of variables and nel is the number of linear equalities. If Aeq==[] and beq==[], it is assumed that there is no linear equality constraints. If (Aeq==[] & beq<>[]), fminimax generates an error (the same happens if (Aeq<>[] & beq==[]))
- // beq: a nel x 1 matrix of doubles, where nel is the number of linear equalities
- // lb: a nx1 or 1xn matrix of doubles, where n is the number of variables. The lower bound for x. If lb==[], then the lower bound is automatically set to -inf
- // ub: a nx1 or 1xn matrix of doubles, where n is the number of variables. The upper bound for x. If ub==[], then the upper bound is automatically set to +inf
- // nonlinfun: function that computes the nonlinear inequality constraints c(x) <= 0 and nonlinear equality constraints ceq(x) = 0.
- // x: a nx1 matrix of doubles, the computed solution of the optimization problem
- // fval: a vector of doubles, the value of fun at x
- // maxfval: a 1x1 matrix of doubles, the maximum value in vector fval
- // exitflag: a 1x1 matrix of floating point integers, the exit status
- // output: a struct, the details of the optimization process
- // lambda: a struct, the Lagrange multipliers at optimum
- // options: a list, containing the option for user to specify. See below for details.
- //
+ // x0 : a vector of double, contains initial guess of variables.
+ // A : a matrix of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
+ // b : a vector of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
+ // Aeq : a matrix of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
+ // beq : a vector of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
+ // lb : a vector of double, contains lower bounds of the variables.
+ // ub : a vector of double, contains upper bounds of the variables.
+ // nonlinfun: function that computes the nonlinear inequality constraints c⋅x ≤ 0 and nonlinear equality constraints c⋅x = 0.
+ // xopt : a vector of double, the computed solution of the optimization problem.
+ // fopt : a double, the value of the function at x.
+ // maxfval: a 1x1 matrix of doubles, the maximum value in vector fval
+ // exitflag : The exit status. See below for details.
+ // output : The structure consist of statistics about the optimization. See below for details.
+ // lambda : The structure consist of the Lagrange multipliers at the solution of problem. See below for details.
+ //
// Description
// fminimax minimizes the worst-case (largest) value of a set of multivariable functions, starting at an initial estimate. This is generally referred to as the minimax problem.
//
@@ -160,7 +158,6 @@ function [x,fval,maxfval,exitflag,output,lambda] = fminimax(varargin)
// f(4)= -x(1) - x(2);
// f(5)= x(1) + x(2) - 8;
// endfunction
- //
// // The initial guess
// x0 = [0.1,0.1];
// // The expected solution : only 4 digits are guaranteed
@@ -169,6 +166,7 @@ function [x,fval,maxfval,exitflag,output,lambda] = fminimax(varargin)
// maxfopt = 0
// // Run fminimax
// [x,fval,maxfval,exitflag,output,lambda] = fminimax(myfun, x0)
+ // // Press ENTER to continue
//
// Examples
// // A case where we provide the gradient of the objective
@@ -181,14 +179,11 @@ function [x,fval,maxfval,exitflag,output,lambda] = fminimax(varargin)
// f(4)= -x(1) - x(2);
// f(5)= x(1) + x(2) - 8;
// endfunction
- //
// // Defining gradient of myfun
// function G = myfungrad(x)
// G = [ 4*x(1) - 48, -2*x(1), 1, -1, 1;
// 2*x(2) - 40, -6*x(2), 3, -1, 1; ]'
// endfunction
- //
- //
// // The nonlinear constraints and the Jacobian
// // matrix of the constraints
// function [c,ceq] = confun(x)
@@ -197,8 +192,6 @@ function [x,fval,maxfval,exitflag,output,lambda] = fminimax(varargin)
// // No nonlinear equality constraints
// ceq=[]
// endfunction
- //
- //
// // Defining gradient of confungrad
// function [DC,DCeq] = cgrad(x)
// // DC(:,i) = gradient of the i-th constraint
@@ -212,7 +205,6 @@ function [x,fval,maxfval,exitflag,output,lambda] = fminimax(varargin)
// ]'
// DCeq = []'
// endfunction
- //
// // Test with both gradient of objective and gradient of constraints
// minimaxOptions = list("GradObj",myfungrad,"GradCon",cgrad);
// // The initial guess
@@ -223,8 +215,6 @@ function [x,fval,maxfval,exitflag,output,lambda] = fminimax(varargin)
// maxfopt = 6.73443
// // Run fminimax
// [x,fval,maxfval,exitflag,output] = fminimax(myfun,x0,[],[],[],[],[],[], confun, minimaxOptions)
- //
- //
// Authors
// Animesh Baranawal
//
@@ -377,14 +367,14 @@ function [x,fval,maxfval,exitflag,output,lambda] = fminimax(varargin)
//To check the User Entry for Options and storing it
for i = 1:(size(minmaxUserOptions))/2
- select minmaxUserOptions(2*i-1)
- case "MaxIter" then
+ select convstr(minmaxUserOptions(2*i-1),'l')
+ case "maxiter" then
minmaxIter = minmaxUserOptions(2*i); //Setting the Maximum Iteration as per user entry
- case "CpuTime" then
+ case "cputime" then
minmaxCPU = minmaxUserOptions(2*i); //Setting the Maximum CPU Time as per user entry
- case "GradObj" then
+ case "gradobj" then
if (type(minmaxUserOptions(2*i))==10) then
if (convstr(minmaxUserOptions(2*i))=="off") then
flag1 = 0;
@@ -397,7 +387,7 @@ function [x,fval,maxfval,exitflag,output,lambda] = fminimax(varargin)
minmaxFGrad = minmaxUserOptions(2*i);
end
- case "GradCon" then
+ case "gradcon" then
if (type(minmaxUserOptions(2*i))==10) then
if (convstr(minmaxUserOptions(2*i))=="off") then
flag2 = 0;
@@ -515,27 +505,6 @@ function [x,fval,maxfval,exitflag,output,lambda] = fminimax(varargin)
end
endfunction
- // disp(minmaxStartpoint)
- // a = minmaxObjfun(minmaxStartpoint)
- // disp(a)
- // disp(newObjfun(minmaxStartpoint))
- // disp(minmaxA)
- // disp(minmaxB)
- // disp(minmaxAeq)
- // disp(minmaxBeq)
- // disp(minmaxLb)
- // disp(minmaxUb)
- // [a,b] = minmaxNonlinfun(minmaxStartpoint)
- // disp(a)
- // disp(b)
- // [a,b] = newNonlinfun(minmaxStartpoint)
- // disp(a)
- // disp(b)
- // [a,b] = newCGrad(minmaxStartpoint)
- // disp(a)
- // disp(b)
- // disp(newFGrad(minmaxStartpoint))
-
// to be passed as minimaxOptions to fmincon
if(flag1 == 1 | flag2 == 1) then
minmaxPassOptions = list("MaxIter", minmaxMaxIter, "CpuTime", minmaxCPU, "GradCon", newCGrad)
@@ -555,5 +524,4 @@ function [x,fval,maxfval,exitflag,output,lambda] = fminimax(varargin)
maxfval = max(fval)
end
-
endfunction
diff --git a/macros/fminunc.bin b/macros/fminunc.bin
index 4d67d1b..aa82fc3 100644
Binary files a/macros/fminunc.bin and b/macros/fminunc.bin differ
diff --git a/macros/fminunc.sci b/macros/fminunc.sci
index f39c312..a936aa1 100644
--- a/macros/fminunc.sci
+++ b/macros/fminunc.sci
@@ -264,15 +264,15 @@ function [xopt,fopt,exitflag,output,gradient,hessian] = fminunc (varargin)
//To check the user entry for options and store it
for i = 1:(size(param))/2
- select param(2*i-1)
- case "MaxIter" then
+ select convstr(param(2*i-1),'l')
+ case "maxiter" then
options(2*i) = param(2*i); //Setting the maximum number of iterations as per user entry
- case "CpuTime" then
+ case "cputime" then
options(2*i) = param(2*i); //Setting the maximum CPU time as per user entry
- case "Gradient" then
+ case "gradient" then
flag1 = 1;
fGrad = param(2*i);
- case "Hessian" then
+ case "hessian" then
flag2 = 1;
fHess = param(2*i);
else
diff --git a/macros/lib b/macros/lib
index b034ee7..f7602af 100644
Binary files a/macros/lib and b/macros/lib differ
diff --git a/macros/linprog.bin b/macros/linprog.bin
index 82e3310..12a9f7d 100644
Binary files a/macros/linprog.bin and b/macros/linprog.bin differ
diff --git a/macros/linprog.sci b/macros/linprog.sci
index e3e2c71..5b12241 100644
--- a/macros/linprog.sci
+++ b/macros/linprog.sci
@@ -51,9 +51,18 @@ function [xopt,fopt,exitflag,output,lambda] = linprog (varargin)
// & & lb \leq x \leq ub \\
// \end{eqnarray}
//
+ //
// The routine calls Clp for solving the linear programming problem, Clp is a library written in C++.
//
- // The exitflag allows to know the status of the optimization which is given back by Ipopt.
+ // The options allows the user to set various parameters of the Optimization problem.
+ // It should be defined as type "list" and contains the following fields. In the current version it only contains maxiter.
+ //
+ // Syntax : options= list("MaxIter", [---]);
+ // MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take.
+ // Default Values : options = list("MaxIter", [3000]);
+ //
+ //
+ // The exitflag allows to know the status of the optimization which is given back by CLP.
//
// exitflag=0 : Optimal Solution Found
// exitflag=1 : Primal Infeasible
@@ -64,8 +73,6 @@ function [xopt,fopt,exitflag,output,lambda] = linprog (varargin)
// exitflag=6 : Dual objective limit reached.
//
//
- // For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/
- //
// The output data structure contains detailed informations about the optimization process.
// It has type "struct" and contains the following fields.
//
@@ -77,8 +84,6 @@ function [xopt,fopt,exitflag,output,lambda] = linprog (varargin)
// of optimization. In the current version the values are returned only when the the solution is optimal.
// It has type "struct" and contains the following fields.
//
- // lambda.lower: The Lagrange multipliers for the lower bound constraints.
- // lambda.upper: The Lagrange multipliers for the upper bound constraints.
// lambda.eqlin: The Lagrange multipliers for the linear equality constraints.
// lambda.ineqlin: The Lagrange multipliers for the linear inequality constraints.
//
diff --git a/macros/lsqlin.bin b/macros/lsqlin.bin
index 7018f4a..7baf7be 100644
Binary files a/macros/lsqlin.bin and b/macros/lsqlin.bin differ
diff --git a/macros/lsqlin.sci b/macros/lsqlin.sci
index 97aaae6..f236c0d 100644
--- a/macros/lsqlin.sci
+++ b/macros/lsqlin.sci
@@ -9,7 +9,6 @@
// Organization: FOSSEE, IIT Bombay
// Email: toolbox@scilab.in
-
function [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin (varargin)
// Solves a linear quadratic problem.
//
@@ -54,6 +53,15 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin (varargin)
//
// The routine calls Ipopt for solving the linear least square problem, Ipopt is a library written in C++.
//
+ // The options allows the user to set various parameters of the Optimization problem.
+ // It should be defined as type "list" and contains the following fields.
+ //
+ // Syntax : options= list("MaxIter", [---], "CpuTime", [---]);
+ // MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take.
+ // CpuTime : a Scalar, containing the Maximum amount of CPU Time that the solver should take.
+ // Default Values : options = list("MaxIter", [3000], "CpuTime", [600]);
+ //
+ //
// The exitflag allows to know the status of the optimization which is given back by Ipopt.
//
// exitflag=0 : Optimal Solution Found
@@ -198,22 +206,32 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin (varargin)
error(errmsg);
end
+ //Check type of variables
+ Checktype("lsqlin", C, "C", 1, "constant")
+ Checktype("lsqlin", d, "d", 2, "constant")
+ Checktype("lsqlin", A, "A", 3, "constant")
+ Checktype("lsqlin", b, "b", 4, "constant")
+ Checktype("lsqlin", Aeq, "Aeq", 5, "constant")
+ Checktype("lsqlin", beq, "beq", 6, "constant")
+ Checktype("lsqlin", lb, "lb", 7, "constant")
+ Checktype("lsqlin", ub, "ub", 8, "constant")
+ Checktype("lsqlin", x0, "x0", 9, "constant")
if (modulo(size(param),2)) then
errmsg = msprintf(gettext("%s: Size of parameters should be even"), "lsqlin");
error(errmsg);
end
- options = list( "MaxIter" , [3000], ...
+ options = list( "MaxIter" , [3000], ...
"CpuTime" , [600] ...
- );
+ );
for i = 1:(size(param))/2
- select param(2*i-1)
- case "MaxIter" then
+ select convstr(param(2*i-1),'l')
+ case "maxiter" then
options(2*i) = param(2*i);
- case "CpuTime" then
+ case "cputime" then
options(2*i) = param(2*i);
else
errmsg = msprintf(gettext("%s: Unrecognized parameter name ''%s''."), "lsqlin", param(2*i-1));
@@ -227,7 +245,6 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin (varargin)
// Check if the user gives row vector
// and Changing it to a column matrix
-
if (size(d,2)== [nbVar]) then
d=d';
end
diff --git a/macros/lsqnonneg.bin b/macros/lsqnonneg.bin
index 39c553b..32620d0 100644
Binary files a/macros/lsqnonneg.bin and b/macros/lsqnonneg.bin differ
diff --git a/macros/lsqnonneg.sci b/macros/lsqnonneg.sci
index 3e5ea81..a60d417 100644
--- a/macros/lsqnonneg.sci
+++ b/macros/lsqnonneg.sci
@@ -41,6 +41,15 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg (varargin)
//
// The routine calls Ipopt for solving the nonnegative least-squares curve fitting problems, Ipopt is a library written in C++.
//
+ // The options allows the user to set various parameters of the Optimization problem.
+ // It should be defined as type "list" and contains the following fields.
+ //
+ // Syntax : options= list("MaxIter", [---], "CpuTime", [---]);
+ // MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take.
+ // CpuTime : a Scalar, containing the Maximum amount of CPU Time that the solver should take.
+ // Default Values : options = list("MaxIter", [3000], "CpuTime", [600]);
+ //
+ //
// The exitflag allows to know the status of the optimization which is given back by Ipopt.
//
// exitflag=0 : Optimal Solution Found
@@ -114,6 +123,9 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg (varargin)
error(errmsg);
end
+ //Check type of variables
+ Checktype("lsqnonneg", C, "C", 1, "constant")
+ Checktype("lsqnonneg", d, "d", 2, "constant")
if (modulo(size(param),2)) then
errmsg = msprintf(gettext("%s: Size of parameters should be even"), "lsqnonneg");
@@ -126,13 +138,13 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg (varargin)
for i = 1:(size(param))/2
- select param(2*i-1)
- case "MaxIter" then
+ select convstr(param(2*i-1),'l')
+ case "maxiter" then
options(2*i) = param(2*i);
- case "CpuTime" then
+ case "cputime" then
options(2*i) = param(2*i);
else
- errmsg = msprintf(gettext("%s: Unrecognized parameter name ''%s''."), "lsqnonneg", param(2*i-1));
+ errmsg = msprintf(gettext("%s: Unrecognized parameter name ''%s''."), "lsqlin", param(2*i-1));
error(errmsg)
end
end
diff --git a/macros/matrix_linprog.bin b/macros/matrix_linprog.bin
index 21e525c..ac4d8d9 100644
Binary files a/macros/matrix_linprog.bin and b/macros/matrix_linprog.bin differ
diff --git a/macros/matrix_linprog.sci b/macros/matrix_linprog.sci
index 1f6a6bf..c1f53a0 100755
--- a/macros/matrix_linprog.sci
+++ b/macros/matrix_linprog.sci
@@ -31,16 +31,16 @@ function [xopt,fopt,exitflag,output,lambda] = matrix_linprog (varargin)
c = varargin(1);
- if (size(c,2)~=1) then
- errmsg = msprintf(gettext("%s: Objective Coefficients should be a column matrix"), "linprog");
- error(errmsg);
- end
-
if(size(c,2) == 0) then
errmsg = msprintf(gettext("%s: Cannot determine the number of variables because input objective coefficients is empty"), "linprog");
error(errmsg);
end
+ if (size(c,2)~=1) then
+ errmsg = msprintf(gettext("%s: Objective Coefficients should be a column matrix"), "linprog");
+ error(errmsg);
+ end
+
nbVar = size(c,1);
A = varargin(2);
b = varargin(3);
@@ -67,25 +67,22 @@ function [xopt,fopt,exitflag,output,lambda] = matrix_linprog (varargin)
param =varargin(8);
end
+ //Check type of variables
+ Checktype("linprog", c, "c", 1, "constant")
+ Checktype("linprog", A, "A", 2, "constant")
+ Checktype("linprog", b, "b", 3, "constant")
+ Checktype("linprog", Aeq, "Aeq", 4, "constant")
+ Checktype("linprog", beq, "beq", 5, "constant")
+ Checktype("linprog", lb, "lb", 6, "constant")
+ Checktype("linprog", ub, "ub", 7, "constant")
+
nbConInEq = size(A,1);
nbConEq = size(Aeq,1);
- if (size(lb,2)== [nbVar]) then
- lb = lb';
- end
-
- if (size(ub,2)== [nbVar]) then
- ub = ub';
- end
-
- if (size(b,2)== [nbConInEq]) then
- b = b';
- end
-
- if (size(beq,2)== [nbConEq]) then
- beq = beq';
- end
-
+ lb = lb(:);
+ ub = ub(:)
+ b = b(:);
+ beq = beq(:);
if (size(lb,2)==0) then
lb = repmat(-%inf,nbVar,1);
@@ -110,11 +107,11 @@ function [xopt,fopt,exitflag,output,lambda] = matrix_linprog (varargin)
for i = 1:(size(param))/2
- select param(2*i-1)
- case "MaxIter" then
+ select convstr(param(2*i-1),'l')
+ case "maxiter" then
options(2*i) = param(2*i);
else
- errmsg = msprintf(gettext("%s: Unrecognized parameter name ''%s''."), "qpipoptmat", param(2*i-1));
+ errmsg = msprintf(gettext("%s: Unrecognized parameter name ''%s''."), "linprog", param(2*i-1));
error(errmsg)
end
end
@@ -155,7 +152,6 @@ function [xopt,fopt,exitflag,output,lambda] = matrix_linprog (varargin)
end
//Check if the user gives a matrix instead of a vector
-
if (size(lb,1)~=1)& (size(lb,2)~=1) then
errmsg = msprintf(gettext("%s: Lower Bound should be a vector"), "linprog");
error(errmsg);
@@ -194,10 +190,6 @@ function [xopt,fopt,exitflag,output,lambda] = matrix_linprog (varargin)
end
end
- lb = lb(:);
- ub = ub(:)
- b = b(:);
- beq = beq(:);
nbVar = size(c,1);
c = c';
conMatrix = [Aeq;A];
diff --git a/macros/mps_linprog.bin b/macros/mps_linprog.bin
index ee7d822..c0d2e3e 100644
Binary files a/macros/mps_linprog.bin and b/macros/mps_linprog.bin differ
diff --git a/macros/mps_linprog.sci b/macros/mps_linprog.sci
index 55f3edf..aa61d02 100644
--- a/macros/mps_linprog.sci
+++ b/macros/mps_linprog.sci
@@ -35,21 +35,27 @@ function [xopt,fopt,exitflag,output,lambda] =mps_linprog(varargin)
end
if (type(param) ~= 15) then
- errmsg = msprintf(gettext("%s: options should be a list "), "mps_linprog");
+ errmsg = msprintf(gettext("%s: options should be a list "), "linprog");
error(errmsg);
end
+ //Check type of variables
+ Checktype("linprog", mpsFile, "mpsFile", 1, "string")
+
if (modulo(size(param),2)) then
- errmsg = msprintf(gettext("%s: Size of parameters should be even"), "mps_linprog");
+ errmsg = msprintf(gettext("%s: Size of parameters should be even"), "linprog");
error(errmsg);
end
options = list("MaxIter" , [3000],);
for i = 1:(size(param))/2
- select param(2*i-1)
- case "MaxIter" then
+ select convstr(param(2*i-1),'l')
+ case "maxiter" then
options(2*i) = param(2*i);
- end
+ else
+ errmsg = msprintf(gettext("%s: Unrecognized parameter name ''%s''."), "linprog", param(2*i-1));
+ error(errmsg)
+ end
end
//Calling the function by passing the required parameters
diff --git a/macros/names b/macros/names
index 1055c2a..bff51fe 100644
--- a/macros/names
+++ b/macros/names
@@ -1,13 +1,12 @@
+Checkdims
+Checklhs
+Checkrhs
+Checktype
+Checkvector
fgoalattain
-fgoalattainFunctions
fminbnd
fmincon
fminimax
-fminimaxCheckdims
-fminimaxChecklhs
-fminimaxCheckrhs
-fminimaxChecktype
-fminimaxCheckvector
fminunc
linprog
lsqlin
diff --git a/macros/qpipopt.bin b/macros/qpipopt.bin
index d5e2bd1..e2ba3de 100644
Binary files a/macros/qpipopt.bin and b/macros/qpipopt.bin differ
diff --git a/macros/qpipopt.sci b/macros/qpipopt.sci
index 25e7c07..c900f0c 100644
--- a/macros/qpipopt.sci
+++ b/macros/qpipopt.sci
@@ -51,6 +51,15 @@ function [xopt,fopt,exitflag,output,lambda] = qpipopt (varargin)
//
// The routine calls Ipopt for solving the quadratic problem, Ipopt is a library written in C++.
//
+ // The options allows the user to set various parameters of the Optimization problem.
+ // It should be defined as type "list" and contains the following fields.
+ //
+ // Syntax : options= list("MaxIter", [---], "CpuTime", [---]);
+ // MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take.
+ // CpuTime : a Scalar, containing the Maximum amount of CPU Time that the solver should take.
+ // Default Values : options = list("MaxIter", [3000], "CpuTime", [600]);
+ //
+ //
// The exitflag allows to know the status of the optimization which is given back by Ipopt.
//
// exitflag=0 : Optimal Solution Found
@@ -187,23 +196,36 @@ function [xopt,fopt,exitflag,output,lambda] = qpipopt (varargin)
error(errmsg);
end
+ //Check type of variables
+ Checktype("qpipopt", nbVar, "nbVar", 1, "constant")
+ Checktype("qpipopt", nbCon, "nbCon", 2, "constant")
+ Checktype("qpipopt", H, "H", 3, "constant")
+ Checktype("qpipopt", f, "f", 4, "constant")
+ Checktype("qpipopt", lb, "lb", 5, "constant")
+ Checktype("qpipopt", ub, "lb", 6, "constant")
+ Checktype("qpipopt", A, "A", 7, "constant")
+ Checktype("qpipopt", conLB, "conlb", 8, "constant")
+ Checktype("qpipopt", conUB, "conub", 9, "constant")
+ Checktype("qpipopt", x0, "x0", 10, "constant")
+
options = list(..
"MaxIter" , [3000], ...
"CpuTime" , [600] ...
);
- for i = 1:(size(param))/2
- select param(2*i-1)
- case "MaxIter" then
- options(2*i) = param(2*i);
- case "CpuTime" then
- options(2*i) = param(2*i);
- else
- errmsg = msprintf(gettext("%s: Unrecognized parameter name ''%s''."), "qpipopt", param(2*i-1));
- error(errmsg)
- end
- end
+ for i = 1:(size(param))/2
+
+ select convstr(param(2*i-1),'l')
+ case "maxiter" then
+ options(2*i) = param(2*i);
+ case "cputime" then
+ options(2*i) = param(2*i);
+ else
+ errmsg = msprintf(gettext("%s: Unrecognized parameter name ''%s''."), "lsqlin", param(2*i-1));
+ error(errmsg)
+ end
+ end
// Check if the user gives row vector
// and Changing it to a column matrix
diff --git a/macros/qpipoptmat.bin b/macros/qpipoptmat.bin
index 58424ec..057fa29 100644
Binary files a/macros/qpipoptmat.bin and b/macros/qpipoptmat.bin differ
diff --git a/macros/qpipoptmat.sci b/macros/qpipoptmat.sci
index ca32f8e..e64a83a 100644
--- a/macros/qpipoptmat.sci
+++ b/macros/qpipoptmat.sci
@@ -35,7 +35,6 @@ function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin)
// param : a list containing the parameters to be set.
// xopt : a vector of double, the computed solution of the optimization problem.
// fopt : a double, the value of the function at x.
- // residual : a vector of double, solution residuals returned as the vector d-C*x.
// exitflag : The exit status. See below for details.
// output : The structure consist of statistics about the optimization. See below for details.
// lambda : The structure consist of the Lagrange multipliers at the solution of problem. See below for details.
@@ -55,6 +54,15 @@ function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin)
//
// The routine calls Ipopt for solving the quadratic problem, Ipopt is a library written in C++.
//
+ // The options allows the user to set various parameters of the Optimization problem.
+ // It should be defined as type "list" and contains the following fields.
+ //
+ // Syntax : options= list("MaxIter", [---], "CpuTime", [---]);
+ // MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take.
+ // CpuTime : a Scalar, containing the Maximum amount of CPU Time that the solver should take.
+ // Default Values : options = list("MaxIter", [3000], "CpuTime", [600]);
+ //
+ //
// The exitflag allows to know the status of the optimization which is given back by Ipopt.
//
// exitflag=0 : Optimal Solution Found
@@ -208,21 +216,32 @@ function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin)
error(errmsg);
end
+ //Check type of variables
+ Checktype("qpipoptmat", H, "H", 1, "constant")
+ Checktype("qpipoptmat", f, "f", 2, "constant")
+ Checktype("qpipoptmat", A, "A", 3, "constant")
+ Checktype("qpipoptmat", b, "b", 4, "constant")
+ Checktype("qpipoptmat", Aeq, "Aeq", 5, "constant")
+ Checktype("qpipoptmat", beq, "beq", 6, "constant")
+ Checktype("qpipoptmat", lb, "lb", 7, "constant")
+ Checktype("qpipoptmat", ub, "ub", 8, "constant")
+ Checktype("qpipoptmat", x0, "x0", 9, "constant")
+
options = list(..
"MaxIter" , [3000], ...
"CpuTime" , [600] ...
);
for i = 1:(size(param))/2
-
- select param(2*i-1)
- case "MaxIter" then
- options(2*i) = param(2*i);
- case "CpuTime" then
- options(2*i) = param(2*i);
- else
- errmsg = msprintf(gettext("%s: Unrecognized parameter name ''%s''."), "qpipoptmat", param(2*i-1));
- error(errmsg)
+
+ select convstr(param(2*i-1),'l')
+ case "maxiter" then
+ options(2*i) = param(2*i);
+ case "cputime" then
+ options(2*i) = param(2*i);
+ else
+ errmsg = msprintf(gettext("%s: Unrecognized parameter name ''%s''."), "lsqlin", param(2*i-1));
+ error(errmsg)
end
end
diff --git a/macros/symphony.bin b/macros/symphony.bin
index b98094e..2c3a43a 100644
Binary files a/macros/symphony.bin and b/macros/symphony.bin differ
diff --git a/macros/symphony.sci b/macros/symphony.sci
index 81b24fb..111f84c 100644
--- a/macros/symphony.sci
+++ b/macros/symphony.sci
@@ -219,6 +219,17 @@ function [xopt,fopt,status,output] = symphony (varargin)
options = varargin(11);
end
+ //Check type of variables
+ Checktype("symphony", nbVar, "nbVar", 1, "constant")
+ Checktype("symphony", nbCon, "nbCon", 2, "constant")
+ Checktype("symphony", c, "c", 3, "constant")
+ Checktype("symphony", isInt, "isInt", 4, "boolean")
+ Checktype("symphony", lb, "lb", 5, "constant")
+ Checktype("symphony", ub, "lb", 6, "constant")
+ Checktype("symphony", A, "A", 7, "constant")
+ Checktype("symphony", conLB, "conlb", 8, "constant")
+ Checktype("symphony", conUB, "conub", 9, "constant")
+
// Check if the user gives empty matrix
if (size(lb,2)==0) then
lb = repmat(-%inf,nbVar,1);
diff --git a/macros/symphonymat.bin b/macros/symphonymat.bin
index a5e68ab..7dffa2f 100644
Binary files a/macros/symphonymat.bin and b/macros/symphonymat.bin differ
diff --git a/macros/symphonymat.sci b/macros/symphonymat.sci
index 3848850..2016f00 100644
--- a/macros/symphonymat.sci
+++ b/macros/symphonymat.sci
@@ -227,6 +227,16 @@ function [xopt,fopt,status,iter] = symphonymat (varargin)
options = varargin(9);
end
+ //Check type of variables
+ Checktype("symphonymat", c, "c", 1, "constant")
+ Checktype("symphonymat", intcon, "intcon", 2, "constant")
+ Checktype("symphonymat", A, "A", 3, "constant")
+ Checktype("symphonymat", b, "b", 4, "constant")
+ Checktype("symphonymat", Aeq, "Aeq", 5, "constant")
+ Checktype("symphonymat", beq, "beq", 6, "constant")
+ Checktype("symphonymat", lb, "lb", 7, "constant")
+ Checktype("symphonymat", ub, "ub", 8, "constant")
+
// Check if the user gives empty matrix
if (size(lb,2)==0) then
lb = repmat(-%inf,nbVar,1);
diff --git a/sci_gateway/builder_gateway.sce b/sci_gateway/builder_gateway.sce
index 514d206..de09d9c 100644
--- a/sci_gateway/builder_gateway.sce
+++ b/sci_gateway/builder_gateway.sce
@@ -1,13 +1,13 @@
// Copyright (C) 2015 - IIT Bombay - FOSSEE
//
-// Author: Harpreet Singh
-// Organization: FOSSEE, IIT Bombay
-// Email: harpreet.mertia@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: Harpreet Singh
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
sci_gateway_dir = get_absolute_file_path('builder_gateway.sce');
diff --git a/sci_gateway/cpp/builder_gateway_cpp.sce b/sci_gateway/cpp/builder_gateway_cpp.sce
index 3503996..c92bd7f 100644
--- a/sci_gateway/cpp/builder_gateway_cpp.sce
+++ b/sci_gateway/cpp/builder_gateway_cpp.sce
@@ -1,22 +1,24 @@
// Copyright (C) 2015 - IIT Bombay - FOSSEE
//
-// Author: Keyur Joshi, Sai Kiran, Iswarya and Harpreet Singh
-// Organization: FOSSEE, IIT Bombay
-// Email: harpreet.mertia@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: Harpreet Singh
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
mode(-1)
lines(0)
-toolbox_title = "FAMOS";
+toolbox_title = "FOSSEE_Optimization_Toolbox";
[a, opt] = getversion();
Version = opt(2);
+Build_64Bits = %f;
+
path_builder = get_absolute_file_path('builder_gateway_cpp.sce');
tools_path = path_builder + "../../thirdparty/linux/";
diff --git a/sci_gateway/cpp/cleaner.sce b/sci_gateway/cpp/cleaner.sce
index 27b5409..333775c 100644
--- a/sci_gateway/cpp/cleaner.sce
+++ b/sci_gateway/cpp/cleaner.sce
@@ -10,12 +10,12 @@ if fileinfo('loader.sce') <> [] then
mdelete('loader.sce');
end
// ------------------------------------------------------
-if fileinfo('libFAMOS.so') <> [] then
- mdelete('libFAMOS.so');
+if fileinfo('libFOSSEE_Optimization_Toolbox.so') <> [] then
+ mdelete('libFOSSEE_Optimization_Toolbox.so');
end
// ------------------------------------------------------
-if fileinfo('libFAMOS.c') <> [] then
- mdelete('libFAMOS.c');
+if fileinfo('libFOSSEE_Optimization_Toolbox.c') <> [] then
+ mdelete('libFOSSEE_Optimization_Toolbox.c');
end
// ------------------------------------------------------
chdir(curdir);
diff --git a/sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.c b/sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.c
new file mode 100644
index 0000000..cd53066
--- /dev/null
+++ b/sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.c
@@ -0,0 +1,156 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include
+#include
+#include
+#include
+static int direct_gateway(char *fname,void F(void)) { F();return 0;};
+extern Gatefunc sci_sym_open;
+extern Gatefunc sci_sym_close;
+extern Gatefunc sci_sym_isEnvActive;
+extern Gatefunc sci_sym_set_defaults;
+extern Gatefunc sci_sym_set_int_param;
+extern Gatefunc sci_sym_get_int_param;
+extern Gatefunc sci_sym_set_dbl_param;
+extern Gatefunc sci_sym_get_dbl_param;
+extern Gatefunc sci_sym_set_str_param;
+extern Gatefunc sci_sym_get_str_param;
+extern Gatefunc sci_sym_getInfinity;
+extern Gatefunc sci_sym_loadProblemBasic;
+extern Gatefunc sci_sym_loadProblem;
+extern Gatefunc sci_sym_load_mps;
+extern Gatefunc sci_sym_get_num_int;
+extern Gatefunc sci_sym_get_num_int;
+extern Gatefunc sci_sym_get_num_int;
+extern Gatefunc sci_sym_isContinuous;
+extern Gatefunc sci_sym_isBinary;
+extern Gatefunc sci_sym_isInteger;
+extern Gatefunc sci_sym_set_continuous;
+extern Gatefunc sci_sym_set_integer;
+extern Gatefunc sci_sym_get_dbl_arr;
+extern Gatefunc sci_sym_get_dbl_arr;
+extern Gatefunc sci_sym_setVarBound;
+extern Gatefunc sci_sym_setVarBound;
+extern Gatefunc sci_sym_get_dbl_arr;
+extern Gatefunc sci_sym_setObjCoeff;
+extern Gatefunc sci_sym_getObjSense;
+extern Gatefunc sci_sym_setObjSense;
+extern Gatefunc sci_sym_get_dbl_arr;
+extern Gatefunc sci_sym_get_dbl_arr;
+extern Gatefunc sci_sym_get_dbl_arr;
+extern Gatefunc sci_sym_get_dbl_arr;
+extern Gatefunc sci_sym_setConstrBound;
+extern Gatefunc sci_sym_setConstrBound;
+extern Gatefunc sci_sym_setConstrType;
+extern Gatefunc sci_sym_get_matrix;
+extern Gatefunc sci_sym_get_row_sense;
+extern Gatefunc sci_sym_addConstr;
+extern Gatefunc sci_sym_addVar;
+extern Gatefunc sci_sym_delete_cols;
+extern Gatefunc sci_sym_delete_rows;
+extern Gatefunc sci_sym_getPrimalBound;
+extern Gatefunc sci_sym_setPrimalBound;
+extern Gatefunc sci_sym_setColSoln;
+extern Gatefunc sci_sym_solve;
+extern Gatefunc sci_sym_get_status;
+extern Gatefunc sci_sym_get_solver_status;
+extern Gatefunc sci_sym_get_solver_status;
+extern Gatefunc sci_sym_get_solver_status;
+extern Gatefunc sci_sym_get_solver_status;
+extern Gatefunc sci_sym_get_solver_status;
+extern Gatefunc sci_sym_get_solver_status;
+extern Gatefunc sci_sym_getVarSoln;
+extern Gatefunc sci_sym_getObjVal;
+extern Gatefunc sci_sym_get_iteration_count;
+extern Gatefunc sci_sym_getRowActivity;
+extern Gatefunc sci_linearprog;
+extern Gatefunc sci_rmps;
+extern Gatefunc sci_solveqp;
+extern Gatefunc sci_solveminuncp;
+extern Gatefunc sci_solveminbndp;
+extern Gatefunc sci_solveminconp;
+static GenericTable Tab[]={
+ {(Myinterfun)sci_gateway,sci_sym_open,"sym_open"},
+ {(Myinterfun)sci_gateway,sci_sym_close,"sym_close"},
+ {(Myinterfun)sci_gateway,sci_sym_isEnvActive,"sym_isEnvActive"},
+ {(Myinterfun)sci_gateway,sci_sym_set_defaults,"sym_resetParams"},
+ {(Myinterfun)sci_gateway,sci_sym_set_int_param,"sym_setIntParam"},
+ {(Myinterfun)sci_gateway,sci_sym_get_int_param,"sym_getIntParam"},
+ {(Myinterfun)sci_gateway,sci_sym_set_dbl_param,"sym_setDblParam"},
+ {(Myinterfun)sci_gateway,sci_sym_get_dbl_param,"sym_getDblParam"},
+ {(Myinterfun)sci_gateway,sci_sym_set_str_param,"sym_setStrParam"},
+ {(Myinterfun)sci_gateway,sci_sym_get_str_param,"sym_getStrParam"},
+ {(Myinterfun)sci_gateway,sci_sym_getInfinity,"sym_getInfinity"},
+ {(Myinterfun)sci_gateway,sci_sym_loadProblemBasic,"sym_loadProblemBasic"},
+ {(Myinterfun)sci_gateway,sci_sym_loadProblem,"sym_loadProblem"},
+ {(Myinterfun)sci_gateway,sci_sym_load_mps,"sym_loadMPS"},
+ {(Myinterfun)sci_gateway,sci_sym_get_num_int,"sym_getNumConstr"},
+ {(Myinterfun)sci_gateway,sci_sym_get_num_int,"sym_getNumVar"},
+ {(Myinterfun)sci_gateway,sci_sym_get_num_int,"sym_getNumElements"},
+ {(Myinterfun)sci_gateway,sci_sym_isContinuous,"sym_isContinuous"},
+ {(Myinterfun)sci_gateway,sci_sym_isBinary,"sym_isBinary"},
+ {(Myinterfun)sci_gateway,sci_sym_isInteger,"sym_isInteger"},
+ {(Myinterfun)sci_gateway,sci_sym_set_continuous,"sym_setContinuous"},
+ {(Myinterfun)sci_gateway,sci_sym_set_integer,"sym_setInteger"},
+ {(Myinterfun)sci_gateway,sci_sym_get_dbl_arr,"sym_getVarLower"},
+ {(Myinterfun)sci_gateway,sci_sym_get_dbl_arr,"sym_getVarUpper"},
+ {(Myinterfun)sci_gateway,sci_sym_setVarBound,"sym_setVarLower"},
+ {(Myinterfun)sci_gateway,sci_sym_setVarBound,"sym_setVarUpper"},
+ {(Myinterfun)sci_gateway,sci_sym_get_dbl_arr,"sym_getObjCoeff"},
+ {(Myinterfun)sci_gateway,sci_sym_setObjCoeff,"sym_setObjCoeff"},
+ {(Myinterfun)sci_gateway,sci_sym_getObjSense,"sym_getObjSense"},
+ {(Myinterfun)sci_gateway,sci_sym_setObjSense,"sym_setObjSense"},
+ {(Myinterfun)sci_gateway,sci_sym_get_dbl_arr,"sym_getRhs"},
+ {(Myinterfun)sci_gateway,sci_sym_get_dbl_arr,"sym_getConstrRange"},
+ {(Myinterfun)sci_gateway,sci_sym_get_dbl_arr,"sym_getConstrLower"},
+ {(Myinterfun)sci_gateway,sci_sym_get_dbl_arr,"sym_getConstrUpper"},
+ {(Myinterfun)sci_gateway,sci_sym_setConstrBound,"sym_setConstrLower"},
+ {(Myinterfun)sci_gateway,sci_sym_setConstrBound,"sym_setConstrUpper"},
+ {(Myinterfun)sci_gateway,sci_sym_setConstrType,"sym_setConstrType"},
+ {(Myinterfun)sci_gateway,sci_sym_get_matrix,"sym_getMatrix"},
+ {(Myinterfun)sci_gateway,sci_sym_get_row_sense,"sym_getConstrSense"},
+ {(Myinterfun)sci_gateway,sci_sym_addConstr,"sym_addConstr"},
+ {(Myinterfun)sci_gateway,sci_sym_addVar,"sym_addVar"},
+ {(Myinterfun)sci_gateway,sci_sym_delete_cols,"sym_deleteVars"},
+ {(Myinterfun)sci_gateway,sci_sym_delete_rows,"sym_deleteConstrs"},
+ {(Myinterfun)sci_gateway,sci_sym_getPrimalBound,"sym_getPrimalBound"},
+ {(Myinterfun)sci_gateway,sci_sym_setPrimalBound,"sym_setPrimalBound"},
+ {(Myinterfun)sci_gateway,sci_sym_setColSoln,"sym_setVarSoln"},
+ {(Myinterfun)sci_gateway,sci_sym_solve,"sym_solve"},
+ {(Myinterfun)sci_gateway,sci_sym_get_status,"sym_getStatus"},
+ {(Myinterfun)sci_gateway,sci_sym_get_solver_status,"sym_isOptimal"},
+ {(Myinterfun)sci_gateway,sci_sym_get_solver_status,"sym_isInfeasible"},
+ {(Myinterfun)sci_gateway,sci_sym_get_solver_status,"sym_isAbandoned"},
+ {(Myinterfun)sci_gateway,sci_sym_get_solver_status,"sym_isIterLimitReached"},
+ {(Myinterfun)sci_gateway,sci_sym_get_solver_status,"sym_isTimeLimitReached"},
+ {(Myinterfun)sci_gateway,sci_sym_get_solver_status,"sym_isTargetGapAchieved"},
+ {(Myinterfun)sci_gateway,sci_sym_getVarSoln,"sym_getVarSoln"},
+ {(Myinterfun)sci_gateway,sci_sym_getObjVal,"sym_getObjVal"},
+ {(Myinterfun)sci_gateway,sci_sym_get_iteration_count,"sym_getIterCount"},
+ {(Myinterfun)sci_gateway,sci_sym_getRowActivity,"sym_getConstrActivity"},
+ {(Myinterfun)sci_gateway,sci_linearprog,"linearprog"},
+ {(Myinterfun)sci_gateway,sci_rmps,"rmps"},
+ {(Myinterfun)sci_gateway,sci_solveqp,"solveqp"},
+ {(Myinterfun)sci_gateway,sci_solveminuncp,"solveminuncp"},
+ {(Myinterfun)sci_gateway,sci_solveminbndp,"solveminbndp"},
+ {(Myinterfun)sci_gateway,sci_solveminconp,"solveminconp"},
+};
+
+int C2F(libFOSSEE_Optimization_Toolbox)()
+{
+ Rhs = Max(0, Rhs);
+ if (*(Tab[Fin-1].f) != NULL)
+ {
+ if(pvApiCtx == NULL)
+ {
+ pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx));
+ }
+ pvApiCtx->pstName = (char*)Tab[Fin-1].name;
+ (*(Tab[Fin-1].f))(Tab[Fin-1].name,Tab[Fin-1].F);
+ }
+ return 0;
+}
+#ifdef __cplusplus
+}
+#endif
diff --git a/sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.so b/sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.so
new file mode 100755
index 0000000..1f7e424
Binary files /dev/null and b/sci_gateway/cpp/libFOSSEE_Optimization_Toolbox.so differ
diff --git a/sci_gateway/cpp/loader.sce b/sci_gateway/cpp/loader.sce
index 37305c7..1ec953f 100644
--- a/sci_gateway/cpp/loader.sce
+++ b/sci_gateway/cpp/loader.sce
@@ -2,10 +2,10 @@
// Generated by builder.sce : Please, do not edit this file
// ----------------------------------------------------------------------------
//
-libFAMOS_path = get_absolute_file_path('loader.sce');
+libFOSSEE_Optimizat_path = get_absolute_file_path('loader.sce');
//
// ulink previous function with same name
-[bOK, ilib] = c_link('libFAMOS');
+[bOK, ilib] = c_link('libFOSSEE_Optimization_Toolbox');
if bOK then
ulink(ilib);
end
@@ -75,9 +75,9 @@ list_functions = [ 'sym_open';
'solveminbndp';
'solveminconp';
];
-addinter(libFAMOS_path + filesep() + 'libFAMOS' + getdynlibext(), 'libFAMOS', list_functions);
+addinter(libFOSSEE_Optimizat_path + filesep() + 'libFOSSEE_Optimization_Toolbox' + getdynlibext(), 'libFOSSEE_Optimization_Toolbox', list_functions);
// remove temp. variables on stack
-clear libFAMOS_path;
+clear libFOSSEE_Optimizat_path;
clear bOK;
clear ilib;
clear list_functions;
diff --git a/tests/general_tests/linprog/linprog_A1.sce b/tests/general_tests/linprog/linprog_A1.sce
new file mode 100644
index 0000000..bb3a00a
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_A1.sce
@@ -0,0 +1,18 @@
+// Check for elements in A
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+
+//Error
+//linprog: The number of columns in A must be the same as the number of elements of c
+//at line 113 of function matrix_linprog called by :
+//at line 169 of function linprog called by :
+//[xopt,fopt,exitflag,output,lambda]=linprog(c, b, b, Aeq, beq)
+//at line 30 of exec file called by :
+//exec linprog_A1.sce
+
+[xopt,fopt,exitflag,output,lambda]=linprog(c, b, b, Aeq, beq)
+
+
diff --git a/tests/general_tests/linprog/linprog_Aeq1.sce b/tests/general_tests/linprog/linprog_Aeq1.sce
new file mode 100644
index 0000000..6f1ca6e
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_Aeq1.sce
@@ -0,0 +1,18 @@
+// Check for elements in Aeq
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+
+//Error
+//linprog: The number of columns in Aeq must be the same as the number of elements of c
+//at line 119 of function matrix_linprog called by :
+//at line 169 of function linprog called by :
+//[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, beq, beq)
+//at line 16 of exec file called by :
+//exec linprog_Aeq1.sce
+
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, beq, beq)
+
+
diff --git a/tests/general_tests/linprog/linprog_b1.sce b/tests/general_tests/linprog/linprog_b1.sce
new file mode 100644
index 0000000..6b8ecd8
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_b1.sce
@@ -0,0 +1,17 @@
+// Check for elements in b
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+
+//Error
+//linprog: The number of rows in A must be the same as the number of elements of b
+//at line 133 of function matrix_linprog called by :
+//at line 169 of function linprog called by :
+//[xopt,fopt,exitflag,output,lambda]=linprog(c, A, beq, Aeq, beq)
+//at line 16 of exec file called by :
+//exec linprog_b1.sce
+
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A, beq, Aeq, beq)
+
diff --git a/tests/general_tests/linprog/linprog_beq1.sce b/tests/general_tests/linprog/linprog_beq1.sce
new file mode 100644
index 0000000..870d05f
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_beq1.sce
@@ -0,0 +1,17 @@
+// Check for elements in beq
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+
+//Error
+//linprog: The number of columns in Aeq must be the same as the number of elements of c
+//at line 119 of function matrix_linprog called by :
+//at line 169 of function linprog called by :
+//[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, beq, beq)
+//at line 16 of exec file called by :
+//exec linprog_Aeq1.sce
+
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, Aeq)
+
diff --git a/tests/general_tests/linprog/linprog_dual_infeasible1.sce b/tests/general_tests/linprog/linprog_dual_infeasible1.sce
new file mode 100644
index 0000000..9b910f4
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_dual_infeasible1.sce
@@ -0,0 +1,31 @@
+ //Dual Infeasible Problem
+ c=[3,5,-7]'
+ A=[-1,-1,4;1,1,4]
+ b=[-8,5]
+ Aeq=[]
+ beq=[]
+ lb=[-%inf,-%inf,-%inf]
+ ub=[%inf,%inf,%inf]
+ //Output
+ // Dual Infeasible.
+ // lambda =
+ //
+ // reduced_cost: [0,2,0]
+ // ineqlin: [-2.375,0.625]
+ // eqlin: [0x0 constant]
+ // output =
+ //
+ // Iterations: 2
+ // constrviolation: 0
+ // exitflag =
+ //
+ // 2.
+ // fopt =
+ //
+ // 22.125
+ // xopt =
+ //
+ // 6.5
+ // 0.
+ // - 0.375
+ [xopt,fopt,exitflag,output,lambda]= linprog(c,A,b,Aeq,beq,lb,ub)
diff --git a/tests/general_tests/linprog/linprog_input1.sce b/tests/general_tests/linprog/linprog_input1.sce
new file mode 100644
index 0000000..9921fe9
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_input1.sce
@@ -0,0 +1,17 @@
+// An example with inequality and equality constraints
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+
+//Error
+//linprog: Unexpected number of input arguments : 2 provided while should be in the set of [3 5 7 8]
+//at line 141 of function linprog called by :
+//[xopt,fopt,exitflag,output,lambda]=linprog(c, A)
+//at line 30 of exec file called by :
+//exec linprog_input1.sce
+
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A)
+
+
diff --git a/tests/general_tests/linprog/linprog_input2.sce b/tests/general_tests/linprog/linprog_input2.sce
new file mode 100644
index 0000000..a755efa
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_input2.sce
@@ -0,0 +1,17 @@
+// An example with inequality and equality constraints
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+
+//Error
+//linprog: Unexpected number of input arguments : 9 provided while should be in the set of [3 5 7 8]
+//at line 141 of function linprog called by :
+//[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq,[],[],[],[])
+//at line 15 of exec file called by :
+//exec linprog_input2.sce
+
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq,[],[],[],[])
+
+
diff --git a/tests/general_tests/linprog/linprog_logical1.sce b/tests/general_tests/linprog/linprog_logical1.sce
new file mode 100644
index 0000000..5dcc011
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_logical1.sce
@@ -0,0 +1,36 @@
+// An example with inequality constraints
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+
+//Output
+//Optimal Solution Found.
+// lambda =
+//
+// lower: [0,0]
+// upper: [0,0]
+// eqlin: [0x0 constant]
+// ineqlin: [0.0000422,0.0000089]
+// output =
+//
+// Iterations: 13
+// ConstrViolation: 0
+// exitflag =
+//
+// 0
+// residual =
+//
+// 0.3335021
+// 0.6666002
+// - 0.3332976
+// resnorm =
+//
+// 0.6666667
+// xopt =
+//
+// 0.3332490
+// - 0.3333512
+
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b)
+
+
diff --git a/tests/general_tests/linprog/linprog_logical2.sce b/tests/general_tests/linprog/linprog_logical2.sce
new file mode 100644
index 0000000..a8f99a7
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_logical2.sce
@@ -0,0 +1,32 @@
+// An example with inequality and equality constraints
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+
+//Output
+//Optimal Solution.
+// lambda =
+//
+// reduced_cost: [0,0]
+// ineqlin: [-0.1111111,0,0,0,0,0]
+// eqlin: -0.8888889
+// output =
+//
+// Iterations: 0
+// constrviolation: 0
+// exitflag =
+//
+// 0.
+// fopt =
+//
+// - 0.6666667
+// xopt =
+//
+// 0.
+// 2.
+
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq)
+
+
diff --git a/tests/general_tests/linprog/linprog_logical3.sce b/tests/general_tests/linprog/linprog_logical3.sce
new file mode 100644
index 0000000..a5b0bb7
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_logical3.sce
@@ -0,0 +1,32 @@
+// An example with variable bounds, inequality and equality constraints
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+lb=[-1,-0.5]
+ub=[1.5,1.25]
+
+//Output
+//Optimal Solution.
+// lambda =
+//
+// reduced_cost: [0,-0.0833333]
+// ineqlin: [0,0,0,0,0,0]
+// eqlin: -1
+// output =
+//
+// Iterations: 0
+// constrviolation: 0
+// exitflag =
+//
+// 0.
+// fopt =
+//
+// - 0.6041667
+// xopt =
+//
+// 0.1875
+// 1.25
+
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq, lb, ub)
diff --git a/tests/general_tests/linprog/linprog_logical4.sce b/tests/general_tests/linprog/linprog_logical4.sce
new file mode 100644
index 0000000..7b765fa
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_logical4.sce
@@ -0,0 +1,33 @@
+// An example with inequality constraints
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+lb=[-1,-0.5]
+ub=[1.5,1.25]
+params = list("maxiter",20)
+
+//Output
+//Optimal Solution.
+// lambda =
+//
+// reduced_cost: [0,-0.0833333]
+// ineqlin: [0,0,0,0,0,0]
+// eqlin: -1
+// output =
+//
+// Iterations: 0
+// constrviolation: 0
+// exitflag =
+//
+// 0.
+// fopt =
+//
+// - 0.6041667
+// xopt =
+//
+// 0.1875
+// 1.25
+
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq, lb, ub,params)
diff --git a/tests/general_tests/linprog/linprog_maxiter.sce b/tests/general_tests/linprog/linprog_maxiter.sce
new file mode 100644
index 0000000..0796f17
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_maxiter.sce
@@ -0,0 +1,32 @@
+// An example with inequality constraints
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+
+param = list("maxiter",3)
+
+//Output
+//Iteration limit reached.
+// lambda =
+//
+// reduced_cost: [0,0]
+// ineqlin: [0,0,0,0,0.6666667,0.3333333]
+// eqlin: [0x0 constant]
+// output =
+//
+// Iterations: 3
+// constrviolation: 0.7999992
+// exitflag =
+//
+// 3.
+// fopt =
+//
+// - 1.1999995
+// xopt =
+//
+// 0.3999996
+// 2.3999996
+
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b,[],[],[],[],param)
+
+
diff --git a/tests/general_tests/linprog/linprog_null1.sce b/tests/general_tests/linprog/linprog_null1.sce
new file mode 100644
index 0000000..7a8b053
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_null1.sce
@@ -0,0 +1,17 @@
+// Check for null elements
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+
+//Error
+//linprog: Cannot determine the number of variables because input objective coefficients is empty
+//at line 24 of function matrix_linprog called by :
+//at line 169 of function linprog called by :
+//[xopt,fopt,exitflag,output,lambda]=linprog([],[],[])
+//at line 29 of exec file called by :
+//exec linprog_null1.sce
+
+[xopt,fopt,exitflag,output,lambda]=linprog([],[],[])
+
diff --git a/tests/general_tests/linprog/linprog_param1.sce b/tests/general_tests/linprog/linprog_param1.sce
new file mode 100644
index 0000000..6dcd8c6
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_param1.sce
@@ -0,0 +1,19 @@
+// Check for the param to be a list
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+lb=[-1,-0.5]
+ub=[1.5,1.25]
+params = 0
+
+//Error
+//linprog: options should be a list
+//at line 85 of function matrix_linprog called by :
+//at line 169 of function linprog called by :
+//[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq, lb, ub,params)
+//at line 33 of exec file called by :
+//exec lsqlin_param1.sce
+
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq, lb, ub,params)
diff --git a/tests/general_tests/linprog/linprog_param2.sce b/tests/general_tests/linprog/linprog_param2.sce
new file mode 100644
index 0000000..5b956b5
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_param2.sce
@@ -0,0 +1,19 @@
+// Check for the param to be even in number
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+lb=[-1,-0.5]
+ub=[1.5,1.25]
+params = list("maxiter")
+
+//Error
+//linprog: Size of parameters should be even
+//at line 91 of function matrix_linprog called by :
+//at line 169 of function linprog called by :
+//[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq, lb, ub,params)
+//at line 13 of exec file called by :
+//exec lsqlin_param2.sce
+
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq, lb, ub,params)
diff --git a/tests/general_tests/linprog/linprog_param3.sce b/tests/general_tests/linprog/linprog_param3.sce
new file mode 100644
index 0000000..42dbf13
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_param3.sce
@@ -0,0 +1,21 @@
+// Check for the correct name of param
+// An example with inequality constraints
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+lb=[-1,-0.5]
+ub=[1.5,1.25]
+params = list("iter",20)
+
+//Error
+//linprog: Unrecognized parameter name 'iter'.
+//at line 103 of function matrix_linprog called by :
+//at line 169 of function linprog called by :
+//[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq, lb, ub,params)
+//at line 34 of exec file called by :
+//exec lsqlin_param3.sce
+
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq, lb, ub,params)
+
diff --git a/tests/general_tests/linprog/linprog_primal_infeasible1.sce b/tests/general_tests/linprog/linprog_primal_infeasible1.sce
new file mode 100644
index 0000000..e267e13
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_primal_infeasible1.sce
@@ -0,0 +1,34 @@
+//Primal Infeasible Problem
+c=[-1,-1,-1]'
+A=[1,2,-1]
+b=[-4]
+Aeq=[1,5,3;1,1,0]
+beq=[10,100]
+lb=[0,0,0]
+ub=[%inf,%inf,%inf]
+
+//Output
+//Primal Infeasible.
+// lambda =
+//
+// reduced_cost: [0,2.5,0]
+// ineqlin: -0.5
+// eqlin: [-0.5,0]
+// output =
+//
+// Iterations: 2
+// constrviolation: 100.5
+// exitflag =
+//
+// 1.
+// fopt =
+//
+// - 3.
+// xopt =
+//
+// - 0.5
+// 0.
+// 3.5
+
+[xopt,fopt,exitflag,output,lambda]= linprog(c,A,b,Aeq,beq,lb,ub)
+
diff --git a/tests/general_tests/linprog/linprog_zeros1.sce b/tests/general_tests/linprog/linprog_zeros1.sce
new file mode 100644
index 0000000..fffc6b5
--- /dev/null
+++ b/tests/general_tests/linprog/linprog_zeros1.sce
@@ -0,0 +1,30 @@
+// Check for elements all zeros
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+
+//Output
+//Optimal Solution.
+// lambda =
+//
+// reduced_cost: 0
+// ineqlin: 0
+// eqlin: [0x0 constant]
+// output =
+//
+// Iterations: 4
+// constrviolation: 0
+// exitflag =
+//
+// 0.
+// fopt =
+//
+// 0.
+// xopt =
+//
+// 0.
+
+[xopt,fopt,exitflag,output,lambda]=linprog(0,0,0)
+
diff --git a/tests/general_tests/lsqlin/lsqlin_param3.sce b/tests/general_tests/lsqlin/lsqlin_param3.sce
index 283c6e2..be8012b 100644
--- a/tests/general_tests/lsqlin/lsqlin_param3.sce
+++ b/tests/general_tests/lsqlin/lsqlin_param3.sce
@@ -1,4 +1,4 @@
-// Check for the param to be even in number
+// Check for the correct name of param
C = [2 0;
-1 1;
0 2]
diff --git a/tests/unit_tests/fgoalattain.dia.ref b/tests/unit_tests/fgoalattain.dia.ref
new file mode 100644
index 0000000..3587dd3
--- /dev/null
+++ b/tests/unit_tests/fgoalattain.dia.ref
@@ -0,0 +1,74 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: Prajwala TM,Sheetal Shalini
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+// 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
+
+// <-- JVM NOT MANDATORY -->
+// <-- ENGLISH IMPOSED -->
+
+
+//
+// assert_close --
+// Returns 1 if the two real matrices computed and expected are close,
+// i.e. if the relative distance between computed and expected is lesser than epsilon.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+function flag = assert_close ( computed, expected, epsilon )
+ if expected==0.0 then
+ shift = norm(computed-expected);
+ else
+ shift = norm(computed-expected)/norm(expected);
+ end
+// if shift < epsilon then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+ flag = assert_checktrue ( shift < epsilon );
+endfunction
+//
+// assert_equal --
+// Returns 1 if the two real matrices computed and expected are equal.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+//function flag = assert_equal ( computed , expected )
+// if computed==expected then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+//endfunction
+
+
+function f1 = fun(x)
+f1(1)=2*x(1)*x(1)+x(2)*x(2)-48*x(1)-40*x(2)+304
+f1(2)=-x(1)*x(1)-3*x(2)*x(2)
+f1(3)=x(1)+3*x(2)-18
+f1(4)=-x(1)-x(2)
+f1(5)=x(1)+x(2)-8
+endfunction
+x0=[-1,1];
+goal=[-5,-3,-2,-1,-4];
+weight=abs(goal)
+//xopt = [-0.0000011 -63.999998 -2.0000002 -8 3.485D-08]
+//fval = [4 3.99]
+//Run fgoalattain
+[xopt,fval,attainfactor,exitflag,output,lambda]=fgoalattain(fun,x0,goal,weight)
+
+assert_close ( xopt , [ 4 4 ]' , 0.0005 );
+assert_close ( fval , [ -0.0000011 -63.999998 -2.0000002 -8. 0 ]' , 0.0005 );
+assert_checkequal( exitflag , int32(0) );
+printf("Test Successful");
diff --git a/tests/unit_tests/fgoalattain.tst b/tests/unit_tests/fgoalattain.tst
new file mode 100644
index 0000000..3587dd3
--- /dev/null
+++ b/tests/unit_tests/fgoalattain.tst
@@ -0,0 +1,74 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: Prajwala TM,Sheetal Shalini
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+// 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
+
+// <-- JVM NOT MANDATORY -->
+// <-- ENGLISH IMPOSED -->
+
+
+//
+// assert_close --
+// Returns 1 if the two real matrices computed and expected are close,
+// i.e. if the relative distance between computed and expected is lesser than epsilon.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+function flag = assert_close ( computed, expected, epsilon )
+ if expected==0.0 then
+ shift = norm(computed-expected);
+ else
+ shift = norm(computed-expected)/norm(expected);
+ end
+// if shift < epsilon then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+ flag = assert_checktrue ( shift < epsilon );
+endfunction
+//
+// assert_equal --
+// Returns 1 if the two real matrices computed and expected are equal.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+//function flag = assert_equal ( computed , expected )
+// if computed==expected then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+//endfunction
+
+
+function f1 = fun(x)
+f1(1)=2*x(1)*x(1)+x(2)*x(2)-48*x(1)-40*x(2)+304
+f1(2)=-x(1)*x(1)-3*x(2)*x(2)
+f1(3)=x(1)+3*x(2)-18
+f1(4)=-x(1)-x(2)
+f1(5)=x(1)+x(2)-8
+endfunction
+x0=[-1,1];
+goal=[-5,-3,-2,-1,-4];
+weight=abs(goal)
+//xopt = [-0.0000011 -63.999998 -2.0000002 -8 3.485D-08]
+//fval = [4 3.99]
+//Run fgoalattain
+[xopt,fval,attainfactor,exitflag,output,lambda]=fgoalattain(fun,x0,goal,weight)
+
+assert_close ( xopt , [ 4 4 ]' , 0.0005 );
+assert_close ( fval , [ -0.0000011 -63.999998 -2.0000002 -8. 0 ]' , 0.0005 );
+assert_checkequal( exitflag , int32(0) );
+printf("Test Successful");
diff --git a/tests/unit_tests/fminbnd.dia.ref b/tests/unit_tests/fminbnd.dia.ref
new file mode 100644
index 0000000..bed9eae
--- /dev/null
+++ b/tests/unit_tests/fminbnd.dia.ref
@@ -0,0 +1,71 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: R.Vidyadhar & Vignesh Kannan
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+// 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
+
+// <-- JVM NOT MANDATORY -->
+// <-- ENGLISH IMPOSED -->
+
+
+//
+// assert_close --
+// Returns 1 if the two real matrices computed and expected are close,
+// i.e. if the relative distance between computed and expected is lesser than epsilon.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+function flag = assert_close ( computed, expected, epsilon )
+ if expected==0.0 then
+ shift = norm(computed-expected);
+ else
+ shift = norm(computed-expected)/norm(expected);
+ end
+// if shift < epsilon then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+ flag = assert_checktrue ( shift < epsilon );
+endfunction
+//
+// assert_equal --
+// Returns 1 if the two real matrices computed and expected are equal.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+//function flag = assert_equal ( computed , expected )
+// if computed==expected then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+//endfunction
+
+//Find x in R such that it minimizes:
+//f(x)= 1/x^2
+//0 <= x <= 1000
+//Objective function to be minimised
+function y=f(x)
+y=1/x^2
+endfunction
+//Variable bounds
+x1 = [0];
+x2 = [1000];
+//Calling Ipopt
+[xopt,fval,exitflag,output,lambda] =fminbnd(f, x1, x2)
+
+assert_close ( xopt , [ 32.27955 ]' , 0.0005 );
+assert_close ( fval , [ 0.0009597 ]' , 0.0005 );
+assert_checkequal( exitflag , int32(0) );
+printf("Test Successful");
diff --git a/tests/unit_tests/fminbnd.tst b/tests/unit_tests/fminbnd.tst
new file mode 100644
index 0000000..bed9eae
--- /dev/null
+++ b/tests/unit_tests/fminbnd.tst
@@ -0,0 +1,71 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: R.Vidyadhar & Vignesh Kannan
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+// 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
+
+// <-- JVM NOT MANDATORY -->
+// <-- ENGLISH IMPOSED -->
+
+
+//
+// assert_close --
+// Returns 1 if the two real matrices computed and expected are close,
+// i.e. if the relative distance between computed and expected is lesser than epsilon.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+function flag = assert_close ( computed, expected, epsilon )
+ if expected==0.0 then
+ shift = norm(computed-expected);
+ else
+ shift = norm(computed-expected)/norm(expected);
+ end
+// if shift < epsilon then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+ flag = assert_checktrue ( shift < epsilon );
+endfunction
+//
+// assert_equal --
+// Returns 1 if the two real matrices computed and expected are equal.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+//function flag = assert_equal ( computed , expected )
+// if computed==expected then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+//endfunction
+
+//Find x in R such that it minimizes:
+//f(x)= 1/x^2
+//0 <= x <= 1000
+//Objective function to be minimised
+function y=f(x)
+y=1/x^2
+endfunction
+//Variable bounds
+x1 = [0];
+x2 = [1000];
+//Calling Ipopt
+[xopt,fval,exitflag,output,lambda] =fminbnd(f, x1, x2)
+
+assert_close ( xopt , [ 32.27955 ]' , 0.0005 );
+assert_close ( fval , [ 0.0009597 ]' , 0.0005 );
+assert_checkequal( exitflag , int32(0) );
+printf("Test Successful");
diff --git a/tests/unit_tests/fmincon.dia.ref b/tests/unit_tests/fmincon.dia.ref
new file mode 100644
index 0000000..26d29ea
--- /dev/null
+++ b/tests/unit_tests/fmincon.dia.ref
@@ -0,0 +1,98 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: R.Vidyadhar & Vignesh Kannan
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+// 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
+
+// <-- JVM NOT MANDATORY -->
+// <-- ENGLISH IMPOSED -->
+
+
+//
+// assert_close --
+// Returns 1 if the two real matrices computed and expected are close,
+// i.e. if the relative distance between computed and expected is lesser than epsilon.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+function flag = assert_close ( computed, expected, epsilon )
+ if expected==0.0 then
+ shift = norm(computed-expected);
+ else
+ shift = norm(computed-expected)/norm(expected);
+ end
+// if shift < epsilon then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+ flag = assert_checktrue ( shift < epsilon );
+endfunction
+//
+// assert_equal --
+// Returns 1 if the two real matrices computed and expected are equal.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+//function flag = assert_equal ( computed , expected )
+// if computed==expected then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+//endfunction
+
+//Find x in R^3 such that it minimizes:
+//f(x)= x1*x2 + x2*x3
+//x0=[0.1 , 0.1 , 0.1]
+//constraint-1 (c1): x1^2 - x2^2 + x3^2 <= 2
+//constraint-2 (c2): x1^2 + x2^2 + x3^2 <= 10
+//Objective function to be minimised
+function y=f(x)
+y=x(1)*x(2)+x(2)*x(3);
+endfunction
+//Starting point, linear constraints and variable bounds
+x0=[0.1 , 0.1 , 0.1];
+A=[];
+b=[];
+Aeq=[];
+beq=[];
+lb=[];
+ub=[];
+//Nonlinear constraints
+function [c,ceq]=nlc(x)
+c = [x(1)^2 - x(2)^2 + x(3)^2 - 2 , x(1)^2 + x(2)^2 + x(3)^2 - 10];
+ceq = [];
+endfunction
+//Gradient of objective function
+function y= fGrad(x)
+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,-2,0;0,0,2] + lambda(2)*[2,0,0;0,2,0;0,0,2]
+endfunction
+//Gradient of Non-Linear Constraints
+function [cg,ceqg] = cGrad(x)
+cg=[2*x(1) , -2*x(2) , 2*x(3) ; 2*x(1) , 2*x(2) , 2*x(3)];
+ceqg=[];
+endfunction
+//Options
+options=list("MaxIter", [1500], "CpuTime", [500], "GradObj", fGrad, "Hessian", lHess,"GradCon", cGrad);
+//Calling Ipopt
+[xopt,fval,exitflag,output] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options)
+
+assert_close ( xopt , [ -1.5811388 2.236068 -1.5811388 ]' , 0.0005 );
+assert_close ( fval , [-7.0710678 ]' , 0.0005 );
+assert_checkequal( exitflag , int32(0) );
+printf("Test Successful");
diff --git a/tests/unit_tests/fmincon.tst b/tests/unit_tests/fmincon.tst
new file mode 100644
index 0000000..26d29ea
--- /dev/null
+++ b/tests/unit_tests/fmincon.tst
@@ -0,0 +1,98 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: R.Vidyadhar & Vignesh Kannan
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+// 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
+
+// <-- JVM NOT MANDATORY -->
+// <-- ENGLISH IMPOSED -->
+
+
+//
+// assert_close --
+// Returns 1 if the two real matrices computed and expected are close,
+// i.e. if the relative distance between computed and expected is lesser than epsilon.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+function flag = assert_close ( computed, expected, epsilon )
+ if expected==0.0 then
+ shift = norm(computed-expected);
+ else
+ shift = norm(computed-expected)/norm(expected);
+ end
+// if shift < epsilon then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+ flag = assert_checktrue ( shift < epsilon );
+endfunction
+//
+// assert_equal --
+// Returns 1 if the two real matrices computed and expected are equal.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+//function flag = assert_equal ( computed , expected )
+// if computed==expected then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+//endfunction
+
+//Find x in R^3 such that it minimizes:
+//f(x)= x1*x2 + x2*x3
+//x0=[0.1 , 0.1 , 0.1]
+//constraint-1 (c1): x1^2 - x2^2 + x3^2 <= 2
+//constraint-2 (c2): x1^2 + x2^2 + x3^2 <= 10
+//Objective function to be minimised
+function y=f(x)
+y=x(1)*x(2)+x(2)*x(3);
+endfunction
+//Starting point, linear constraints and variable bounds
+x0=[0.1 , 0.1 , 0.1];
+A=[];
+b=[];
+Aeq=[];
+beq=[];
+lb=[];
+ub=[];
+//Nonlinear constraints
+function [c,ceq]=nlc(x)
+c = [x(1)^2 - x(2)^2 + x(3)^2 - 2 , x(1)^2 + x(2)^2 + x(3)^2 - 10];
+ceq = [];
+endfunction
+//Gradient of objective function
+function y= fGrad(x)
+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,-2,0;0,0,2] + lambda(2)*[2,0,0;0,2,0;0,0,2]
+endfunction
+//Gradient of Non-Linear Constraints
+function [cg,ceqg] = cGrad(x)
+cg=[2*x(1) , -2*x(2) , 2*x(3) ; 2*x(1) , 2*x(2) , 2*x(3)];
+ceqg=[];
+endfunction
+//Options
+options=list("MaxIter", [1500], "CpuTime", [500], "GradObj", fGrad, "Hessian", lHess,"GradCon", cGrad);
+//Calling Ipopt
+[xopt,fval,exitflag,output] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options)
+
+assert_close ( xopt , [ -1.5811388 2.236068 -1.5811388 ]' , 0.0005 );
+assert_close ( fval , [-7.0710678 ]' , 0.0005 );
+assert_checkequal( exitflag , int32(0) );
+printf("Test Successful");
diff --git a/tests/unit_tests/fminimax.dia.ref b/tests/unit_tests/fminimax.dia.ref
new file mode 100644
index 0000000..e887a38
--- /dev/null
+++ b/tests/unit_tests/fminimax.dia.ref
@@ -0,0 +1,105 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: Animesh Baranawal
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+// 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
+
+// <-- JVM NOT MANDATORY -->
+// <-- ENGLISH IMPOSED -->
+
+
+//
+// assert_close --
+// Returns 1 if the two real matrices computed and expected are close,
+// i.e. if the relative distance between computed and expected is lesser than epsilon.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+function flag = assert_close ( computed, expected, epsilon )
+ if expected==0.0 then
+ shift = norm(computed-expected);
+ else
+ shift = norm(computed-expected)/norm(expected);
+ end
+// if shift < epsilon then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+ flag = assert_checktrue ( shift < epsilon );
+endfunction
+//
+// assert_equal --
+// Returns 1 if the two real matrices computed and expected are equal.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+//function flag = assert_equal ( computed , expected )
+// if computed==expected then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+//endfunction
+
+// A case where we provide the gradient of the objective
+// functions and the Jacobian matrix of the constraints.
+// The objective function and its gradient
+function f = myfun(x)
+f(1)= 2*x(1)^2 + x(2)^2 - 48*x(1) - 40*x(2) + 304;
+f(2)= -x(1)^2 - 3*x(2)^2;
+f(3)= x(1) + 3*x(2) -18;
+f(4)= -x(1) - x(2);
+f(5)= x(1) + x(2) - 8;
+endfunction
+// Defining gradient of myfun
+function G = myfungrad(x)
+G = [ 4*x(1) - 48, -2*x(1), 1, -1, 1;
+2*x(2) - 40, -6*x(2), 3, -1, 1; ]'
+endfunction
+// The nonlinear constraints and the Jacobian
+// matrix of the constraints
+function [c,ceq] = confun(x)
+// Inequality constraints
+c = [1.5 + x(1)*x(2) - x(1) - x(2), -x(1)*x(2) - 10]
+// No nonlinear equality constraints
+ceq=[]
+endfunction
+// Defining gradient of confungrad
+function [DC,DCeq] = cgrad(x)
+// DC(:,i) = gradient of the i-th constraint
+// DC = [
+// Dc1/Dx1 Dc1/Dx2
+// Dc2/Dx1 Dc2/Dx2
+// ]
+DC= [
+x(2)-1, -x(2)
+x(1)-1, -x(1)
+]'
+DCeq = []'
+endfunction
+// Test with both gradient of objective and gradient of constraints
+minimaxOptions = list("GradObj",myfungrad,"GradCon",cgrad);
+// The initial guess
+x0 = [0,10];
+// The expected solution : only 4 digits are guaranteed
+//xopt = [0.92791 7.93551]
+//fopt = [6.73443 -189.778 6.73443 -8.86342 0.86342]
+maxfopt = 6.73443
+// Run fminimax
+[xopt,fopt,maxfval,exitflag,output] = fminimax(myfun,x0,[],[],[],[],[],[], confun, minimaxOptions)
+
+assert_close ( xopt , [ 8.6737161 0.9348425 ]' , 0.0005 );
+assert_close ( fopt , [ 1.6085585 -77.855143 -6.5217563 -9.6085587 1.6085587 ]' , 0.0005 );
+assert_checkequal( exitflag , int32(0) );
+printf("Test Successful");
diff --git a/tests/unit_tests/fminimax.tst b/tests/unit_tests/fminimax.tst
new file mode 100644
index 0000000..e887a38
--- /dev/null
+++ b/tests/unit_tests/fminimax.tst
@@ -0,0 +1,105 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: Animesh Baranawal
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+// 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
+
+// <-- JVM NOT MANDATORY -->
+// <-- ENGLISH IMPOSED -->
+
+
+//
+// assert_close --
+// Returns 1 if the two real matrices computed and expected are close,
+// i.e. if the relative distance between computed and expected is lesser than epsilon.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+function flag = assert_close ( computed, expected, epsilon )
+ if expected==0.0 then
+ shift = norm(computed-expected);
+ else
+ shift = norm(computed-expected)/norm(expected);
+ end
+// if shift < epsilon then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+ flag = assert_checktrue ( shift < epsilon );
+endfunction
+//
+// assert_equal --
+// Returns 1 if the two real matrices computed and expected are equal.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+//function flag = assert_equal ( computed , expected )
+// if computed==expected then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+//endfunction
+
+// A case where we provide the gradient of the objective
+// functions and the Jacobian matrix of the constraints.
+// The objective function and its gradient
+function f = myfun(x)
+f(1)= 2*x(1)^2 + x(2)^2 - 48*x(1) - 40*x(2) + 304;
+f(2)= -x(1)^2 - 3*x(2)^2;
+f(3)= x(1) + 3*x(2) -18;
+f(4)= -x(1) - x(2);
+f(5)= x(1) + x(2) - 8;
+endfunction
+// Defining gradient of myfun
+function G = myfungrad(x)
+G = [ 4*x(1) - 48, -2*x(1), 1, -1, 1;
+2*x(2) - 40, -6*x(2), 3, -1, 1; ]'
+endfunction
+// The nonlinear constraints and the Jacobian
+// matrix of the constraints
+function [c,ceq] = confun(x)
+// Inequality constraints
+c = [1.5 + x(1)*x(2) - x(1) - x(2), -x(1)*x(2) - 10]
+// No nonlinear equality constraints
+ceq=[]
+endfunction
+// Defining gradient of confungrad
+function [DC,DCeq] = cgrad(x)
+// DC(:,i) = gradient of the i-th constraint
+// DC = [
+// Dc1/Dx1 Dc1/Dx2
+// Dc2/Dx1 Dc2/Dx2
+// ]
+DC= [
+x(2)-1, -x(2)
+x(1)-1, -x(1)
+]'
+DCeq = []'
+endfunction
+// Test with both gradient of objective and gradient of constraints
+minimaxOptions = list("GradObj",myfungrad,"GradCon",cgrad);
+// The initial guess
+x0 = [0,10];
+// The expected solution : only 4 digits are guaranteed
+//xopt = [0.92791 7.93551]
+//fopt = [6.73443 -189.778 6.73443 -8.86342 0.86342]
+maxfopt = 6.73443
+// Run fminimax
+[xopt,fopt,maxfval,exitflag,output] = fminimax(myfun,x0,[],[],[],[],[],[], confun, minimaxOptions)
+
+assert_close ( xopt , [ 8.6737161 0.9348425 ]' , 0.0005 );
+assert_close ( fopt , [ 1.6085585 -77.855143 -6.5217563 -9.6085587 1.6085587 ]' , 0.0005 );
+assert_checkequal( exitflag , int32(0) );
+printf("Test Successful");
diff --git a/tests/unit_tests/fminunc.dia.ref b/tests/unit_tests/fminunc.dia.ref
new file mode 100644
index 0000000..d8cc387
--- /dev/null
+++ b/tests/unit_tests/fminunc.dia.ref
@@ -0,0 +1,79 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: R.Vidyadhar & Vignesh Kannan
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+// 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
+
+// <-- JVM NOT MANDATORY -->
+// <-- ENGLISH IMPOSED -->
+
+
+//
+// assert_close --
+// Returns 1 if the two real matrices computed and expected are close,
+// i.e. if the relative distance between computed and expected is lesser than epsilon.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+function flag = assert_close ( computed, expected, epsilon )
+ if expected==0.0 then
+ shift = norm(computed-expected);
+ else
+ shift = norm(computed-expected)/norm(expected);
+ end
+// if shift < epsilon then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+ flag = assert_checktrue ( shift < epsilon );
+endfunction
+//
+// assert_equal --
+// Returns 1 if the two real matrices computed and expected are equal.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+//function flag = assert_equal ( computed , expected )
+// if computed==expected then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+//endfunction
+
+//Find x in R^2 such that it minimizes the Rosenbrock function
+//f = 100*(x2 - x1^2)^2 + (1-x1)^2
+//Objective function to be minimised
+function y= f(x)
+y= 100*(x(2) - x(1)^2)^2 + (1-x(1))^2;
+endfunction
+//Starting point
+x0=[-1,2];
+//Gradient of objective function
+function y= fGrad(x)
+y= [-400*x(1)*x(2) + 400*x(1)^3 + 2*x(1)-2, 200*(x(2)-x(1)^2)];
+endfunction
+//Hessian of Objective Function
+function y= fHess(x)
+y= [1200*x(1)^2- 400*x(2) + 2, -400*x(1);-400*x(1), 200 ];
+endfunction
+//Options
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", fGrad, "Hessian", fHess);
+//Calling Ipopt
+[xopt,fopt,exitflag,output,gradient,hessian]=fminunc(f,x0,options)
+
+assert_close ( xopt , [ 1 1 ]' , 0.0005 );
+assert_close ( fopt , [0] , 0.0005 );
+assert_checkequal( exitflag , int32(0) );
+printf("Test Successful");
diff --git a/tests/unit_tests/fminunc.tst b/tests/unit_tests/fminunc.tst
new file mode 100644
index 0000000..d8cc387
--- /dev/null
+++ b/tests/unit_tests/fminunc.tst
@@ -0,0 +1,79 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: R.Vidyadhar & Vignesh Kannan
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+// 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
+
+// <-- JVM NOT MANDATORY -->
+// <-- ENGLISH IMPOSED -->
+
+
+//
+// assert_close --
+// Returns 1 if the two real matrices computed and expected are close,
+// i.e. if the relative distance between computed and expected is lesser than epsilon.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+function flag = assert_close ( computed, expected, epsilon )
+ if expected==0.0 then
+ shift = norm(computed-expected);
+ else
+ shift = norm(computed-expected)/norm(expected);
+ end
+// if shift < epsilon then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+ flag = assert_checktrue ( shift < epsilon );
+endfunction
+//
+// assert_equal --
+// Returns 1 if the two real matrices computed and expected are equal.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+//function flag = assert_equal ( computed , expected )
+// if computed==expected then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+//endfunction
+
+//Find x in R^2 such that it minimizes the Rosenbrock function
+//f = 100*(x2 - x1^2)^2 + (1-x1)^2
+//Objective function to be minimised
+function y= f(x)
+y= 100*(x(2) - x(1)^2)^2 + (1-x(1))^2;
+endfunction
+//Starting point
+x0=[-1,2];
+//Gradient of objective function
+function y= fGrad(x)
+y= [-400*x(1)*x(2) + 400*x(1)^3 + 2*x(1)-2, 200*(x(2)-x(1)^2)];
+endfunction
+//Hessian of Objective Function
+function y= fHess(x)
+y= [1200*x(1)^2- 400*x(2) + 2, -400*x(1);-400*x(1), 200 ];
+endfunction
+//Options
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", fGrad, "Hessian", fHess);
+//Calling Ipopt
+[xopt,fopt,exitflag,output,gradient,hessian]=fminunc(f,x0,options)
+
+assert_close ( xopt , [ 1 1 ]' , 0.0005 );
+assert_close ( fopt , [0] , 0.0005 );
+assert_checkequal( exitflag , int32(0) );
+printf("Test Successful");
diff --git a/tests/unit_tests/linprog.dia.ref b/tests/unit_tests/linprog.dia.ref
new file mode 100644
index 0000000..5c3d629
--- /dev/null
+++ b/tests/unit_tests/linprog.dia.ref
@@ -0,0 +1,68 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: Guru Pradeep Reddy, Bhanu Priya Sayal
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+// 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
+
+// <-- JVM NOT MANDATORY -->
+// <-- ENGLISH IMPOSED -->
+
+
+//
+// assert_close --
+// Returns 1 if the two real matrices computed and expected are close,
+// i.e. if the relative distance between computed and expected is lesser than epsilon.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+function flag = assert_close ( computed, expected, epsilon )
+ if expected==0.0 then
+ shift = norm(computed-expected);
+ else
+ shift = norm(computed-expected)/norm(expected);
+ end
+// if shift < epsilon then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+ flag = assert_checktrue ( shift < epsilon );
+endfunction
+//
+// assert_equal --
+// Returns 1 if the two real matrices computed and expected are equal.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+//function flag = assert_equal ( computed , expected )
+// if computed==expected then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+//endfunction
+
+//Linear program with all constraint types
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+lb=[-1,-0.5]
+ub=[1.5,1.25]
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq, lb, ub)
+
+assert_close ( xopt , [ 0.1875 1.25 ]' , 0.0005 );
+assert_close ( fopt , [ -0.6041667 ]' , 0.0005 );
+assert_checkequal( exitflag , 0 );
+printf("Test Successful");
diff --git a/tests/unit_tests/linprog.tst b/tests/unit_tests/linprog.tst
new file mode 100644
index 0000000..5c3d629
--- /dev/null
+++ b/tests/unit_tests/linprog.tst
@@ -0,0 +1,68 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// Author: Guru Pradeep Reddy, Bhanu Priya Sayal
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+// 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
+
+// <-- JVM NOT MANDATORY -->
+// <-- ENGLISH IMPOSED -->
+
+
+//
+// assert_close --
+// Returns 1 if the two real matrices computed and expected are close,
+// i.e. if the relative distance between computed and expected is lesser than epsilon.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+function flag = assert_close ( computed, expected, epsilon )
+ if expected==0.0 then
+ shift = norm(computed-expected);
+ else
+ shift = norm(computed-expected)/norm(expected);
+ end
+// if shift < epsilon then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+ flag = assert_checktrue ( shift < epsilon );
+endfunction
+//
+// assert_equal --
+// Returns 1 if the two real matrices computed and expected are equal.
+// Arguments
+// computed, expected : the two matrices to compare
+// epsilon : a small number
+//
+//function flag = assert_equal ( computed , expected )
+// if computed==expected then
+// flag = 1;
+// else
+// flag = 0;
+// end
+// if flag <> 1 then pause,end
+//endfunction
+
+//Linear program with all constraint types
+c=[-1,-1/3]'
+A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
+b=[2,1,2,1,-1,2]
+Aeq=[1,1/4]
+beq=[1/2]
+lb=[-1,-0.5]
+ub=[1.5,1.25]
+[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq, lb, ub)
+
+assert_close ( xopt , [ 0.1875 1.25 ]' , 0.0005 );
+assert_close ( fopt , [ -0.6041667 ]' , 0.0005 );
+assert_checkequal( exitflag , 0 );
+printf("Test Successful");
diff --git a/tests/unit_tests/qpipopt_base.dia.ref b/tests/unit_tests/qpipopt_base.dia.ref
index 25b440f..d85ed3e 100644
--- a/tests/unit_tests/qpipopt_base.dia.ref
+++ b/tests/unit_tests/qpipopt_base.dia.ref
@@ -68,9 +68,9 @@ nbVar = 6;
nbCon = 5;
x0 = repmat(0,nbVar,1);
param = list("MaxIter", 300, "CpuTime", 100);
-[xopt,fopt,exitflag,output,lambda] = qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param)
+[xopt,fopt,exitflag,output,lambda] = qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0,param)
-assert_close ( xopt , [1.7975426 -0.3381487 0.1633880 - 4.9884023 0.6054943 -3.1155623]' , 1.e-7 );
+assert_close ( xopt , [1.7975426 -0.3381487 0.1633880 -4.9884023 0.6054943 -3.1155623]' , 1.e-7 );
assert_close ( fopt , [ -14.843248] , 1.e-7 );
assert_checkequal( exitflag , int32(0) );
printf("Test Successful");
diff --git a/tests/unit_tests/qpipopt_base.tst b/tests/unit_tests/qpipopt_base.tst
index 25b440f..d85ed3e 100644
--- a/tests/unit_tests/qpipopt_base.tst
+++ b/tests/unit_tests/qpipopt_base.tst
@@ -68,9 +68,9 @@ nbVar = 6;
nbCon = 5;
x0 = repmat(0,nbVar,1);
param = list("MaxIter", 300, "CpuTime", 100);
-[xopt,fopt,exitflag,output,lambda] = qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param)
+[xopt,fopt,exitflag,output,lambda] = qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0,param)
-assert_close ( xopt , [1.7975426 -0.3381487 0.1633880 - 4.9884023 0.6054943 -3.1155623]' , 1.e-7 );
+assert_close ( xopt , [1.7975426 -0.3381487 0.1633880 -4.9884023 0.6054943 -3.1155623]' , 1.e-7 );
assert_close ( fopt , [ -14.843248] , 1.e-7 );
assert_checkequal( exitflag , int32(0) );
printf("Test Successful");
diff --git a/tests/unit_tests/qpipoptmat_base.dia.ref b/tests/unit_tests/qpipoptmat_base.dia.ref
index fbebe58..fdc2293 100644
--- a/tests/unit_tests/qpipoptmat_base.dia.ref
+++ b/tests/unit_tests/qpipoptmat_base.dia.ref
@@ -67,7 +67,7 @@ param = list("MaxIter", 300, "CpuTime",100);
f=[1; 2; 3; 4; 5; 6]; H=eye(6,6);
[xopt,fopt,exitflag,output,lambda]=qpipoptmat(H,f,A,b,Aeq,beq,lb,ub,[],param);
-assert_close ( xopt , [1.7975426 -0.3381487 0.1633880 - 4.9884023 0.6054943 -3.1155623]' , 1.e-7 );
+assert_close ( xopt , [1.7975426 -0.3381487 0.1633880 -4.9884023 0.6054943 -3.1155623]' , 1.e-7 );
assert_close ( fopt , [ -14.843248] , 1.e-7 );
assert_checkequal( exitflag , int32(0) );
printf("Test Successful");
diff --git a/tests/unit_tests/qpipoptmat_base.tst b/tests/unit_tests/qpipoptmat_base.tst
index fbebe58..fdc2293 100644
--- a/tests/unit_tests/qpipoptmat_base.tst
+++ b/tests/unit_tests/qpipoptmat_base.tst
@@ -67,7 +67,7 @@ param = list("MaxIter", 300, "CpuTime",100);
f=[1; 2; 3; 4; 5; 6]; H=eye(6,6);
[xopt,fopt,exitflag,output,lambda]=qpipoptmat(H,f,A,b,Aeq,beq,lb,ub,[],param);
-assert_close ( xopt , [1.7975426 -0.3381487 0.1633880 - 4.9884023 0.6054943 -3.1155623]' , 1.e-7 );
+assert_close ( xopt , [1.7975426 -0.3381487 0.1633880 -4.9884023 0.6054943 -3.1155623]' , 1.e-7 );
assert_close ( fopt , [ -14.843248] , 1.e-7 );
assert_checkequal( exitflag , int32(0) );
printf("Test Successful");
diff --git a/unloader.sce b/unloader.sce
index 2ccfbbd..8b09ac1 100644
--- a/unloader.sce
+++ b/unloader.sce
@@ -7,7 +7,7 @@ catch
error("Scilab 5.4 or more is required.");
end;
-fileQuit = get_absolute_file_path("unloader.sce") + "etc/" + "Symphony.quit";
+fileQuit = get_absolute_file_path("unloader.sce") + "etc/" + "FOSSEE_Optimization_Toolbox.quit";
if isfile(fileQuit) then
exec(fileQuit);
end
--
cgit
|