Skip to content

Commit c7dd605

Browse files
authored
Merge pull request #41 from Naveen2307/Scilab-6
fmincon is corrected
2 parents 9ce9411 + 3fe0790 commit c7dd605

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

macros/fmincon.sci

+15-15
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,11 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin
281281
end
282282
if (rhs==5) then
283283
param=varargin(5);
284-
Checktype("fmincon", param, "options", 5, "st");
284+
fot_Checktype("fmincon", param, "options", 5, "st");
285285
end
286286
if (rhs==7) then
287287
param=varargin(7);
288-
Checktype("fmincon", param, "options", 7, "st");
288+
fot_Checktype("fmincon", param, "options", 7, "st");
289289
end
290290

291291
//Storing the Input Parameters
@@ -312,7 +312,7 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin
312312
if (rhs>8) then
313313
if(type(varargin(9))==17)
314314
param = varargin(9);
315-
Checktype("fmincon", param, "options", 9, "st");
315+
fot_Checktype("fmincon", param, "options", 9, "st");
316316
else
317317
nlc = varargin(9);
318318
end
@@ -327,10 +327,10 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin
327327

328328

329329
//To check whether the 1st Input argument (fun) is a function or not
330-
Checktype("fmincon", fun, "f", 1, "function");
330+
fot_Checktype("fmincon", fun, "f", 1, "function");
331331

332332
//To check whether the 2nd Input argument (x0) is a vector/scalar
333-
Checktype("fmincon", x0, "x0", 2, "constant");
333+
fot_Checktype("fmincon", x0, "x0", 2, "constant");
334334

335335
//To check and convert the 2nd Input argument (x0) to a row vector
336336
if((size(x0,1)~=1) & (size(x0,2)~=1)) then
@@ -370,7 +370,7 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin
370370
endfunction
371371

372372
//To check whether the 3rd Input argument (A) is a Matrix/Vector
373-
Checktype("fmincon", A, "A", 3, "constant");
373+
fot_Checktype("fmincon", A, "A", 3, "constant");
374374

375375
//To check for correct size of A(3rd paramter)
376376
if(size(A,2)~=s(2) & size(A,2)~=0) then
@@ -381,7 +381,7 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin
381381
s1=size(A);
382382

383383
//To check whether the 4th Input argument (b) is a vector/scalar
384-
Checktype("fmincon", b, "b", 4, "constant");
384+
fot_Checktype("fmincon", b, "b", 4, "constant");
385385

386386
//To check for the correct size of b (4th paramter) and convert it into a column vector which is required for Ipopt
387387
if(s1(2)==0) then
@@ -407,7 +407,7 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin
407407
end
408408

409409
//To check whether the 5th Input argument (Aeq) is a matrix/vector
410-
Checktype("fmincon", Aeq, "Aeq", 5, "constant");
410+
fot_Checktype("fmincon", Aeq, "Aeq", 5, "constant");
411411

412412
//To check for the correct size of Aeq (5th paramter)
413413
if(size(Aeq,2)~=s(2) & size(Aeq,2)~=0) then
@@ -418,7 +418,7 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin
418418
s2=size(Aeq);
419419

420420
//To check whether the 6th Input argument(beq) is a vector/scalar
421-
Checktype("fmincon", beq, "beq", 6, "constant");
421+
fot_Checktype("fmincon", beq, "beq", 6, "constant");
422422

423423
//To check for the correct size of beq(6th paramter) and convert it into a column vector which is required for Ipopt
424424
if(s2(2)==0) then
@@ -445,7 +445,7 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin
445445

446446

447447
//To check whether the 7th Input argument (lb) is a vector/scalar
448-
Checktype("fmincon", lb, "lb", 7, "constant");
448+
fot_Checktype("fmincon", lb, "lb", 7, "constant");
449449

450450
//To check for the correct size and data of lb (7th paramter) and convert it into a column vector as required by Ipopt
451451
if (size(lb,2)==0) then
@@ -468,7 +468,7 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin
468468
end
469469

470470
//To check whether the 8th Input argument (ub) is a vector/scalar
471-
Checktype("fmincon", ub, "ub", 8, "constant");
471+
fot_Checktype("fmincon", ub, "ub", 8, "constant");
472472

473473
//To check for the correct size and data of ub (8th paramter) and convert it into a column vector as required by Ipopt
474474
if (size(ub,2)==0) then
@@ -578,7 +578,7 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin
578578
end
579579

580580
//If options has been entered, then check its type for 'list'
581-
Checktype("fmincon", param, "options", 10, "st");
581+
fot_Checktype("fmincon", param, "options", 10, "st");
582582

583583
//To set default values for options, if user doesn't enter options
584584
options = list("MaxIter", [3000], "CpuTime", [600] );
@@ -660,7 +660,7 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin
660660

661661
//To check for correct input of Objective Gradient function from the user
662662
if (flag1==1) then
663-
Checktype("fmincon", fGrad, "fGrad", 10, "function");
663+
fot_Checktype("fmincon", fGrad, "fGrad", 10, "function");
664664

665665
if(execstr('sample_fGrad=fGrad(x0)','errcatch')==21)
666666
errmsg = msprintf(gettext("%s: Gradient function of Objective and x0 did not match "), "fmincon");
@@ -679,7 +679,7 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin
679679

680680
//To check for correct input of Lagrangian Hessian function from the user
681681
if (flag2==1) then
682-
Checktype("fmincon", lHess, "lHess", 10, "function");
682+
fot_Checktype("fmincon", lHess, "lHess", 10, "function");
683683

684684
if(execstr('sample_lHess=lHess(x0,1,1:no_nlc)','errcatch')==21)
685685
errmsg = msprintf(gettext("%s: Hessian function of Objective and x0 did not match "), "fmincon");
@@ -694,7 +694,7 @@ function [xopt,fopt,exitflag,output,lambda,gradient,hessian] = fmincon (varargin
694694

695695
//To check for correct input of Constraint Gradient function from the user
696696
if (flag3==1) then
697-
Checktype("fmincon", cGrad, "cGrad", 10, "function");
697+
fot_Checktype("fmincon", cGrad, "cGrad", 10, "function");
698698

699699
if(execstr('[sample_cGrad,sample_ceqg]=cGrad(x0)','errcatch')==21)
700700
errmsg = msprintf(gettext("%s: Gradient function of Constraint and x0 did not match "), "fmincon");

0 commit comments

Comments
 (0)