summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHarpreet2016-02-24 16:22:06 +0530
committerHarpreet2016-02-24 16:22:06 +0530
commit03241d180c9d65fa1e75ceac4c257df44438a1ce (patch)
treeeb6e3875f136ec94ce138382adb90e925ff84750 /tests
parent7996c2704975d61e03cfb4204cfb8e202367a448 (diff)
downloadFOSSEE-Optimization-toolbox-03241d180c9d65fa1e75ceac4c257df44438a1ce.tar.gz
FOSSEE-Optimization-toolbox-03241d180c9d65fa1e75ceac4c257df44438a1ce.tar.bz2
FOSSEE-Optimization-toolbox-03241d180c9d65fa1e75ceac4c257df44438a1ce.zip
fmincon examples added
Diffstat (limited to 'tests')
-rw-r--r--tests/general_tests/fminbnd/fminbnd_f.sce15
-rw-r--r--tests/general_tests/fminbnd/fminbnd_lb1.sce18
-rw-r--r--tests/general_tests/fminbnd/fminbnd_lb2.sce18
-rw-r--r--tests/general_tests/fminbnd/fminbnd_lbub.sce19
-rw-r--r--tests/general_tests/fminbnd/fminbnd_logical1.sce38
-rw-r--r--tests/general_tests/fminbnd/fminbnd_logical2.sce38
-rw-r--r--tests/general_tests/fminbnd/fminbnd_options1.sce18
-rw-r--r--tests/general_tests/fminbnd/fminbnd_options2.sce18
-rw-r--r--tests/general_tests/fminbnd/fminbnd_options3.sce17
-rw-r--r--tests/general_tests/fminbnd/fminbnd_ub1.sce18
-rw-r--r--tests/general_tests/fminbnd/fminbnd_ub2.sce18
-rw-r--r--tests/general_tests/fmincon/fmincon_A.sce20
-rw-r--r--tests/general_tests/fmincon/fmincon_Aeq.sce22
-rw-r--r--tests/general_tests/fmincon/fmincon_b1.sce20
-rw-r--r--tests/general_tests/fmincon/fmincon_b2.sce20
-rw-r--r--tests/general_tests/fmincon/fmincon_b3.sce20
-rw-r--r--tests/general_tests/fmincon/fmincon_beq1.sce22
-rw-r--r--tests/general_tests/fmincon/fmincon_beq2.sce22
-rw-r--r--tests/general_tests/fmincon/fmincon_beq3.sce22
-rw-r--r--tests/general_tests/fmincon/fmincon_cputime.sce56
-rw-r--r--tests/general_tests/fmincon/fmincon_f.sce18
-rw-r--r--tests/general_tests/fmincon/fmincon_lb1.sce24
-rw-r--r--tests/general_tests/fmincon/fmincon_lb2.sce24
-rw-r--r--tests/general_tests/fmincon/fmincon_lb3.sce24
-rw-r--r--tests/general_tests/fmincon/fmincon_lb4.sce24
-rw-r--r--tests/general_tests/fmincon/fmincon_lbub.sce24
-rw-r--r--tests/general_tests/fmincon/fmincon_logical1.sce45
-rw-r--r--tests/general_tests/fmincon/fmincon_logical10.sce66
-rw-r--r--tests/general_tests/fmincon/fmincon_logical11.sce46
-rw-r--r--tests/general_tests/fmincon/fmincon_logical2.sce47
-rw-r--r--tests/general_tests/fmincon/fmincon_logical3.sce49
-rw-r--r--tests/general_tests/fmincon/fmincon_logical4.sce54
-rw-r--r--tests/general_tests/fmincon/fmincon_logical5.sce56
-rw-r--r--tests/general_tests/fmincon/fmincon_logical6.sce45
-rw-r--r--tests/general_tests/fmincon/fmincon_logical7.sce45
-rw-r--r--tests/general_tests/fmincon/fmincon_logical8.sce60
-rw-r--r--tests/general_tests/fmincon/fmincon_logical9.sce63
-rw-r--r--tests/general_tests/fmincon/fmincon_maxiter.sce56
-rw-r--r--tests/general_tests/fmincon/fmincon_ub1.sce24
-rw-r--r--tests/general_tests/fmincon/fmincon_ub2.sce24
-rw-r--r--tests/general_tests/fmincon/fmincon_ub3.sce24
-rw-r--r--tests/general_tests/fmincon/fmincon_ub4.sce24
-rw-r--r--tests/general_tests/fmincon/fmincon_x0a.sce20
-rw-r--r--tests/general_tests/fmincon/fmincon_x0b.sce20
-rw-r--r--tests/general_tests/fminunc/fminunc_f.sce15
-rw-r--r--tests/general_tests/fminunc/fminunc_gradient1.sce15
-rw-r--r--tests/general_tests/fminunc/fminunc_gradient2.sce15
-rw-r--r--tests/general_tests/fminunc/fminunc_gradient3.sce16
-rw-r--r--tests/general_tests/fminunc/fminunc_gradient4.sce20
-rw-r--r--tests/general_tests/fminunc/fminunc_hessian1.sce16
-rw-r--r--tests/general_tests/fminunc/fminunc_hessian2.sce15
-rw-r--r--tests/general_tests/fminunc/fminunc_hessian3.sce16
-rw-r--r--tests/general_tests/fminunc/fminunc_hessian4.sce19
-rw-r--r--tests/general_tests/fminunc/fminunc_logical1.sce35
-rw-r--r--tests/general_tests/fminunc/fminunc_logical2.sce35
-rw-r--r--tests/general_tests/fminunc/fminunc_logical3.sce42
-rw-r--r--tests/general_tests/fminunc/fminunc_logical4.sce42
-rw-r--r--tests/general_tests/fminunc/fminunc_options1.sce16
-rw-r--r--tests/general_tests/fminunc/fminunc_options2.sce16
-rw-r--r--tests/general_tests/fminunc/fminunc_x0a.sce16
-rw-r--r--tests/general_tests/fminunc/fminunc_x0b.sce16
61 files changed, 1730 insertions, 0 deletions
diff --git a/tests/general_tests/fminbnd/fminbnd_f.sce b/tests/general_tests/fminbnd/fminbnd_f.sce
new file mode 100644
index 0000000..96b08de
--- /dev/null
+++ b/tests/general_tests/fminbnd/fminbnd_f.sce
@@ -0,0 +1,15 @@
+//Find x in R^6 such that:
+// Check if a user specifies function or not
+
+fun = [];
+x1 = [1,1,1,1,1,1];
+x2 = [6,6,6,6,6,6];
+options=list("MaxIter", [1500], "CpuTime", [500],"TolX",[1e-6]);
+
+//Error
+//fminunc: Expected function for Objective
+//at line 148 of function fminunc called by :
+//[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
+[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options);
+
diff --git a/tests/general_tests/fminbnd/fminbnd_lb1.sce b/tests/general_tests/fminbnd/fminbnd_lb1.sce
new file mode 100644
index 0000000..3c60c1e
--- /dev/null
+++ b/tests/general_tests/fminbnd/fminbnd_lb1.sce
@@ -0,0 +1,18 @@
+//Find x in R^2 such that:
+// Check if a lower bound is empty or not
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x1 = [];
+x2 = [1,2];
+options=list("MaxIter", [1500], "CpuTime", [500],"TolX",[1e-6]);
+
+//Error
+//fminbnd: Lower Bound (2nd Parameter) cannot be empty
+//at line 177 of function fminbnd called by :
+//[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, lb, ub, options);
+
+
+[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options);
+
diff --git a/tests/general_tests/fminbnd/fminbnd_lb2.sce b/tests/general_tests/fminbnd/fminbnd_lb2.sce
new file mode 100644
index 0000000..f159657
--- /dev/null
+++ b/tests/general_tests/fminbnd/fminbnd_lb2.sce
@@ -0,0 +1,18 @@
+//Find x in R^2 such that:
+// Check if the user specifies correct lower bound
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x1 = [1];
+x2 = [2];
+options=list("MaxIter", [1500], "CpuTime", [500],"TolX",[1e-6]);
+
+//Error
+//fminbnd: Objective function and x1 did not match
+//at line 193 of function fminbnd called by :
+//[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options);
+
+
+[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options);
+
diff --git a/tests/general_tests/fminbnd/fminbnd_lbub.sce b/tests/general_tests/fminbnd/fminbnd_lbub.sce
new file mode 100644
index 0000000..3a3ec52
--- /dev/null
+++ b/tests/general_tests/fminbnd/fminbnd_lbub.sce
@@ -0,0 +1,19 @@
+//Find x in R^2 such that:
+// Check if Upper bound and lower bound is entered correctly
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x1 = [0.5,2.1];
+x2 = [1,2];
+options=list("MaxIter", [1500], "CpuTime", [500],"TolX",[1e-6]);
+
+//Error
+//fminbnd: Difference between Upper Bound and Lower bound should be atleast > 10^-6 for variable number= 2
+//at line 242 of function fminbnd called by :
+//[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options)
+
+
+
+[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options)
+
diff --git a/tests/general_tests/fminbnd/fminbnd_logical1.sce b/tests/general_tests/fminbnd/fminbnd_logical1.sce
new file mode 100644
index 0000000..87da61d
--- /dev/null
+++ b/tests/general_tests/fminbnd/fminbnd_logical1.sce
@@ -0,0 +1,38 @@
+//Find x in R^2 such that:
+//An Example which results in exceeding Maximum Iterations
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x1 = [0,0];
+x2 = [1,2];
+options=list("MaxIter", [8], "CpuTime", [500],"TolX",[1e-6]);
+
+//Output
+//
+//Maximum Number of Iterations Exceeded. Output may not be optimal.
+// lambda =
+//
+// lower: [0.0026488,0.0024921]
+// upper: [8.873D-08,4.494D-08]
+// output =
+//
+// Iterations: 8
+// Cpu_Time: 0.012
+// Objective_Evaluation: 9
+// Dual_Infeasibility: 2.632D-12
+// Message: "Maximum Number of Iterations Exceeded. Output may not be optimal"
+// exitflag =
+//
+// 1
+// fopt =
+//
+// 0.0000033
+// xopt =
+//
+// 0.0013244
+// 0.0012460
+
+
+[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options)
+
diff --git a/tests/general_tests/fminbnd/fminbnd_logical2.sce b/tests/general_tests/fminbnd/fminbnd_logical2.sce
new file mode 100644
index 0000000..65ebee6
--- /dev/null
+++ b/tests/general_tests/fminbnd/fminbnd_logical2.sce
@@ -0,0 +1,38 @@
+//Find x in R^2 such that:
+//An Example which results in exceeding Maximum CPU-Time
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x1 = [0,0];
+x2 = [1,2];
+options=list("MaxIter", [100], "CpuTime", [0.01],"TolX",[1e-6]);
+
+//Output
+//
+//Maximum CPU Time exceeded. Output may not be optimal.
+// lambda =
+//
+// lower: [0,0]
+// upper: [0,0]
+// output =
+//
+// Iterations: 3
+// Cpu_Time: 0.012
+// Objective_Evaluation: 4
+// Dual_Infeasibility: 9.406D-11
+// Message: "Maximum CPU Time exceeded. Output may not be optimal"
+// exitflag =
+//
+// 2
+// fopt =
+//
+// 0.
+// xopt =
+//
+// 0.0381891
+// 0.0353974
+
+
+[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options)
+
diff --git a/tests/general_tests/fminbnd/fminbnd_options1.sce b/tests/general_tests/fminbnd/fminbnd_options1.sce
new file mode 100644
index 0000000..bc98cae
--- /dev/null
+++ b/tests/general_tests/fminbnd/fminbnd_options1.sce
@@ -0,0 +1,18 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct options or not
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x1 = [1,2];
+x2 = [3,4];
+options=list("MaxIter", "", "CpuTime", [500],"TolX",[1e-6]);
+
+//Error
+//fminbnd: Value for Maximum Iteration should be a Constant
+//at line 261 of function fminbnd called by :
+//[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options);
+
+
+[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options);
+
diff --git a/tests/general_tests/fminbnd/fminbnd_options2.sce b/tests/general_tests/fminbnd/fminbnd_options2.sce
new file mode 100644
index 0000000..b4a9f13
--- /dev/null
+++ b/tests/general_tests/fminbnd/fminbnd_options2.sce
@@ -0,0 +1,18 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct options or not
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x1 = [1,2];
+x2 = [3,4];
+options=list("MaxIter", [1000], "CpuTime", "TolX",[1e-6]);
+
+//Error
+//fminbnd: Value for Maximum Cpu-time should be a Constant
+//at line 268 of function fminbnd called by :
+//[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options);
+
+
+[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options);
+
diff --git a/tests/general_tests/fminbnd/fminbnd_options3.sce b/tests/general_tests/fminbnd/fminbnd_options3.sce
new file mode 100644
index 0000000..5699cf9
--- /dev/null
+++ b/tests/general_tests/fminbnd/fminbnd_options3.sce
@@ -0,0 +1,17 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct options or not
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x1 = [1,2];
+x2 = [3,4];
+options=list("MaxIter", [1000], "CpuTime", [100], "TolX", " ");
+
+//Error
+//fminbnd: Value for Tolerance should be a Constant
+//at line 275 of function fminbnd called by :
+//[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options);
+
+[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options);
+
diff --git a/tests/general_tests/fminbnd/fminbnd_ub1.sce b/tests/general_tests/fminbnd/fminbnd_ub1.sce
new file mode 100644
index 0000000..daf1487
--- /dev/null
+++ b/tests/general_tests/fminbnd/fminbnd_ub1.sce
@@ -0,0 +1,18 @@
+//Find x in R^2 such that:
+// Check if a upper bound is of correct size
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x1 = [1,2];
+x2 = [1];
+options=list("MaxIter", [1500], "CpuTime", [500],"TolX",[1e-6]);
+
+//Error
+//fminbnd: Upper Bound and Lower Bound are not matching
+//at line 213 of function fminbnd called by :
+//[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options)
+
+
+[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options)
+
diff --git a/tests/general_tests/fminbnd/fminbnd_ub2.sce b/tests/general_tests/fminbnd/fminbnd_ub2.sce
new file mode 100644
index 0000000..82c446d
--- /dev/null
+++ b/tests/general_tests/fminbnd/fminbnd_ub2.sce
@@ -0,0 +1,18 @@
+//Find x in R^2 such that:
+// Check the type of Upperbound
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x1 = [1;2];
+x2 = list(2,3);
+options=list("MaxIter", [1500], "CpuTime", [500],"TolX",[1e-6]);
+
+//Error
+//fminbnd: Expected Vector/Scalar for Upper Bound Vector (3rd Parameter)
+//at line 199 of function fminbnd called by :
+//[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options)
+
+
+[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, x1, x2, options)
+
diff --git a/tests/general_tests/fmincon/fmincon_A.sce b/tests/general_tests/fmincon/fmincon_A.sce
new file mode 100644
index 0000000..dd0df48
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_A.sce
@@ -0,0 +1,20 @@
+
+// Check if a user specifies coefficients of linear inequality contraints of the correct dimensions
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4,5,6];
+b = [7,9];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Expected Matrix of size (No of linear inequality constraints X No of Variables) or an Empty Matrix for Linear Inequality Constraint coefficient Matrix A
+//at line 343 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b);
+//at line 20 of exec file called by :
+//exec fmincon_A.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b);
diff --git a/tests/general_tests/fmincon/fmincon_Aeq.sce b/tests/general_tests/fmincon/fmincon_Aeq.sce
new file mode 100644
index 0000000..17d8756
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_Aeq.sce
@@ -0,0 +1,22 @@
+
+// Check if a user specifies coefficients of linear equality contraints of the correct dimensions
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4];
+b = [7];
+Aeq = [1,4,9];
+beq = [2];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Expected Matrix of size (No of linear equality constraints X No of Variables) or an Empty Matrix for Linear Equality Constraint coefficient Matrix Aeq
+//at line 380 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq);
+//at line 22 of exec file called by :
+//exec fmincon_Aeq.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq);
diff --git a/tests/general_tests/fmincon/fmincon_b1.sce b/tests/general_tests/fmincon/fmincon_b1.sce
new file mode 100644
index 0000000..e43a866
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_b1.sce
@@ -0,0 +1,20 @@
+
+// Check if a user specifies upper bounds of linear inequality contraints in accordance with starting point dimensions and coefficient matrix of linear inequality constraints
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4];
+b = [7,9,10,20];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Expected Row Vector (1 X number of linear inequality constraints) for b (4th Parameter)
+//at line 368 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b);
+//at line 20 of exec file called by :
+//exec fmincon_b.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b);
diff --git a/tests/general_tests/fmincon/fmincon_b2.sce b/tests/general_tests/fmincon/fmincon_b2.sce
new file mode 100644
index 0000000..65cfc90
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_b2.sce
@@ -0,0 +1,20 @@
+
+// Check if a user specifies upper bounds of linear inequality contraints in accordance with starting point dimensions and coefficient matrix of linear inequality constraints
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [];
+b = [8,3];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Expected Row Vector (1 X number of linear inequality constraints) for b (4th Parameter)
+//at line 368 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b);
+//at line 20 of exec file called by :
+//exec fmincon_b.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b);
diff --git a/tests/general_tests/fmincon/fmincon_b3.sce b/tests/general_tests/fmincon/fmincon_b3.sce
new file mode 100644
index 0000000..982ad69
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_b3.sce
@@ -0,0 +1,20 @@
+
+// Check if a user specifies upper bounds of linear inequality contraints in accordance with starting point dimensions and coefficient matrix of linear inequality constraints
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [5,8];
+b = [];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Expected Non empty Row/Column Vector for b (4th Parameter) for your Inputs
+//at line 360 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b);
+//at line 20 of exec file called by :
+//exec fmincon_b3.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b);
diff --git a/tests/general_tests/fmincon/fmincon_beq1.sce b/tests/general_tests/fmincon/fmincon_beq1.sce
new file mode 100644
index 0000000..6133b77
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_beq1.sce
@@ -0,0 +1,22 @@
+
+// Check if a user specifies value of linear equality contraints in accordance with starting point dimensions and coefficient matrix of linear equality constraints
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4];
+b = [7];
+Aeq = [1,4];
+beq = [2,6];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Expected Matrix of size (No of linear equality constraints X No of Variables) or an Empty Matrix for Linear Equality Constraint coefficient Matrix Aeq
+//at line 380 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq);
+//at line 22 of exec file called by :
+//exec fmincon_Aeq.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq);
diff --git a/tests/general_tests/fmincon/fmincon_beq2.sce b/tests/general_tests/fmincon/fmincon_beq2.sce
new file mode 100644
index 0000000..7d2af88
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_beq2.sce
@@ -0,0 +1,22 @@
+
+// Check if a user specifies value of linear equality contraints in accordance with starting point dimensions and coefficient matrix of linear equality constraints
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4];
+b = [7];
+Aeq = [];
+beq = [2,6];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: As Linear Equality Constraint coefficient Matrix Aeq (5th parameter) is empty, beq (6th Parameter) should also be empty
+//at line 392 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq);
+//at line 22 of exec file called by :
+//exec fmincon_beq2.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq);
diff --git a/tests/general_tests/fmincon/fmincon_beq3.sce b/tests/general_tests/fmincon/fmincon_beq3.sce
new file mode 100644
index 0000000..0605fdb
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_beq3.sce
@@ -0,0 +1,22 @@
+
+// Check if a user specifies value of linear equality contraints in accordance with starting point dimensions and coefficient matrix of linear equality constraints
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4];
+b = [7];
+Aeq = [7,5];
+beq = [];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Expected Non empty Row/Column Vector for beq (6th Parameter)
+//at line 397 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq);
+//at line 22 of exec file called by :
+//exec fmincon_beq3.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq);
diff --git a/tests/general_tests/fmincon/fmincon_cputime.sce b/tests/general_tests/fmincon/fmincon_cputime.sce
new file mode 100644
index 0000000..25e5aef
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_cputime.sce
@@ -0,0 +1,56 @@
+// Example where maxiter exceeds the preset value
+
+function y=fun(x)
+y=x(1)*x(1)+x(2)*x(2);
+endfunction
+
+x0 = [1,2];
+A=[1,1 ; 1,1/4 ; 1,-1 ; -1/4,-1 ; -1,-1 ; -1,1];
+b=[2;1;2;1;-1;2];
+Aeq = [1,3]
+beq= [5]
+lb = [0 0]
+ub = [2 1.5]
+
+function [c,ceq]=nlc(x)
+c = [x(1)^2 - x(2)^2 + 0.5 , x(1)^2 + x(2)^2 - 2.5];
+ceq = [];
+endfunction
+
+options = list("MaxIter", [150], "CpuTime", [0.005])
+
+//Output
+//Maximum CPU Time exceeded. Output may not be optimal.
+// hessian =
+//
+// 1.79D-316 3.95D-323
+// 2.12D-314 4.34D+276
+// gradient =
+//
+// 3.96 2.97
+// lambda =
+//
+// lower: [0,0]
+// upper: [0,0]
+// ineqlin: [0,0,0,0,0,0]
+// eqlin: 0
+// ineqnonlin: [0,0]
+// eqnonlin: [0x0 constant]
+// output =
+//
+// Iterations: 0
+// Cpu_Time: 0.016
+// Objective_Evaluation: 1
+// Dual_Infeasibility: 1.4815294
+// exitflag =
+//
+// 2
+// fopt =
+//
+// 0.
+// xopt =
+//
+// 1.98
+// 1.485
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub, nlc, options)
diff --git a/tests/general_tests/fmincon/fmincon_f.sce b/tests/general_tests/fmincon/fmincon_f.sce
new file mode 100644
index 0000000..ec89f33
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_f.sce
@@ -0,0 +1,18 @@
+
+// Check if a user specifies function or not
+
+fun = [];
+x0 = [1,2,3,4,5,6];
+A = [2,4,8,9,3,5];
+b = [1,5,7,3,9,6];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Expected type ["function"] for input argument f at input #1, but got "constant" instead.
+//at line 56 of function Checktype called by :
+//at line 297 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b);
+//at line 18 of exec file called by :
+//exec fmincon_f.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b);
diff --git a/tests/general_tests/fmincon/fmincon_lb1.sce b/tests/general_tests/fmincon/fmincon_lb1.sce
new file mode 100644
index 0000000..17b8eea
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_lb1.sce
@@ -0,0 +1,24 @@
+
+//Check if lower bound is a vector
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4];
+b = [7];
+Aeq = [];
+beq = [];
+lb = [2,4;5,9];
+ub = [];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Lower Bound (7th Parameter) should be a vector
+//at line 422 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
+//at line 24 of exec file called by :
+//exec fmincon_lb1.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
diff --git a/tests/general_tests/fmincon/fmincon_lb2.sce b/tests/general_tests/fmincon/fmincon_lb2.sce
new file mode 100644
index 0000000..4420a12
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_lb2.sce
@@ -0,0 +1,24 @@
+
+//Check if lower bound is row vector of correct dimensions
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4];
+b = [7];
+Aeq = [];
+beq = [];
+lb = [2,4,9];
+ub = [];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Expected Row Vector (1 X number of Variables) for lower bound (7th Parameter)
+//at line 430 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
+//at line 24 of exec file called by :
+//exec fmincon_lb2.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
diff --git a/tests/general_tests/fmincon/fmincon_lb3.sce b/tests/general_tests/fmincon/fmincon_lb3.sce
new file mode 100644
index 0000000..dc0b528
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_lb3.sce
@@ -0,0 +1,24 @@
+
+//Check if lower bound is column vector of correct dimensions
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4];
+b = [7];
+Aeq = [];
+beq = [];
+lb = [2;4;9];
+ub = [];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Expected Column Vector (number of Variables X 1) for lower bound (7th Parameter)
+//at line 425 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
+//at line 24 of exec file called by :
+//exec fmincon_lb3.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
diff --git a/tests/general_tests/fmincon/fmincon_lb4.sce b/tests/general_tests/fmincon/fmincon_lb4.sce
new file mode 100644
index 0000000..643af5a
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_lb4.sce
@@ -0,0 +1,24 @@
+
+//Check if lower bound is not infinity
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4];
+b = [7];
+Aeq = [];
+beq = [];
+lb = [%inf,4];
+ub = [];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Value of Lower Bound can not be infinity
+//at line 462 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
+//at line 24 of exec file called by :
+//exec fmincon_lb4.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
diff --git a/tests/general_tests/fmincon/fmincon_lbub.sce b/tests/general_tests/fmincon/fmincon_lbub.sce
new file mode 100644
index 0000000..d4c42ac
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_lbub.sce
@@ -0,0 +1,24 @@
+
+//Check if upper bound is greater than lower bound by atleast 1e-6
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4];
+b = [7];
+Aeq = [];
+beq = [];
+lb = [1,0];
+ub = [0,1];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Difference between Upper Bound and Lower bound should be atleast > 10^6 for variable number= 1
+//at line 472 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
+//at line 24 of exec file called by :
+//exec fmincon_lbub.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
diff --git a/tests/general_tests/fmincon/fmincon_logical1.sce b/tests/general_tests/fmincon/fmincon_logical1.sce
new file mode 100644
index 0000000..9cbaf57
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_logical1.sce
@@ -0,0 +1,45 @@
+// Example with objective function and inequality constraints
+
+function y=fun(x)
+y=x(1)*x(1)+x(2)*x(2);
+endfunction
+
+x0 = [1,2];
+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.
+// hessian =
+//
+// 2. - 7.451D-09
+// - 7.451D-09 2.
+// gradient =
+//
+// 1.0000000 1.
+// lambda =
+//
+// lower: [0,0]
+// upper: [0,0]
+// ineqlin: [9.087D-09,2.424D-08,4.546D-09,5.596D-09,1,4.544D-09]
+// eqlin: [0x0 constant]
+// ineqnonlin: [0x0 constant]
+// eqnonlin: [0x0 constant]
+// output =
+//
+// Iterations: 8
+// Cpu_Time: 0.112
+// Objective_Evaluation: 9
+// Dual_Infeasibility: 1.299D-11
+// exitflag =
+//
+// 0
+// fopt =
+//
+// 0.5
+// xopt =
+//
+// 0.5000000
+// 0.5000000
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b)
diff --git a/tests/general_tests/fmincon/fmincon_logical10.sce b/tests/general_tests/fmincon/fmincon_logical10.sce
new file mode 100644
index 0000000..45ffdf3
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_logical10.sce
@@ -0,0 +1,66 @@
+//Example where user provides hessian
+
+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
+
+//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
+
+//Options
+options=list("MaxIter", [1500], "CpuTime", [500], "Hessian", lHess);
+
+//Output
+//Optimal Solution Found.
+// hessian =
+//
+// 1.4142136 1.72D-322 2.12D-314
+// 1. 0. 5.82D+252
+// 1. 1.4142136 1.
+// gradient =
+//
+// 2.236068 - 3.1622776 2.236068
+// lambda =
+//
+// lower: [0,0,0]
+// upper: [0,0,0]
+// ineqlin: [0x0 constant]
+// eqlin: [0x0 constant]
+// ineqnonlin: [4.545D-09,0.7071068]
+// eqnonlin: [0x0 constant]
+// output =
+//
+// Iterations: 23
+// Cpu_Time: 0.164
+// Objective_Evaluation: 24
+// Dual_Infeasibility: 6.124D-08
+// Message: "Optimal Solution Found"
+// exitflag =
+//
+// 0
+// fopt =
+//
+// - 7.0710678
+// xopt =
+//
+// - 1.5811388
+// 2.236068
+// - 1.5811388
+
+//Calling Ipopt
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options)
diff --git a/tests/general_tests/fmincon/fmincon_logical11.sce b/tests/general_tests/fmincon/fmincon_logical11.sce
new file mode 100644
index 0000000..0fe17ee
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_logical11.sce
@@ -0,0 +1,46 @@
+// Example with objective function using log functions
+
+function y=fun(x)
+y=log(x(1)+x(2));
+endfunction
+
+x0 = [1,2];
+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.
+// hessian =
+//
+// - 1.0000001 3.95D-323
+// - 1. - 1.
+// gradient =
+//
+// 1. 1.
+// lambda =
+//
+// lower: [0,0]
+// upper: [0,0]
+// ineqlin: [9.091D-09,1.384D-08,3.304D-09,4.768D-09,1,7.281D-09]
+// eqlin: [0x0 constant]
+// ineqnonlin: [0x0 constant]
+// eqnonlin: [0x0 constant]
+// output =
+//
+// Iterations: 13
+// Cpu_Time: 0.228
+// Objective_Evaluation: 14
+// Dual_Infeasibility: 3.040D-09
+// Message: "Optimal Solution Found"
+// exitflag =
+//
+// 0
+// fopt =
+//
+// - 9.091D-10
+// xopt =
+//
+// 0.1243037
+// 0.8756963
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b)
diff --git a/tests/general_tests/fmincon/fmincon_logical2.sce b/tests/general_tests/fmincon/fmincon_logical2.sce
new file mode 100644
index 0000000..94e91f1
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_logical2.sce
@@ -0,0 +1,47 @@
+// Example with objective function, equality and inequality constraints
+
+function y=fun(x)
+y=x(1)*x(1)+x(2)*x(2);
+endfunction
+
+x0 = [1,2];
+A=[1,1 ; 1,1/4 ; 1,-1 ; -1/4,-1 ; -1,-1 ; -1,1];
+b=[2;1;2;1;-1;2];
+Aeq = [1,3]
+beq= [1.5]
+
+//Output
+//Optimal Solution Found.
+// hessian =
+//
+// 2. 0.
+// 0. 2.
+// gradient =
+//
+// 1.5 0.5000000
+// lambda =
+//
+// lower: [0,0]
+// upper: [0,0]
+// ineqlin: [9.089D-09,4.842D-08,6.059D-09,6.324D-09,2.0000001,3.637D-09]
+// eqlin: 0.5000000
+// ineqnonlin: [0x0 constant]
+// eqnonlin: [0x0 constant]
+// output =
+//
+// Iterations: 8
+// Cpu_Time: 0.092
+// Objective_Evaluation: 9
+// Dual_Infeasibility: 1.869D-11
+// exitflag =
+//
+// 0
+// fopt =
+//
+// 0.6250000
+// xopt =
+//
+// 0.7500000
+// 0.25
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b,Aeq,beq)
diff --git a/tests/general_tests/fmincon/fmincon_logical3.sce b/tests/general_tests/fmincon/fmincon_logical3.sce
new file mode 100644
index 0000000..9c56f7b
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_logical3.sce
@@ -0,0 +1,49 @@
+// Example with objective function, equality, inequality constraints and variable bounds
+
+function y=fun(x)
+y=x(1)*x(1)+x(2)*x(2);
+endfunction
+
+x0 = [1,2];
+A=[1,1 ; 1,1/4 ; 1,-1 ; -1/4,-1 ; -1,-1 ; -1,1];
+b=[2;1;2;1;-1;2];
+Aeq = [1,3]
+beq= [5]
+lb = [0 0]
+ub = [2 1.5]
+
+//Output
+//Optimal Solution Found.
+// hessian =
+//
+// 2. 0.
+// 0. 2.
+// gradient =
+//
+// 0.9999999 3.
+// lambda =
+//
+// lower: [1.820D-08,6.060D-09]
+// upper: [6.059D-09,0.7267088]
+// ineqlin: [0.3633544,7.251D-08,3.030D-09,3.463D-09,9.093D-09,9.096D-09]
+// eqlin: -1.3633544
+// ineqnonlin: [0x0 constant]
+// eqnonlin: [0x0 constant]
+// output =
+//
+// Iterations: 21
+// Cpu_Time: 0.2
+// Objective_Evaluation: 26
+// Dual_Infeasibility: 9.075D-11
+// exitflag =
+//
+// 0
+// fopt =
+//
+// 2.5
+// xopt =
+//
+// 0.5000000
+// 1.5
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub)
diff --git a/tests/general_tests/fmincon/fmincon_logical4.sce b/tests/general_tests/fmincon/fmincon_logical4.sce
new file mode 100644
index 0000000..31221c8
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_logical4.sce
@@ -0,0 +1,54 @@
+// Example with objective function, equality, inequality constraints, variable bounds and non linear function
+
+function y=fun(x)
+y=x(1)*x(1)+x(2)*x(2);
+endfunction
+
+x0 = [1,2];
+A=[1,1 ; 1,1/4 ; 1,-1 ; -1/4,-1 ; -1,-1 ; -1,1];
+b=[2;1;2;1;-1;2];
+Aeq = [1,3]
+beq= [5]
+lb = [0 0]
+ub = [2 1.5]
+
+function [c,ceq]=nlc(x)
+c = [x(1)^2 - x(2)^2 + 0.5 , x(1)^2 + x(2)^2 - 2.5];
+ceq = [];
+endfunction
+
+//Output
+//Optimal Solution Found.
+// hessian =
+//
+// 3970695.7 3.311D-10
+// 3.311D-10 3970695.5
+// gradient =
+//
+// 1.0000000 3.
+// lambda =
+//
+// lower: [1.818D-08,6.061D-09]
+// upper: [6.061D-09,0.7272728]
+// ineqlin: [0.3636363,7.273D-08,3.030D-09,3.463D-09,9.091D-09,9.091D-09]
+// eqlin: -2.2698905
+// ineqnonlin: [6.061D-09,0.9062541]
+// eqnonlin: [0x0 constant]
+// output =
+//
+// Iterations: 20
+// Cpu_Time: 0.4
+// Objective_Evaluation: 23
+// Dual_Infeasibility: 5.171D-09
+// exitflag =
+//
+// 0
+// fopt =
+//
+// 2.5
+// xopt =
+//
+// 0.5000000
+// 1.5
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub,nlc)
diff --git a/tests/general_tests/fmincon/fmincon_logical5.sce b/tests/general_tests/fmincon/fmincon_logical5.sce
new file mode 100644
index 0000000..dbba29a
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_logical5.sce
@@ -0,0 +1,56 @@
+// Example with objective function, equality, inequality constraints, variable bounds, non linear function and options
+
+function y=fun(x)
+y=x(1)*x(1)+x(2)*x(2);
+endfunction
+
+x0 = [1,2];
+A=[1,1 ; 1,1/4 ; 1,-1 ; -1/4,-1 ; -1,-1 ; -1,1];
+b=[2;1;2;1;-1;2];
+Aeq = [1,3]
+beq= [5]
+lb = [0 0]
+ub = [2 1.5]
+
+function [c,ceq]=nlc(x)
+c = [x(1)^2 - x(2)^2 + 0.5 , x(1)^2 + x(2)^2 - 2.5];
+ceq = [];
+endfunction
+
+options = list("MaxIter", [1500], "CpuTime", [500])
+
+//Output
+//Optimal Solution Found.
+// hessian =
+//
+// 3970695.7 3.311D-10
+// 3.311D-10 3970695.5
+// gradient =
+//
+// 1.0000000 3.
+// lambda =
+//
+// lower: [1.818D-08,6.061D-09]
+// upper: [6.061D-09,0.7272728]
+// ineqlin: [0.3636363,7.273D-08,3.030D-09,3.463D-09,9.091D-09,9.091D-09]
+// eqlin: -2.2698905
+// ineqnonlin: [6.061D-09,0.9062541]
+// eqnonlin: [0x0 constant]
+// output =
+//
+// Iterations: 20
+// Cpu_Time: 0.4
+// Objective_Evaluation: 23
+// Dual_Infeasibility: 5.171D-09
+// exitflag =
+//
+// 0
+// fopt =
+//
+// 2.5
+// xopt =
+//
+// 0.5000000
+// 1.5
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub, nlc, options)
diff --git a/tests/general_tests/fmincon/fmincon_logical6.sce b/tests/general_tests/fmincon/fmincon_logical6.sce
new file mode 100644
index 0000000..b99cca1
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_logical6.sce
@@ -0,0 +1,45 @@
+// Example with objective function using sinusoidal functions
+
+function y=fun(x)
+y=sin(x(1))+cos(x(2));
+endfunction
+
+x0 = [1,2];
+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.
+// hessian =
+//
+// 0.2129952 0.
+// 0. 0.2129198
+// gradient =
+//
+// 0.9770613 - 0.9770613
+// lambda =
+//
+// lower: [0,0]
+// upper: [0,0]
+// ineqlin: [2.270D-08,1.202D-08,2.272D-09,3.316D-09,1.571D-08,0.9770613]
+// eqlin: [0x0 constant]
+// ineqnonlin: [0x0 constant]
+// eqnonlin: [0x0 constant]
+// output =
+//
+// Iterations: 12
+// Cpu_Time: 0.132
+// Objective_Evaluation: 15
+// Dual_Infeasibility: 7.674D-10
+// exitflag =
+//
+// 0
+// fopt =
+//
+// - 0.4259168
+// xopt =
+//
+// - 0.2146019
+// 1.7853981
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b)
diff --git a/tests/general_tests/fmincon/fmincon_logical7.sce b/tests/general_tests/fmincon/fmincon_logical7.sce
new file mode 100644
index 0000000..48d83b4
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_logical7.sce
@@ -0,0 +1,45 @@
+// Example with objective function using exponential input
+
+function y=fun(x)
+y=exp(x(2)*x(1));
+endfunction
+
+x0 = [1,2];
+A=[1,1 ; 1,1/4];
+b=[2;1];
+
+//Output
+//Optimal Solution Found.
+// hessian =
+//
+// 0.0000010 - 0.0000007
+// - 0.0000007 0.0000005
+// gradient =
+//
+// 7.127D-08 - 5.690D-08
+// lambda =
+//
+// lower: [0,0]
+// upper: [0,0]
+// ineqlin: [6.963D-09,2.501D-09]
+// eqlin: [0x0 constant]
+// ineqnonlin: [0x0 constant]
+// eqnonlin: [0x0 constant]
+// output =
+//
+// Iterations: 15
+// Cpu_Time: 0.132
+// Objective_Evaluation: 16
+// Dual_Infeasibility: 8.073D-08
+// exitflag =
+//
+// 0
+// fopt =
+//
+// 1.500D-08
+// xopt =
+//
+// - 3.7925137
+// 4.7501487
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b)
diff --git a/tests/general_tests/fmincon/fmincon_logical8.sce b/tests/general_tests/fmincon/fmincon_logical8.sce
new file mode 100644
index 0000000..7e24211
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_logical8.sce
@@ -0,0 +1,60 @@
+// Example where user provides gradient of the objective function
+
+function y=fun(x)
+y=x(1)*x(1)+x(2)*x(2);
+endfunction
+
+function y= fGrad(x)
+y= [2*x(1),2*x(2)];
+endfunction
+
+x0 = [1,2];
+A=[1,1 ; 1,1/4 ; 1,-1 ; -1/4,-1 ; -1,-1 ; -1,1];
+b=[2;1;2;1;-1;2];
+Aeq = [1,3]
+beq= [5]
+lb = [0 0]
+ub = [2 1.5]
+
+function [c,ceq]=nlc(x)
+c = [x(1)^2 - x(2)^2 + 0.5 , x(1)^2 + x(2)^2 - 2.5];
+ceq = [];
+endfunction
+
+options = list("MaxIter", [150], "CpuTime", [500], "GradObj", fGrad)
+
+//Output
+//Optimal Solution Found.
+// hessian =
+//
+// 3970695.6 3.311D-10
+// 3.311D-10 3970695.4
+// gradient =
+//
+// 1.0000000 3.
+// lambda =
+//
+// lower: [1.818D-08,6.061D-09]
+// upper: [6.061D-09,0.7272728]
+// ineqlin: [0.3636363,7.273D-08,3.030D-09,3.463D-09,9.091D-09,9.091D-09]
+// eqlin: -2.2698905
+// ineqnonlin: [6.061D-09,0.9062542]
+// eqnonlin: [0x0 constant]
+// output =
+//
+// Iterations: 20
+// Cpu_Time: 0.852
+// Objective_Evaluation: 23
+// Dual_Infeasibility: 1.884D-09
+// exitflag =
+//
+// 0
+// fopt =
+//
+// 2.5
+// xopt =
+//
+// 0.5000000
+// 1.5
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub, nlc, options)
diff --git a/tests/general_tests/fmincon/fmincon_logical9.sce b/tests/general_tests/fmincon/fmincon_logical9.sce
new file mode 100644
index 0000000..129601b
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_logical9.sce
@@ -0,0 +1,63 @@
+// Example where user provides gradient of the constraints
+
+function y=fun(x)
+y=x(1)*x(1)+x(2)*x(2);
+endfunction
+
+x0 = [1,2];
+A=[1,1 ; 1,1/4 ; 1,-1 ; -1/4,-1 ; -1,-1 ; -1,1];
+b=[2;1;2;1;-1;2];
+Aeq = [1,3]
+beq= [5]
+lb = [0 0]
+ub = [2 1.5]
+
+function [c,ceq]=nlc(x)
+c = [x(1)^2 - x(2)^2 + 0.5 , x(1)^2 + x(2)^2 - 2.5];
+ceq = [];
+endfunction
+
+//Gradient of Non-Linear Constraints
+function [cg,ceqg] = cGrad(x)
+cg=[2*x(1) , -2*x(2); 2*x(1) , 2*x(2)];
+ceqg=[];
+endfunction
+
+options = list("MaxIter", [150], "CpuTime", [500], "GradCon", cGrad)
+
+//Output
+//Optimal Solution Found.
+// hessian =
+//
+// 3353468.3 3.95D-323
+// 0. 0.
+// gradient =
+//
+// 1.0000000 3.
+// lambda =
+//
+// lower: [1.818D-08,6.061D-09]
+// upper: [6.061D-09,0.6917463]
+// ineqlin: [0.3458731,7.273D-08,3.030D-09,3.463D-09,9.091D-09,9.091D-09]
+// eqlin: -2.2520096
+// ineqnonlin: [6.061D-09,0.9061364]
+// eqnonlin: [0x0 constant]
+// output =
+//
+// Iterations: 20
+// Cpu_Time: 0.34
+// Objective_Evaluation: 23
+// Dual_Infeasibility: 2.793D-09
+// Message: "Optimal Solution Found"
+// exitflag =
+//
+// 0
+// fopt =
+//
+// 2.5
+// xopt =
+//
+// 0.5000000
+// 1.5
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub, nlc, options)
diff --git a/tests/general_tests/fmincon/fmincon_maxiter.sce b/tests/general_tests/fmincon/fmincon_maxiter.sce
new file mode 100644
index 0000000..57d46b6
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_maxiter.sce
@@ -0,0 +1,56 @@
+// Example where maxiter exceeds the preset value
+
+function y=fun(x)
+y=x(1)*x(1)+x(2)*x(2);
+endfunction
+
+x0 = [1,2];
+A=[1,1 ; 1,1/4 ; 1,-1 ; -1/4,-1 ; -1,-1 ; -1,1];
+b=[2;1;2;1;-1;2];
+Aeq = [1,3]
+beq= [5]
+lb = [0 0]
+ub = [2 1.5]
+
+function [c,ceq]=nlc(x)
+c = [x(1)^2 - x(2)^2 + 0.5 , x(1)^2 + x(2)^2 - 2.5];
+ceq = [];
+endfunction
+
+options = list("MaxIter", [15], "CpuTime", [500])
+
+//Output
+//Maximum Number of Iterations Exceeded. Output may not be optimal.
+// hessian =
+//
+// 335.44736 0.
+// 0. 335.18088
+// gradient =
+//
+// 1.0000122 2.9999999
+// lambda =
+//
+// lower: [0.1999999,0.0666667]
+// upper: [0.0666667,1803365.5]
+// ineqlin: [486161.41,0.7135096,0.0332561,0.0381089,0.1000596,0.1000605]
+// eqlin: -486461.97
+// ineqnonlin: [0.0666348,299.08034]
+// eqnonlin: [0x0 constant]
+// output =
+//
+// Iterations: 15
+// Cpu_Time: 0.252
+// Objective_Evaluation: 17
+// Dual_Infeasibility: 831041.12
+// exitflag =
+//
+// 1
+// fopt =
+//
+// 2.500006
+// xopt =
+//
+// 0.5000061
+// 1.5
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub, nlc, options)
diff --git a/tests/general_tests/fmincon/fmincon_ub1.sce b/tests/general_tests/fmincon/fmincon_ub1.sce
new file mode 100644
index 0000000..acbe99a
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_ub1.sce
@@ -0,0 +1,24 @@
+
+//Check if upper bound is a vector
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4];
+b = [7];
+Aeq = [];
+beq = [];
+lb = [2,4];
+ub = [3,4;7,2];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Upper Bound (8th Parameter) should be a vector
+//at line 445 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
+//at line 24 of exec file called by :
+//exec fmincon_ub1.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
diff --git a/tests/general_tests/fmincon/fmincon_ub2.sce b/tests/general_tests/fmincon/fmincon_ub2.sce
new file mode 100644
index 0000000..dc4d790
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_ub2.sce
@@ -0,0 +1,24 @@
+
+//Check if upper bound is row vector of correct dimensions
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4];
+b = [7];
+Aeq = [];
+beq = [];
+lb = [2,4];
+ub = [3,4,7];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Expected Row Vector (1 X number of Variables) for upper bound (8th Parameter)
+//at line 453 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
+//at line 24 of exec file called by :
+//exec fmincon_ub2.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
diff --git a/tests/general_tests/fmincon/fmincon_ub3.sce b/tests/general_tests/fmincon/fmincon_ub3.sce
new file mode 100644
index 0000000..034abc7
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_ub3.sce
@@ -0,0 +1,24 @@
+
+//Check if lower bound is column vector of correct dimensions
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4];
+b = [7];
+Aeq = [];
+beq = [];
+lb = [2,4];
+ub = [3;4;7];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Expected Column Vector (number of Variables X 1) for upper bound (8th Parameter)
+//at line 448 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
+//at line 24 of exec file called by :
+//exec fmincon_ub3.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
diff --git a/tests/general_tests/fmincon/fmincon_ub4.sce b/tests/general_tests/fmincon/fmincon_ub4.sce
new file mode 100644
index 0000000..26dc579
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_ub4.sce
@@ -0,0 +1,24 @@
+
+//Check if upper bound is not -infinity
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1,2];
+A = [3,4];
+b = [7];
+Aeq = [];
+beq = [];
+lb = [];
+ub = [-%inf,6];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Value of Upper Bound can not be negative infinity
+//at line 467 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
+//at line 24 of exec file called by :
+//exec fmincon_ub4.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b, Aeq, beq, lb, ub);
diff --git a/tests/general_tests/fmincon/fmincon_x0a.sce b/tests/general_tests/fmincon/fmincon_x0a.sce
new file mode 100644
index 0000000..68bf5f1
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_x0a.sce
@@ -0,0 +1,20 @@
+
+// Check if a user specifies a starting point or not
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [];
+A = [3,4];
+b = [7,9];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Expected Row Vector or Column Vector for x0 (Starting Point) or Starting Point cannot be Empty
+//at line 305 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b);
+//at line 20 of exec file called by :
+//exec fmincon_x0a.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b);
diff --git a/tests/general_tests/fmincon/fmincon_x0b.sce b/tests/general_tests/fmincon/fmincon_x0b.sce
new file mode 100644
index 0000000..2b72f92
--- /dev/null
+++ b/tests/general_tests/fmincon/fmincon_x0b.sce
@@ -0,0 +1,20 @@
+
+// Check if a user specifies a starting point of the correct dimensions with respect to the objective function
+
+function y=fun(x)
+y=x(1)+x(2);
+endfunction
+
+x0 = [1];
+A = [3,4];
+b = [7,9];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fmincon: Objective function and x0 did not match
+//at line 318 of function fmincon called by :
+//[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b);
+//at line 20 of exec file called by :
+//exec fmincon_x0b.sce
+
+[xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (fun, x0, A, b);
diff --git a/tests/general_tests/fminunc/fminunc_f.sce b/tests/general_tests/fminunc/fminunc_f.sce
new file mode 100644
index 0000000..7fd0e2c
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_f.sce
@@ -0,0 +1,15 @@
+//Find x in R^6 such that:
+// Check if a user specifies function or not
+
+fun = [];
+x0 = [1,2,3,4,5,6];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fminbnd: Expected function for Objective (1st Parameter)
+//at line 150 of function fminbnd called by :
+//[xopt,fopt,exitflag,output,lambda] = fminbnd (fun, lb, ub, options);
+
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
diff --git a/tests/general_tests/fminunc/fminunc_gradient1.sce b/tests/general_tests/fminunc/fminunc_gradient1.sce
new file mode 100644
index 0000000..214ff89
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_gradient1.sce
@@ -0,0 +1,15 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct options or not
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x0 = [1,2];
+options=list("MaxIter", [1000], "CpuTime", [100], "Gradient", "OFn", "Hessian", "OFF");
+
+//Error
+//fminunc: Unrecognized String [OFn] entered for the option- Gradient.
+//at line 278 of function fminunc called by :
+//[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
diff --git a/tests/general_tests/fminunc/fminunc_gradient2.sce b/tests/general_tests/fminunc/fminunc_gradient2.sce
new file mode 100644
index 0000000..5c1c3d3
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_gradient2.sce
@@ -0,0 +1,15 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct options or not
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x0 = [1,2];
+options=list("MaxIter", [1000], "CpuTime", [100], "Gradient", "", "Hessian", "OFF");
+
+//Error
+//fminunc: Unrecognized String [] entered for the option- Gradient.
+//at line 278 of function fminunc called by :
+//[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
diff --git a/tests/general_tests/fminunc/fminunc_gradient3.sce b/tests/general_tests/fminunc/fminunc_gradient3.sce
new file mode 100644
index 0000000..f35f7f1
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_gradient3.sce
@@ -0,0 +1,16 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct options or not
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x0 = [1,2];
+grad = [];
+options=list("MaxIter", [1000], "CpuTime", [100], "Gradient", grad, "Hessian", "OFF");
+
+//Error
+//fminunc: Expected function for Gradient of Objective
+//at line 306 of function fminunc called by :
+//[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
diff --git a/tests/general_tests/fminunc/fminunc_gradient4.sce b/tests/general_tests/fminunc/fminunc_gradient4.sce
new file mode 100644
index 0000000..3a6a716
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_gradient4.sce
@@ -0,0 +1,20 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct options or not
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x0 = [1,2];
+function y = grad(x)
+ y=[2*x(1)];
+endfunction
+options=list("MaxIter", [1000], "CpuTime", [100], "Gradient", grad, "Hessian", "OFF");
+
+//Error
+//fminunc: Expected function for Hessian of Objective
+//at line 313 of function fminunc called by :
+//[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+//at line 20 of exec file called by :
+//exec fminunc_gradient4.sce
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
diff --git a/tests/general_tests/fminunc/fminunc_hessian1.sce b/tests/general_tests/fminunc/fminunc_hessian1.sce
new file mode 100644
index 0000000..a8ba79b
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_hessian1.sce
@@ -0,0 +1,16 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct options for hessian
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x0 = [1,2];
+options=list("MaxIter", [1000], "CpuTime", [100], "Gradient", "OFF", "Hessian", "OFn");
+
+//Error
+//fminunc: Unrecognized String [OFn] entered for the option- Hessian.
+//at line 290 of function fminunc called by :
+//[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
diff --git a/tests/general_tests/fminunc/fminunc_hessian2.sce b/tests/general_tests/fminunc/fminunc_hessian2.sce
new file mode 100644
index 0000000..99fd6c1
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_hessian2.sce
@@ -0,0 +1,15 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct options for hessian
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x0 = [1,2];
+options=list("MaxIter", [1000], "CpuTime", [100], "Gradient", "OFf", "Hessian", "");
+
+//Error
+//fminunc: Unrecognized String [] entered for the option- Hessian.
+//at line 290 of function fminunc called by :
+//[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
diff --git a/tests/general_tests/fminunc/fminunc_hessian3.sce b/tests/general_tests/fminunc/fminunc_hessian3.sce
new file mode 100644
index 0000000..7a1e625
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_hessian3.sce
@@ -0,0 +1,16 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct options for hessian
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x0 = [1,2];
+hess = [];
+options=list("MaxIter", [1000], "CpuTime", [100], "Hessian", hess);
+
+//Error
+//fminunc: Expected function for Hessian of Objective
+//at line 341 of function fminunc called by :
+//[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
diff --git a/tests/general_tests/fminunc/fminunc_hessian4.sce b/tests/general_tests/fminunc/fminunc_hessian4.sce
new file mode 100644
index 0000000..47ce1c4
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_hessian4.sce
@@ -0,0 +1,19 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct options for hessian
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x0 = [1,2];
+function y = hess(x)
+ y=[2,0];
+endfunction
+options=list("MaxIter", [1000], "CpuTime", [100], "Gradient", "OFF", "Hessian", hess);
+
+//Error
+//fminunc: Wrong Input for Objective Hessian function(3rd Parameter)---->Symmetric Matrix function of size [2 X 2] is Expected
+//at line 353 of function fminunc called by :
+//[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
diff --git a/tests/general_tests/fminunc/fminunc_logical1.sce b/tests/general_tests/fminunc/fminunc_logical1.sce
new file mode 100644
index 0000000..54c4d7f
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_logical1.sce
@@ -0,0 +1,35 @@
+//Find x in R^2 such that:
+// An Unbounded Example
+
+function y = fun(x)
+ y = -(x(1)^2 + x(2)^2);
+endfunction
+x0 = [1,2];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Output
+//
+//Iterates diverging; problem might be unbounded.
+// hessian =
+//
+// []
+// gradient =
+//
+// []
+// output =
+//
+// Iterations: 65
+// Cpu_Time: 0.112
+// Message: "Iterates diverging; problem might be unbounded"
+// exitflag =
+//
+// 8
+// fopt =
+//
+// []
+// xopt =
+//
+// []
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options)
+
diff --git a/tests/general_tests/fminunc/fminunc_logical2.sce b/tests/general_tests/fminunc/fminunc_logical2.sce
new file mode 100644
index 0000000..27d6cdd
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_logical2.sce
@@ -0,0 +1,35 @@
+//Find x in R^2 such that:
+// An Infeasible Example (Solver will show this as "Regularization becomes too large")
+
+function y = fun(x)
+ y = log(x);
+endfunction
+x0 = [1];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Output
+//
+//Error in step computation (regularization becomes too large?)!
+// hessian =
+//
+// []
+// gradient =
+//
+// []
+// output =
+//
+// Iterations: 26
+// Cpu_Time: 0.044
+// Message: "Error in step computation (regularization becomes too large?)!"
+// exitflag =
+//
+// 10
+// fopt =
+//
+// []
+// xopt =
+//
+// []
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options)
+
diff --git a/tests/general_tests/fminunc/fminunc_logical3.sce b/tests/general_tests/fminunc/fminunc_logical3.sce
new file mode 100644
index 0000000..15ea3ad
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_logical3.sce
@@ -0,0 +1,42 @@
+//Find x in R^2 such that:
+// An Example which results in exceeding Maximum Iterations
+
+function y = fun(x)
+ y = (x(1)-x(2))^2 + x(1);
+endfunction
+x0 = [1,2];
+options=list("MaxIter", [1000], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Output
+//
+//Maximum Number of Iterations Exceeded. Output may not be optimal.
+// hessian =
+//
+// 2. - 2.
+// - 2. 2.
+// gradient =
+//
+// 0.9999885 0.
+// output =
+//
+// Iterations: 1000
+// Cpu_Time: 2.112
+// Objective_Evaluation: 1001
+// Dual_Infeasibility: 0.9999885
+// Message: "Maximum Number of Iterations Exceeded. Output may not be optimal"
+// exitflag =
+//
+// 1
+// fopt =
+//
+// - 1.050D+18
+// xopt =
+//
+// 10^18 *
+//
+// - 1.0497354
+// - 1.0497354
+
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options)
+
diff --git a/tests/general_tests/fminunc/fminunc_logical4.sce b/tests/general_tests/fminunc/fminunc_logical4.sce
new file mode 100644
index 0000000..60d75c5
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_logical4.sce
@@ -0,0 +1,42 @@
+//Find x in R^2 such that:
+// An Example which results in exceeding Maximum CPU-Time
+
+function y = fun(x)
+ y = (x(1)-x(2))^2 + x(1);
+endfunction
+x0 = [1,2];
+options=list("MaxIter", [1000], "CpuTime", [1.5], "Gradient", "OFF", "Hessian", "OFF");
+
+//Output
+//
+//Maximum CPU Time exceeded. Output may not be optimal.
+// hessian =
+//
+// 2. - 2.
+// - 2. 2.
+// gradient =
+//
+// 0.9998408 0.
+// output =
+//
+// Iterations: 732
+// Cpu_Time: 1.504
+// Objective_Evaluation: 733
+// Dual_Infeasibility: 0.9998408
+// Message: "Maximum CPU Time exceeded. Output may not be optimal"
+// exitflag =
+//
+// 2
+// fopt =
+//
+// 0.
+// xopt =
+//
+// 10^17 *
+//
+// - 7.6897384
+// - 7.6897384
+
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options)
+
diff --git a/tests/general_tests/fminunc/fminunc_options1.sce b/tests/general_tests/fminunc/fminunc_options1.sce
new file mode 100644
index 0000000..eb939d5
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_options1.sce
@@ -0,0 +1,16 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct options or not
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x0 = [1,2];
+options=list("MaxIter", "", "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fminunc: Value for Maximum Iteration should be a Constant
+//at line 261 of function fminunc called by :
+//[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
diff --git a/tests/general_tests/fminunc/fminunc_options2.sce b/tests/general_tests/fminunc/fminunc_options2.sce
new file mode 100644
index 0000000..1cf09ef
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_options2.sce
@@ -0,0 +1,16 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct options or not
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x0 = [1,2];
+options=list("MaxIter", [1000], "CpuTime", , "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fminunc: Value for Maximum Cpu-time should be a Constant
+//at line 268 of function fminunc called by :
+//[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
diff --git a/tests/general_tests/fminunc/fminunc_x0a.sce b/tests/general_tests/fminunc/fminunc_x0a.sce
new file mode 100644
index 0000000..e71b455
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_x0a.sce
@@ -0,0 +1,16 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct initial guess or not
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x0 = [];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fminunc: Expected Row Vector or Column Vector for x0 (Initial Value)
+//at line 160 of function fminunc called by :
+//[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
diff --git a/tests/general_tests/fminunc/fminunc_x0b.sce b/tests/general_tests/fminunc/fminunc_x0b.sce
new file mode 100644
index 0000000..a08b458
--- /dev/null
+++ b/tests/general_tests/fminunc/fminunc_x0b.sce
@@ -0,0 +1,16 @@
+//Find x in R^2 such that:
+// Check if a user specifies correct initial guess or not
+
+function y = fun(x)
+ y = x(1)^2 + x(2)^2;
+endfunction
+x0 = [1];
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", "OFF", "Hessian", "OFF");
+
+//Error
+//fminunc: Objective function and x0 did not match
+//at line 174 of function fminunc called by :
+//[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+
+[xopt,fopt,exitflag,output,gradient,hessian] = fminunc (fun, x0, options);
+