a function that accepts a vector x and returns a vector F
-
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.
-Finds the minimum of a problem specified by:
-Minimise Y such that
-
-
The solver makes use of fmincon to find the minimum.
-
The fgoalattain finds out the maximum value of Y for the objectives evaluated at the starting point and
-adds that as another variable to the vector x
-This is passed to the fmincon function to get the optimised value of Y
-Hence, the algorithm used mainly is "ipopt" to obtain the optimum solution
-The relations between f(x), Y, weights and goals are added as additional non-linear inequality constraints
-
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.
-
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.
-
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.
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 :
-
-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 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.
-
Furthermore, we must enable the "GradCon" option with the statement :
-
-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.
-
The constraint derivative function must have header :
-
[dc,dceq]=confungrad(x)
-where dc is a nni x n matrix of doubles and dceq is a nne x n matrix of doubles.
-
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.
-
exitflag=2 : Maximum amount of CPU Time exceeded. Output may not be optimal.
-
exitflag=3 : Stop at Tiny Step.
-
exitflag=4 : Solved To Acceptable Level.
-
exitflag=5 : Converged to a point of local infeasibility.
-
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
-
output.Cpu_Time: The total cpu-time spend during the search
-
output.Objective_Evaluation: The number of Objective Evaluations performed during the search
-
output.Dual_Infeasibility: The Dual Infeasiblity of the final soution
-
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.ineqlin: The Lagrange multipliers for the linear inequality constraints.
-
lambda.eqnonlin: The Lagrange multipliers for the non-linear equality constraints.
-
lambda.ineqnonlin: The Lagrange multipliers for the non-linear inequality constraints.
a function, representing the objective function of the problem
-
x1 :
-
a vector, containing the lower bound of the variables of size (1 X n) or (n X 1) where 'n' is the number of Variables, where n is number of Variables
-
x2 :
-
a vector, containing the upper bound of the variables of size (1 X n) or (n X 1) or (0 X 0) where 'n' is the number of Variables. If x2 is empty it means upper bound is +infinity
-
options :
-
a list, containing the option for user to specify. See below for details.
-
xopt :
-
a vector of doubles, containing the the computed solution of the optimization problem.
-
fopt :
-
a scalar of double, containing the the function value at x.
-
exitflag :
-
a scalar of integer, containing the flag which denotes the reason for termination of algorithm. See below for details.
-
output :
-
a structure, containing the information about the optimization. See below for details.
-
lambda :
-
a structure, containing the Lagrange multipliers of lower bound and upper bound at the optimized point. See below for details.
-
-
Description
-
Search the minimum of a multi-variable function on bounded interval specified by :
-Find the minimum of f(x) such that
-
-
The routine calls Ipopt for solving the Bounded Optimization 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.
-
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.
-
exitflag=2 : Maximum CPU Time exceeded. Output may not be optimal.
-
exitflag=3 : Stop at Tiny Step.
-
exitflag=4 : Solved To Acceptable Level.
-
exitflag=5 : Converged to a point of local infeasibility.
-
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
-
output.Cpu_Time: The total cpu-time spend during the search
-
output.Objective_Evaluation: The number of Objective Evaluations performed during the search
-
output.Dual_Infeasibility: The Dual Infeasiblity of the final soution
-
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.
-
-
-
Examples
-
//Find x in R^6 such that it minimizes:
-//f(x)= sin(x1) + sin(x2) + sin(x3) + sin(x4) + sin(x5) + sin(x6)
-//-2 <= x1,x2,x3,x4,x5,x6 <= 2
-//Objective function to be minimised
-functiony=f(x)
-y=0
-fori=1:6
-y=y+sin(x(i));
-end
-endfunction
-//Variable bounds
-x1=[-2,-2,-2,-2,-2,-2];
-x2=[2,2,2,2,2,2];
-//Options
-options=list("MaxIter",[1500],"CpuTime",[100],"TolX",[1e-6])
-//Calling Ipopt
-[x,fval]=fminbnd(f,x1,x2,options)
-// Press ENTER to continue
-
-
Examples
-
//Find x in R such that it minimizes:
-//f(x)= 1/x^2
-//0 <= x <= 1000
-//Objective function to be minimised
-functiony=f(x)
-y=1/x^2
-endfunction
-//Variable bounds
-x1=[0];
-x2=[1000];
-//Calling Ipopt
-[x,fval,exitflag,output,lambda]=fminbnd(f,x1,x2)
-// Press ENTER to continue
-
-
Examples
-
//The below problem is an unbounded problem:
-//Find x in R^2 such that it minimizes:
-//f(x)= -[(x1-1)^2 + (x2-1)^2]
-//-inf <= x1,x2 <= inf
-//Objective function to be minimised
-functiony=f(x)
-y=-((x(1)-1)^2+(x(2)-1)^2);
-endfunction
-//Variable bounds
-x1=[-%inf,-%inf];
-x2=[];
-//Options
-options=list("MaxIter",[1500],"CpuTime",[100],"TolX",[1e-6])
-//Calling Ipopt
-[x,fval,exitflag,output,lambda]=fminbnd(f,x1,x2,options)
a function, representing the objective function of the problem
-
x0 :
-
a vector of doubles, containing the starting values of variables of size (1 X n) or (n X 1) where 'n' is the number of Variables
-
A :
-
a matrix of doubles, containing the coefficients of linear inequality constraints of size (m X n) where 'm' is the number of linear inequality constraints
-
b :
-
a vector of doubles, related to 'A' and containing the the Right hand side equation of the linear inequality constraints of size (m X 1)
-
Aeq :
-
a matrix of doubles, containing the coefficients of linear equality constraints of size (m1 X n) where 'm1' is the number of linear equality constraints
-
beq :
-
a vector of doubles, related to 'Aeq' and containing the the Right hand side equation of the linear equality constraints of size (m1 X 1)
-
lb :
-
a vector of doubles, containing the lower bounds of the variables of size (1 X n) or (n X 1) where 'n' is the number of Variables
-
ub :
-
a vector of doubles, containing the upper bounds of the variables of size (1 X n) or (n X 1) where 'n' is the number of Variables
-
nlc :
-
a function, representing the Non-linear Constraints functions(both Equality and Inequality) of the problem. It is declared in such a way that non-linear inequality constraints are defined first as a single row vector (c), followed by non-linear equality constraints as another single row vector (ceq). Refer Example for definition of Constraint function.
-
options :
-
a list, containing the option for user to specify. See below for details.
-
xopt :
-
a vector of doubles, cointating the computed solution of the optimization problem
-
fopt :
-
a scalar of double, containing the the function value at x
-
exitflag :
-
a scalar of integer, containing the flag which denotes the reason for termination of algorithm. See below for details.
-
output :
-
a structure, containing the information about the optimization. See below for details.
-
lambda :
-
a structure, containing the Lagrange multipliers of lower bound, upper bound and constraints at the optimized point. See below for details.
-
gradient :
-
a vector of doubles, containing the Objective's gradient of the solution.
-
hessian :
-
a matrix of doubles, containing the Lagrangian's hessian of the solution.
-
-
Description
-
Search the minimum of a constrained optimization problem specified by :
-Find the minimum of f(x) such that
-
-
The routine calls Ipopt for solving the Constrained Optimization 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.
-
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.
-
GradObj : a function, representing the gradient function of the Objective in Vector Form.
-
Hessian : a function, representing the hessian function of the Lagrange in Symmetric Matrix Form with Input parameters x, Objective factor and Lambda. Refer Example for definition of Lagrangian Hessian function.
-
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.
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.
-
exitflag=2 : Maximum amount of CPU Time exceeded. Output may not be optimal.
-
exitflag=3 : Stop at Tiny Step.
-
exitflag=4 : Solved To Acceptable Level.
-
exitflag=5 : Converged to a point of local infeasibility.
-
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
-
output.Cpu_Time: The total cpu-time spend during the search
-
output.Objective_Evaluation: The number of Objective Evaluations performed during the search
-
output.Dual_Infeasibility: The Dual Infeasiblity of the final soution
-
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.ineqlin: The Lagrange multipliers for the linear inequality constraints.
-
lambda.eqnonlin: The Lagrange multipliers for the non-linear equality constraints.
-
lambda.ineqnonlin: The Lagrange multipliers for the non-linear inequality constraints.
-
-
-
Examples
-
//Find x in R^2 such that it minimizes:
-//f(x)= -x1 -x2/3
-//x0=[0,0]
-//constraint-1 (c1): x1 + x2 <= 2
-//constraint-2 (c2): x1 + x2/4 <= 1
-//constraint-3 (c3): x1 - x2 <= 2
-//constraint-4 (c4): -x1/4 - x2 <= 1
-//constraint-5 (c5): -x1 - x2 <= -1
-//constraint-6 (c6): -x1 + x2 <= 2
-//constraint-7 (c7): x1 + x2 = 2
-//Objective function to be minimised
-functiony=f(x)
-y=-x(1)-x(2)/3;
-endfunction
-//Starting point, linear constraints and variable bounds
-x0=[0,0];
-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];
-beq=[2];
-lb=[];
-ub=[];
-nlc=[];
-//Gradient of objective function
-functiony=fGrad(x)
-y=[-1,-1/3];
-endfunction
-//Hessian of lagrangian
-functiony=lHess(x, obj, lambda)
-y=obj*[0,0;0,0]
-endfunction
-//Options
-options=list("GradObj",fGrad,"Hessian",lHess);
-//Calling Ipopt
-[x,fval,exitflag,output,lambda,grad,hessian]=fmincon(f,x0,A,b,Aeq,beq,lb,ub,nlc,options)
-// Press ENTER to continue
-
-
Examples
-
//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
-functiony=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
-functiony=fGrad(x)
-y=[x(2),x(1)+x(3),x(2)];
-endfunction
-//Hessian of the Lagrange Function
-functiony=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
-[x,fval,exitflag,output]=fmincon(f,x0,A,b,Aeq,beq,lb,ub,nlc,options)
-// Press ENTER to continue
-
-
Examples
-
//The below problem is an unbounded problem:
-//Find x in R^3 such that it minimizes:
-//f(x)= -(x1^2 + x2^2 + x3^2)
-//x0=[0.1 , 0.1 , 0.1]
-// x1 <= 0
-// x2 <= 0
-// x3 <= 0
-//Objective function to be minimised
-functiony=f(x)
-y=-(x(1)^2+x(2)^2+x(3)^2);
-endfunction
-//Starting point, linear constraints and variable bounds
-x0=[0.1,0.1,0.1];
-A=[];
-b=[];
-Aeq=[];
-beq=[];
-lb=[];
-ub=[0,0,0];
-//Options
-options=list("MaxIter",[1500],"CpuTime",[500]);
-//Calling Ipopt
-[x,fval,exitflag,output,lambda,grad,hessian]=fmincon(f,x0,A,b,Aeq,beq,lb,ub,[],options)
-// Press ENTER to continue
-
-
Examples
-
//The below problem is an infeasible problem:
-//Find x in R^3 such that in minimizes:
-//f(x)=x1*x2 + x2*x3
-//x0=[1,1,1]
-//constraint-1 (c1): x1^2 <= 1
-//constraint-2 (c2): x1^2 + x2^2 <= 1
-//constraint-3 (c3): x3^2 <= 1
-//constraint-4 (c4): x1^3 = 0.5
-//constraint-5 (c5): x2^2 + x3^2 = 0.75
-// 0 <= x1 <=0.6
-// 0.2 <= x2 <= inf
-// -inf <= x3 <= 1
-//Objective function to be minimised
-functiony=f(x)
-y=x(1)*x(2)+x(2)*x(3);
-endfunction
-//Starting point, linear constraints and variable bounds
-x0=[1,1,1];
-A=[];
-b=[];
-Aeq=[];
-beq=[];
-lb=[00.2,-%inf];
-ub=[0.6%inf,1];
-//Nonlinear constraints
-function[c, ceq]=nlc(x)
-c=[x(1)^2-1,x(1)^2+x(2)^2-1,x(3)^2-1];
-ceq=[x(1)^3-0.5,x(2)^2+x(3)^2-0.75];
-endfunction
-//Gradient of objective function
-functiony=fGrad(x)
-y=[x(2),x(1)+x(3),x(2)];
-endfunction
-//Hessian of the Lagrange Function
-functiony=lHess(x, obj, lambda)
-y=obj*[0,1,0;1,0,1;0,1,0]+lambda(1)*[2,0,0;0,0,0;0,0,0]+lambda(2)*[2,0,0;0,2,0;0,0,0]+lambda(3)*[0,0,0;0,0,0;0,0,2]+lambda(4)*[6*x(1),0,0;0,0,0;0,0,0]+lambda(5)*[0,0,0;0,2,0;0,0,2];
-endfunction
-//Gradient of Non-Linear Constraints
-function[cg, ceqg]=cGrad(x)
-cg=[2*x(1),0,0;2*x(1),2*x(2),0;0,0,2*x(3)];
-ceqg=[3*x(1)^2,0,0;0,2*x(2),2*x(3)];
-endfunction
-//Options
-options=list("MaxIter",[1500],"CpuTime",[500],"GradObj",fGrad,"Hessian",lHess,"GradCon",cGrad);
-//Calling Ipopt
-[x,fval,exitflag,output,lambda,grad,hessian]=fmincon(f,x0,A,b,Aeq,beq,lb,ub,nlc,options)
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 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.
-
-
Currently, fminimax calls fmincon which uses the ip-opt algorithm.
-
max-min problems can also be solved with fminimax, using the identity
-
-
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.
-
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.
-
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.
-where x is a n x 1 matrix of doubles and F is a m x 1 matrix of doubles where m is the total number of objective functions inside F.
-On input, the variable x contains the current point and, on output, the variable F must contain the objective function values.
-
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.
-
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 :
-
-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).
-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.
-
Furthermore, we must enable the "GradCon" option with the statement :
-
-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.
-
The constraint derivative function must have header :
-
[dc,dceq]=confungrad(x)
-where dc is a nni x n matrix of doubles and dceq is a nne x n matrix of doubles.
-
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.
-
exitflag=2 : Maximum amount of CPU Time exceeded. Output may not be optimal.
-
exitflag=3 : Stop at Tiny Step.
-
exitflag=4 : Solved To Acceptable Level.
-
exitflag=5 : Converged to a point of local infeasibility.
-
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
-
output.Cpu_Time: The total cpu-time spend during the search
-
output.Objective_Evaluation: The number of Objective Evaluations performed during the search
-
output.Dual_Infeasibility: The Dual Infeasiblity of the final soution
-
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.ineqlin: The Lagrange multipliers for the linear inequality constraints.
-
lambda.eqnonlin: The Lagrange multipliers for the non-linear equality constraints.
-
lambda.ineqnonlin: The Lagrange multipliers for the non-linear inequality constraints.
-
-
-
Examples
-
// A basic case :
-// we provide only the objective function and the nonlinear constraint
-// function
-functionf=myfun(x)
-f(1)=2*x(1)^2+x(2)^2-48*x(1)-40*x(2)+304;//Objectives
-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
-// The initial guess
-x0=[0.1,0.1];
-// The expected solution : only 4 digits are guaranteed
-xopt=[44]
-fopt=[0-64-2-80]
-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
-// functions and the Jacobian matrix of the constraints.
-// The objective function and its gradient
-functionf=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
-functionG=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.927917.93551]
-fopt=[6.73443-189.7786.73443-8.863420.86342]
-maxfopt=6.73443
-// Run fminimax
-[x,fval,maxfval,exitflag,output]=fminimax(myfun,x0,[],[],[],[],[],[],confun,minimaxOptions)
a function, representing the objective function of the problem
-
x0 :
-
a vector of doubles, containing the starting of variables.
-
options:
-
a list, containing the option for user to specify. See below for details.
-
xopt :
-
a vector of doubles, the computed solution of the optimization problem.
-
fopt :
-
a scalar of double, the function value at x.
-
exitflag :
-
a scalar of integer, containing the flag which denotes the reason for termination of algorithm. See below for details.
-
output :
-
a structure, containing the information about the optimization. See below for details.
-
gradient :
-
a vector of doubles, containing the the gradient of the solution.
-
hessian :
-
a matrix of doubles, containing the the hessian of the solution.
-
-
Description
-
Search the minimum of an unconstrained optimization problem specified by :
-Find the minimum of f(x) such that
-
-
The routine calls Ipopt for solving the Un-constrained Optimization 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.
-
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.
-
exitflag=2 : Maximum CPU Time exceeded. Output may not be optimal.
-
exitflag=3 : Stop at Tiny Step.
-
exitflag=4 : Solved To Acceptable Level.
-
exitflag=5 : Converged to a point of local infeasibility.
-
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
-
output.Cpu_Time: The total cpu-time spend during the search
-
output.Objective_Evaluation: The number of Objective Evaluations performed during the search
-
output.Dual_Infeasibility: The Dual Infeasiblity of the final soution
-
-
-
Examples
-
//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
-functiony=f(x)
-y=100*(x(2)-x(1)^2)^2+(1-x(1))^2;
-endfunction
-//Starting point
-x0=[-1,2];
-//Gradient of objective function
-functiony=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
-functiony=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)
-// Press ENTER to continue
-
-
Examples
-
//Find x in R^2 such that the below function is minimum
-//f = x1^2 + x2^2
-//Objective function to be minimised
-functiony=f(x)
-y=x(1)^2+x(2)^2;
-endfunction
-//Starting point
-x0=[2,1];
-//Calling Ipopt
-[xopt,fopt]=fminunc(f,x0)
-// Press ENTER to continue
-
-
Examples
-
//The below problem is an unbounded problem:
-//Find x in R^2 such that the below function is minimum
-//f = - x1^2 - x2^2
-//Objective function to be minimised
-functiony=f(x)
-y=-x(1)^2-x(2)^2;
-endfunction
-//Starting point
-x0=[2,1];
-//Gradient of objective function
-functiony=fGrad(x)
-y=[-2*x(1),-2*x(2)];
-endfunction
-//Hessian of Objective Function
-functiony=fHess(x)
-y=[-2,0;0,-2];
-endfunction
-//Options
-options=list("MaxIter",[1500],"CpuTime",[500],"Gradient",fGrad,"Hessian",fHess);
-//Calling Ipopt
-[xopt,fopt,exitflag,output,gradient,hessian]=fminunc(f,x0,options)
a vector of double, contains coefficients of the variables in the objective
-
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 :
-
Lower bounds, specified as a vector or array of double. lb represents the lower bounds elementwise in lb тЄ x тЄ ub.
-
ub :
-
Upper bounds, specified as a vector or array of double. ub represents the upper bounds elementwise in lb тЄ x тЄ ub.
-
options :
-
a list containing the parameters to be set.
-
file :
-
a string describing the path to the mps file.
-
xopt :
-
a vector of double, the computed solution of the optimization problem.
-
fopt :
-
a double, the value of the function at x.
-
status :
-
status flag returned from symphony. See below for details.
-
output :
-
The output data structure contains detailed information about the optimization process. See below for details.
-
lambda :
-
The structure consist of the Lagrange multipliers at the solution of problem. See below for details.
-
-
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 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.
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
-
exitflag=3 : Maximum Number of Iterations Exceeded. Output may not be optimal.
-
exitflag=4 : Solution Abandoned
-
exitflag=5 : Primal objective limit reached.
-
exitflag=6 : Dual objective limit reached.
-
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
-
output.constrviolation: The max-norm of the constraint violation.
-
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 variable lower bounds.
-
lambda.eqlin: The Lagrange multipliers for the linear equality constraints.
-
lambda.ineqlin: The Lagrange multipliers for the linear inequality constraints.
-
-
-
Examples
-
//Optimal problems
-//Linear program, linear 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]
-[xopt,fopt,exitflag,output,lambda]=linprog(c,A,b)
-// Press ENTER to continue
-
-
Examples
-
//Linear program with Linear Inequalities and Equalities`
-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]
-[xopt,fopt,exitflag,output,lambda]=linprog(c,A,b,Aeq,beq)
-// Press ENTER to continue
-
-
Examples
-
//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)
-// Press ENTER to continue
-
-
Examples
-
//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]
-[xopt,fopt,exitflag,output,lambda]=linprog(c,A,b,Aeq,beq,lb,ub)
-// Press ENTER to continue
-
-
Examples
-
//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]
-[xopt,fopt,exitflag,output,lambda]=linprog(c,A,b,Aeq,beq,lb,ub)
-// Press ENTER to continue
a matrix of double, represents the multiplier of the solution x in the expression Cт x - d. Number of columns in C is equal to the number of elements in x.
-
d :
-
a vector of double, represents the additive constant term in the expression Cт x - d. Number of elements in d is equal to the number of rows in C matrix.
-
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.
-
x0 :
-
a vector of double, contains initial guess of variables.
-
param :
-
a list containing the parameters to be set.
-
xopt :
-
a vector of double, the computed solution of the optimization problem.
-
resnorm :
-
a double, objective value returned as the scalar value norm(Cт x-d)^2.
-
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.
-
-
Description
-
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.
-
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.
-
exitflag=2 : Maximum CPU Time exceeded. Output may not be optimal.
-
exitflag=3 : Stop at Tiny Step.
-
exitflag=4 : Solved To Acceptable Level.
-
exitflag=5 : Converged to a point of local infeasibility.
-
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
-
output.constrviolation: The max-norm of the constraint violation.
-
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.ineqlin: The Lagrange multipliers for the linear inequality constraints.
-
-
-
Examples
-
//A simple linear least square example
-C=[20;
--11;
-02]
-d=[1
-0
--1];
-A=[10-2;
--210];
-b=[4
--4];
-[xopt,resnorm,residual,exitflag,output,lambda]=lsqlin(C,d,A,b)
-// Press ENTER to continue
a matrix of double, represents the multiplier of the solution x in the expression Cт x - d. Number of columns in C is equal to the number of elements in x.
-
d :
-
a vector of double, represents the additive constant term in the expression Cт x - d. Number of elements in d is equal to the number of rows in C matrix.
-
xopt :
-
a vector of double, the computed solution of the optimization problem.
-
resnorm :
-
a double, objective value returned as the scalar value norm(Cт x-d)^2.
-
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.
-
-
Description
-
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.
-
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.
-
exitflag=2 : Maximum CPU Time exceeded. Output may not be optimal.
-
exitflag=3 : Stop at Tiny Step.
-
exitflag=4 : Solved To Acceptable Level.
-
exitflag=5 : Converged to a point of local infeasibility.
-
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
-
output.constrviolation: The max-norm of the constraint violation.
-
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.
-
-
-
Examples
-
// A basic lsqnonneg problem
-C=[111;
-110;
-011;
-100;
-001]
-d=[89;
-67;
-53;
-35;
-20;]
-[xopt,resnorm,residual,exitflag,output,lambda]=lsqnonneg(C,d)
a symmetric matrix of double, represents coefficients of quadratic in the quadratic problem.
-
f :
-
a vector of double, represents coefficients of linear in the quadratic problem
-
lb :
-
a vector of double, contains lower bounds of the variables.
-
ub :
-
a vector of double, contains upper bounds of the variables.
-
A :
-
a matrix of double, contains the constraint matrix conLB тЄ Aт x тЄ conUB.
-
conLB :
-
a vector of double, contains lower bounds of the constraints conLB тЄ Aт x тЄ conUB.
-
conUB :
-
a vector of double, contains upper bounds of the constraints conLB тЄ Aт x тЄ conUB.
-
x0 :
-
a vector of double, contains initial guess of variables.
-
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.
-
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
-
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.
-
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.
-
exitflag=2 : Maximum CPU Time exceeded. Output may not be optimal.
-
exitflag=3 : Stop at Tiny Step.
-
exitflag=4 : Solved To Acceptable Level.
-
exitflag=5 : Converged to a point of local infeasibility.
-
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
-
output.constrviolation: The max-norm of the constraint violation.
-
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.ineqlin: The Lagrange multipliers for the linear inequality constraints.
-
-
-
Examples
-
//Ref : example 14 :
-//https://www.me.utexas.edu/~jensen/ORMM/supplements/methods/nlpmethod/S2_quadratic.pdf
-// min. -8*x1*x1 -16*x2*x2 + x1 + 4*x2
-// such that
-// x1 + x2 <= 5,
-// x1 <= 3,
-// x1 >= 0,
-// x2 >= 0
-H=[20
-08];
-f=[-8;-16];
-A=[11;10];
-conUB=[5;3];
-conLB=[-%inf;-%inf];
-lb=[0;0];
-ub=[%inf;%inf];
-nbVar=2;
-nbCon=2;
-[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB)
-//Press ENTER to continue
-
-
Examples
-
//Find x in R^6 such that:
-A=[1,-1,1,0,3,1;
--1,0,-3,-4,5,6;
-2,5,3,0,1,0
-0,1,0,1,2,-1;
--1,0,2,1,1,0];
-conLB=[1;2;3;-%inf;-%inf];
-conUB=[1;2;3;-1;2.5];
-lb=[-1000;-10000;0;-1000;-1000;-1000];
-ub=[10000;100;1.5;100;100;1000];
-//and minimize 0.5*x'т Hт x + f'т x with
-f=[1;2;3;4;5;6];H=eye(6,6);
-nbVar=6;
-nbCon=5;
-x0=repmat(0,nbVar,1);
-param=list("MaxIter",300,"CpuTime",100);
-[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0,param)
a n x n matrix of doubles, where n is number of variables, represents coefficients of quadratic in the quadratic problem.
-
f :
-
a n x 1 matrix of doubles, where n is number of variables, represents coefficients of linear in the quadratic problem
-
A :
-
a m x n matrix of doubles, represents the linear coefficients in the inequality constraints
-
b :
-
a column vector of doubles, represents the linear coefficients in the inequality constraints
-
Aeq :
-
a meq x n matrix of doubles, represents the linear coefficients in the equality constraints
-
beq :
-
a vector of doubles, represents the linear coefficients in the equality constraints
-
LB :
-
a n x 1 matrix of doubles, where n is number of variables, contains lower bounds of the variables.
-
UB :
-
a n x 1 matrix of doubles, where n is number of variables, contains upper bounds of the variables.
-
xopt :
-
a nx1 matrix of doubles, the computed solution of the optimization problem.
-
fopt :
-
a 1x1 matrix of doubles, the function value at x.
-
exitflag :
-
Integer identifying the reason the algorithm terminated.
-
output :
-
Structure containing information about the optimization.
-
lambda :
-
Structure containing the Lagrange multipliers at the solution x (separated by constraint type).
-
-
Description
-
Search the minimum of a constrained linear quadratic optimization problem specified by :
-find the minimum of f(x) such that
-
-
We are calling IPOpt for solving the quadratic problem, IPOpt is a library written in C++. The code has been written by тAndreas WУЄchter and тCarl Laird.
-
-
-
Examples
-
//Find x in R^6 such that:
-
-Aeq=[1,-1,1,0,3,1;
--1,0,-3,-4,5,6;
-2,5,3,0,1,0];
-beq=[1;2;3];
-A=[0,1,0,1,2,-1;
--1,0,2,1,1,0];
-b=[-1;2.5];
-lb=[-1000;-10000;0;-1000;-1000;-1000];
-ub=[10000;100;1.5;100;100;1000];
-//and minimize 0.5*x'*Q*x + p'*x with
-f=[1;2;3;4;5;6];H=eye(6,6);
-[xopt,fopt,exitflag,output,lambda]=qpipopt_mat(H,f,A,b,Aeq,beq,lb,ub)
-clearHfAbAeqbeqlbub;
-
-
Examples
-
//Find the value of x that minimize following function
-// f(x) = 0.5*x1^2 + x2^2 - x1*x2 - 2*x1 - 6*x2
-// Subject to:
-// x1 + x2 тЄ 2
-// тx1 + 2x2 тЄ 2
-// 2x1 + x2 тЄ 3
-// 0 тЄ x1, 0 тЄ x2.
-H=[1-1;-12];
-f=[-2;-6];
-A=[11;-12;21];
-b=[2;2;3];
-lb=[0;0];
-ub=[%inf;%inf];
-[xopt,fopt,exitflag,output,lambda]=qpipopt_mat(H,f,A,b,[],[],lb,ub)
a symmetric matrix of double, represents coefficients of quadratic in the quadratic problem.
-
f :
-
a vector of double, represents coefficients of linear in the quadratic problem
-
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.
-
x0 :
-
a vector of double, contains initial guess of variables.
-
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.
-
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
-
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.
-
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.
-
exitflag=2 : Maximum CPU Time exceeded. Output may not be optimal.
-
exitflag=3 : Stop at Tiny Step.
-
exitflag=4 : Solved To Acceptable Level.
-
exitflag=5 : Converged to a point of local infeasibility.
-
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
-
output.constrviolation: The max-norm of the constraint violation.
-
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.ineqlin: The Lagrange multipliers for the linear inequality constraints.
-
-
-
Examples
-
//Ref : example 14 :
-//https://www.me.utexas.edu/~jensen/ORMM/supplements/methods/nlpmethod/S2_quadratic.pdf
-// min. -8*x1*x1 -16*x2*x2 + x1 + 4*x2
-// such that
-// x1 + x2 <= 5,
-// x1 <= 3,
-// x1 >= 0,
-// x2 >= 0
-H=[20
-08];
-f=[-8;-16];
-A=[11;10];
-b=[5;3];
-lb=[0;0];
-ub=[%inf;%inf];
-[xopt,fopt,exitflag,output,lambda]=qpipoptmat(H,f,A,b,[],[],lb,ub)
-// Press ENTER to continue
-
-
Examples
-
//Find x in R^6 such that:
-Aeq=[1,-1,1,0,3,1;
--1,0,-3,-4,5,6;
-2,5,3,0,1,0];
-beq=[1;2;3];
-A=[0,1,0,1,2,-1;
--1,0,2,1,1,0];
-b=[-1;2.5];
-lb=[-1000;-10000;0;-1000;-1000;-1000];
-ub=[10000;100;1.5;100;100;1000];
-x0=repmat(0,6,1);
-param=list("MaxIter",300,"CpuTime",100);
-//and minimize 0.5*x'*H*x + f'*x with
-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,x0,param)
This function adds a new constraint from scratch. Supported types of constraints are less than or equal to, more than or equal to, equal to, or ranged.
-
The last argument is only required for ranged constraints. For the other types of constraints, only the third argument is required.
-
-
Arguments
-
-
coeff
-
Sparse matrix representing coefficients of the variables in the new constraint (must have 1 row and number of columns equal to number of variables)
-
type
-
Type of the new constraint. Supported types: less than or equal to ("L"), greater than or equal to ("G"), equal to ("E"), or ranged ("R")
-
bound1
-
The first (or only) bound for the constraint
-
bound2
-
The second bound for ranged constraints. The two bounds for ranged constraints can be in any order.
Sparse matrix representing coefficients of the new variable in the existing constraints (must have 1 column and number of rows equal to number of constraints)
-
lower
-
Lower bound of the new variable
-
upper
-
Upper bound of the new variable
-
obj
-
Coefficient of the variable in the objective function
-
isInt
-
Wether the variable is constrainted to be an integer (boolean %t or %f)
This routine is used to delete columns from the original problem description.
-
-
Calling Sequence
-
sym_deleteVars(indices)
-
-
Description
-
-
Arguments
-
-
indices
-
Pointer to an integer type array indicating the indices of the column numbers(variables) to be deleted.
-
-
Return value
-
-
Returns 0 if the column numbers specified are deleted successfully and 0 if the deletion of column indices did not execute successfully and it returns with an error return value
This routine is used to get the value of a double type parameter.
-
-
Calling Sequence
-
sym_getDblParam(key)
-
-
Description
-
-
Arguments
-
-
key
-
The name of the double parameter whose value has to be retrieved. Note: should be given within " "
-
-
Return value
-
-
Returns 0 if the parameter's value has been successfully retrieved and displayed on the console ,else 1 is returned corressponding to an error value for the unsuccessful execution of the function
This routine is used to get the value of an integer type parameter.
-
-
Calling Sequence
-
sym_getIntParam(key)
-
-
Description
-
-
Arguments
-
-
key
-
The name of the integer parameter whose value has to be retrieved. Note: should be given within " "
-
-
Return value
-
-
Returns 0 if the parameter's value has been successfully retrieved and displayed on the console ,else 1 is returned corressponding to an error value for the unsuccessful execution of the function
This routine is used to get the value of a string type parameter.
-
-
Calling Sequence
-
sym_getStrParam(key)
-
-
Description
-
-
Arguments
-
-
key
-
The name of the strung parameter whose value has to be retrieved. Note: should be given within " "
-
-
Return value
-
-
Returns 0 if the parameter's value has been successfully retrieved and displayed on the console ,else 1 is returned corressponding to an error value for the unsuccessful execution of the function
This routine is used to load an instance from an MPS file.
-
-
Calling Sequence
-
sym_loadMPS(filename)
-
-
Description
-
-
Arguments
-
-
filename
-
It is a string that has the path of the .mps file to loaded.It has to be given within double quotes ("")
-
-
Return value
-
-
Returns 0 if the .mps file is loaded properly to symphony and 0 if there is an error reading the mps file or the function returns with an error return value
This function completely modifies the type of a constraint. Supported types of constraints are less than or equal to, more than or equal to, equal to, or ranged.
-
The last argument is only required for ranged constraints. For the other types of constraints, only the third argument is required.
-
-
Arguments
-
-
index
-
Index of the constraint to modify. Must be in {0,1,2,...n-1} where n is the number of constraints in the problem
-
type
-
New type of the constraint. Supported types: less than or equal to ("L"), greater than or equal to ("G"), equal to ("E"), or ranged ("R")
-
bound1
-
The first (or only) bound for the constraint
-
bound2
-
The second bound for ranged constraints. The two bounds for ranged constraints can be in any order.
a vector of double, represents coefficients of the variables in the objective.
-
isInt :
-
a vector of boolean, represents wether a variable is constrained to be an integer.
-
lb :
-
a vector of double, represents lower bounds of the variables.
-
ub :
-
a vector of double, represents upper bounds of the variables.
-
A :
-
a matrix of double, represents matrix representing the constraint matrix conLB тЄ Aт x тЄ conUB.
-
conLB :
-
a vector of double, represents lower bounds of the constraints conLB тЄ Aт x тЄ conUB.
-
conUB :
-
a vector of double, represents upper bounds of the constraints conLB тЄ Aт x тЄ conUB.
-
objSense :
-
The sense (maximization/minimization) of the objective. Use 1(sym_minimize ) or -1 (sym_maximize) here.
-
options :
-
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.
-
status :
-
status flag returned from symphony.See below for details.
-
output :
-
The output data structure contains detailed information about the optimization process. See below for details.
-
-
Description
-
Search the minimum or maximum of a constrained mixed integer linear programming optimization problem specified by :
-
-
The routine calls SYMPHONY written in C by gateway files for the actual computation.
-
The status allows to know the status of the optimization which is given back by Ipopt.
-
status=227 : Optimal Solution Found
-
status=228 : Maximum CPU Time exceeded.
-
status=229 : Maximum Number of Node Limit Exceeded.
-
status=230 : Maximum Number of Iterations Limit Exceeded.
-
For more details on status see the symphony documentation, go to http://www.coin-or.org/SYMPHONY/man-5.6/
-
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
-
-
-
Examples
-
//Reference: Westerberg, Carl-Henrik, Bengt Bjorklund, and Eskil Hultman. "An application of mixed integer programming in a Swedish steel mill." Interfaces 7, no. 2 (1977): 39-43.
-// Objective function
-c=[350*5,330*3,310*4,280*6,500,450,400,100]';
-// Lower Bound of variable
-lb=repmat(0,8,1);
-// Upper Bound of variables
-ub=[repmat(1,4,1);repmat(%inf,4,1)];
-// Constraint Matrix
-A=[5,3,4,6,1,1,1,1;
-5*0.05,3*0.04,4*0.05,6*0.03,0.08,0.07,0.06,0.03;
-5*0.03,3*0.03,4*0.04,6*0.04,0.06,0.07,0.08,0.09;]
-// Lower Bound of constraints
-conlb=[25;1.25;1.25]
-// Upper Bound of constraints
-conub=[25;1.25;1.25]
-// Row Matrix for telling symphony that the is integer or not
-isInt=[repmat(%t,1,4)repmat(%f,1,4)];
-xopt=[11017.2500.253.5]
-fopt=[8495]
-// Calling Symphony
-[x,f,status,output]=symphony(8,3,c,isInt,lb,ub,A,conlb,conub,1)
-// Press ENTER to continue
-
-
Examples
-
// An advanced case where we set some options in symphony
-// This problem is taken from
-// P.C.Chu and J.E.Beasley
-// "A genetic algorithm for the multidimensional knapsack problem",
-// Journal of Heuristics, vol. 4, 1998, pp63-86.
-// The problem to be solved is:
-// Max sum{j=1,...,n} p(j)x(j)
-// st sum{j=1,...,n} r(i,j)x(j) <= b(i) i=1,...,m
-// x(j)=0 or 1
-// The function to be maximize i.e. P(j)
-c=[5048036671103834585811856690832846813868793..
-82510028606155407976166607078666477461006608..
-87790057378848485394263059163064011699321034..
-95779866962546710515527176543885595551104783..
-959668507855986831821825868852832828799686..
-51067157574051067599663682610221140654909799..
-11626538146255994767679549069046498735658531008632]';
-//Constraint Matrix
-A=[
-//Constraint 1
-424152321581955169193582375367478162898..
-550553298577493183260224852394958282402604..
-16430821861273772191117276877415873902465..
-32087024478186622665155680101665227597354..
-5977916299884913611275173588471449266420..
-797945746464454588272383714987183731301..
-71891109567708507983808766615554282995946651298;
-//Constraint 2
-509883229569706639114727491481681948687941..
-35025357340124384660951739329146593658816..
-638717779289430851937289159260930248656833..
-8926027874129796786249354614836290893857..
-15886920650479975843158078078858364132653..
-252709129368440314287854460594512239719751..
-708670269832137356960651398893407477552805881850;
-//Constraint 3
-806361199781596669957358259888319751275177..
-88374922926528269481977190551140442867283..
-137359445584401924857448449695083357877..
-482732968113486710439747174260877474841422..
-280684330910791322404403519148948414894147..
-732979765138067582973143732624518847113..
-38297905398859414211011213398173106331254447;
-//Constraint 4
-4041978171000443073965946334448599931776..
-263980807378278841700210542636388129203110..
-817502657804662989585645113436610948919115..
-96713445449740592327167368335179909825614..
-98735017941582152577428342727565939273896..
-6898269742124667264973119151498388695846..
-68920641714735267822977302687118990323993525322;
-//Constrain 5
-4753628757745700803654196844657387518143..
-515335942701332803265922908139995845487100..
-44765364973842447542592679547136801904740..
-768460766605009158972571655772696653933..
-4205828108617586472376312719175756409440..
-4833367656379819802023559468960276767693..
-893160785311417748375362617553474915457261350635;
-];
-nbCon=size(A,1)
-nbVar=size(A,2)
-// Lower Bound of variables
-lb=repmat(0,nbVar,1)
-// Upper Bound of variables
-ub=repmat(1,nbVar,1)
-// Row Matrix for telling symphony that the is integer or not
-isInt=repmat(%t,1,nbVar)
-// Lower Bound of constraints
-conLB=repmat(0,nbCon,1);
-// Upper Bound of constraints
-conUB=[1192713727115511305613460]';
-options=list("time_limit",25);
-// The expected solution :
-// Output variables
-xopt=[0110010101000000010000101101101..
-00000000000100000100000010000110010..
-010100100101000001100000110010010]
-// Optimal value
-fopt=[24381]
-// Calling Symphony
-[x,f,status,output]=symphony(nbVar,nbCon,c,isInt,lb,ub,A,conLB,conUB,-1,options);
a 1xn matrix of doubles, where n is number of variables, contains coefficients of the variables in the objective
-
intcon :
-
Vector of integer constraints, specified as a vector of positive integers. The values in intcon indicate the components of the decision variable x that are integer-valued. intcon has values from 1 through number of variable
-
A :
-
Linear inequality constraint matrix, specified as a matrix of doubles. A represents the linear coefficients in the constraints A*x тЄ b. A has size M-by-N, where M is the number of constraints and N is number of variables
-
b :
-
Linear inequality constraint vector, specified as a vector of doubles. b represents the constant vector in the constraints A*x тЄ b. b has length M, where A is M-by-N
-
Aeq :
-
Linear equality constraint matrix, specified as a matrix of doubles. Aeq represents the linear coefficients in the constraints Aeq*x = beq. Aeq has size Meq-by-N, where Meq is the number of constraints and N is number of variables
-
beq :
-
Linear equality constraint vector, specified as a vector of doubles. beq represents the constant vector in the constraints Aeq*x = beq. beq has length Meq, where Aeq is Meq-by-N.
-
lb :
-
Lower bounds, specified as a vector or array of doubles. lb represents the lower bounds elementwise in lb тЄ x тЄ ub.
-
ub :
-
Upper bounds, specified as a vector or array of doubles. ub represents the upper bounds elementwise in lb тЄ x тЄ ub.
-
options :
-
a 1xq marix of string, provided to set the paramters in symphony
-
xopt :
-
a 1xn matrix of doubles, the computed solution of the optimization problem
-
fopt :
-
a 1x1 matrix of doubles, the function value at x
-
output :
-
The output data structure contains detailed informations about the optimization process.
-
-
Description
-
Search the minimum or maximum of a constrained mixed integer linear programming optimization problem specified by :
-find the minimum or maximum of f(x) such that
-
-
We are calling SYMPHONY written in C by gateway files for the actual computation. SYMPHONY was originally written by тTed Ralphs, тMenal Guzelsoy and тAshutosh Mahajan.
-
-
-
Examples
-
// Objective function
-c=[350*5,330*3,310*4,280*6,500,450,400,100]
-// Lower Bound of variable
-lb=repmat(0,1,8);
-// Upper Bound of variables
-ub=[repmat(1,1,4)repmat(%inf,1,4)];
-// Constraint Matrix
-Aeq=[5,3,4,6,1,1,1,1;
-5*0.05,3*0.04,4*0.05,6*0.03,0.08,0.07,0.06,0.03;
-5*0.03,3*0.03,4*0.04,6*0.04,0.06,0.07,0.08,0.09;]
-beq=[25,1.25,1.25]
-intcon=[1234];
-// Calling Symphony
-[x,f,iter]=symphony_mat(c,intcon,[],[],Aeq,beq,lb,ub);
-
-
Examples
-
// An advanced case where we set some options in symphony
-// This problem is taken from
-// P.C.Chu and J.E.Beasley
-// "A genetic algorithm for the multidimensional knapsack problem",
-// Journal of Heuristics, vol. 4, 1998, pp63-86.
-// The problem to be solved is:
-// Max sum{j=1,...,n} p(j)x(j)
-// st sum{j=1,...,n} r(i,j)x(j) <= b(i) i=1,...,m
-// x(j)=0 or 1
-// The function to be maximize i.e. P(j)
-objCoef=-1*[5048036671103834585811856690832846813868793..
-82510028606155407976166607078666477461006608..
-87790057378848485394263059163064011699321034..
-95779866962546710515527176543885595551104783..
-959668507855986831821825868852832828799686..
-51067157574051067599663682610221140654909799..
-11626538146255994767679549069046498735658531008632]
-//Constraint Matrix
-conMatrix=[//Constraint 1
-424152321581955169193582375367478162898..
-550553298577493183260224852394958282402604..
-16430821861273772191117276877415873902465..
-32087024478186622665155680101665227597354..
-5977916299884913611275173588471449266420..
-797945746464454588272383714987183731301..
-71891109567708507983808766615554282995946651298;
-//Constraint 2
-509883229569706639114727491481681948687941..
-35025357340124384660951739329146593658816..
-638717779289430851937289159260930248656833..
-8926027874129796786249354614836290893857..
-15886920650479975843158078078858364132653..
-252709129368440314287854460594512239719751..
-708670269832137356960651398893407477552805881850;
-//Constraint 3
-806361199781596669957358259888319751275177..
-88374922926528269481977190551140442867283..
-137359445584401924857448449695083357877..
-482732968113486710439747174260877474841422..
-280684330910791322404403519148948414894147..
-732979765138067582973143732624518847113..
-38297905398859414211011213398173106331254447;
-//Constraint 4
-4041978171000443073965946334448599931776..
-263980807378278841700210542636388129203110..
-817502657804662989585645113436610948919115..
-96713445449740592327167368335179909825614..
-98735017941582152577428342727565939273896..
-6898269742124667264973119151498388695846..
-68920641714735267822977302687118990323993525322;
-//Constrain 5
-4753628757745700803654196844657387518143..
-515335942701332803265922908139995845487100..
-44765364973842447542592679547136801904740..
-768460766605009158972571655772696653933..
-4205828108617586472376312719175756409440..
-4833367656379819802023559468960276767693..
-893160785311417748375362617553474915457261350635;
-];
-nbVar=size(objCoef,2)
-conUB=[1192713727115511305613460];
-// Lower Bound of variables
-lb=repmat(0,1,nbVar)
-// Upper Bound of variables
-ub=repmat(1,1,nbVar)
-// Lower Bound of constrains
-intcon=[]
-fori=1:nbVar
-intcon=[intconi];
-end
-// The expected solution :
-// Output variables
-xopt=[0110010101000000010000101101101..
-0000000000010000010000001000011..
-0010010100100101000001100000110010010]
-// Optimal value
-fopt=[24381]
-// Calling Symphony
-[x,f,iter]=symphony_mat(objCoef,intcon,conMatrix,conUB,[],[],lb,ub);
a 1xn matrix of doubles, where n is number of variables, contains coefficients of the variables in the objective
-
intcon :
-
Vector of integer constraints, specified as a vector of positive integers. The values in intcon indicate the components of the decision variable x that are integer-valued. intcon has values from 1 through number of variable
-
A :
-
Linear inequality constraint matrix, specified as a matrix of doubles. A represents the linear coefficients in the constraints A*x тЄ b. A has size M-by-N, where M is the number of constraints and N is number of variables
-
b :
-
Linear inequality constraint vector, specified as a vector of doubles. b represents the constant vector in the constraints A*x тЄ b. b has length M, where A is M-by-N
-
Aeq :
-
Linear equality constraint matrix, specified as a matrix of doubles. Aeq represents the linear coefficients in the constraints Aeq*x = beq. Aeq has size Meq-by-N, where Meq is the number of constraints and N is number of variables
-
beq :
-
Linear equality constraint vector, specified as a vector of doubles. beq represents the constant vector in the constraints Aeq*x = beq. beq has length Meq, where Aeq is Meq-by-N.
-
lb :
-
Lower bounds, specified as a vector or array of doubles. lb represents the lower bounds elementwise in lb тЄ x тЄ ub.
-
ub :
-
Upper bounds, specified as a vector or array of doubles. ub represents the upper bounds elementwise in lb тЄ x тЄ ub.
-
options :
-
a 1xq marix of string, provided to set the paramters in symphony
-
xopt :
-
a 1xn matrix of doubles, the computed solution of the optimization problem
-
fopt :
-
a 1x1 matrix of doubles, the function value at x
-
iter :
-
a 1x1 matrix of doubles, contains the number od iterations done by symphony
-
-
Description
-
Search the minimum or maximum of a constrained mixed integer linear programming optimization problem specified by :
-find the minimum or maximum of f(x) such that
-
-
-
-
Examples
-
// Objective function
-c=[350*5,330*3,310*4,280*6,500,450,400,100]
-// Lower Bound of variable
-lb=repmat(0,1,8);
-// Upper Bound of variables
-ub=[repmat(1,1,4)repmat(%inf,1,4)];
-// Constraint Matrix
-Aeq=[5,3,4,6,1,1,1,1;
-5*0.05,3*0.04,4*0.05,6*0.03,0.08,0.07,0.06,0.03;
-5*0.03,3*0.03,4*0.04,6*0.04,0.06,0.07,0.08,0.09;]
-beq=[25,1.25,1.25]
-intcon=[1234];
-// Calling Symphony
-[x,f,iter]=symphony_mat(c,intcon,[],[],Aeq,beq,lb,ub);
-
-
Examples
-
// An advanced case where we set some options in symphony
-// This problem is taken from
-// P.C.Chu and J.E.Beasley
-// "A genetic algorithm for the multidimensional knapsack problem",
-// Journal of Heuristics, vol. 4, 1998, pp63-86.
-// The problem to be solved is:
-// Max sum{j=1,...,n} p(j)x(j)
-// st sum{j=1,...,n} r(i,j)x(j) <= b(i) i=1,...,m
-// x(j)=0 or 1
-// The function to be maximize i.e. P(j)
-objCoef=-1*[5048036671103834585811856690832846813868793..
-82510028606155407976166607078666477461006608..
-87790057378848485394263059163064011699321034..
-95779866962546710515527176543885595551104783..
-959668507855986831821825868852832828799686..
-51067157574051067599663682610221140654909799..
-11626538146255994767679549069046498735658531008632]
-//Constraint Matrix
-conMatrix=[//Constraint 1
-424152321581955169193582375367478162898..
-550553298577493183260224852394958282402604..
-16430821861273772191117276877415873902465..
-32087024478186622665155680101665227597354..
-5977916299884913611275173588471449266420..
-797945746464454588272383714987183731301..
-71891109567708507983808766615554282995946651298;
-//Constraint 2
-509883229569706639114727491481681948687941..
-35025357340124384660951739329146593658816..
-638717779289430851937289159260930248656833..
-8926027874129796786249354614836290893857..
-15886920650479975843158078078858364132653..
-252709129368440314287854460594512239719751..
-708670269832137356960651398893407477552805881850;
-//Constraint 3
-806361199781596669957358259888319751275177..
-88374922926528269481977190551140442867283..
-137359445584401924857448449695083357877..
-482732968113486710439747174260877474841422..
-280684330910791322404403519148948414894147..
-732979765138067582973143732624518847113..
-38297905398859414211011213398173106331254447;
-//Constraint 4
-4041978171000443073965946334448599931776..
-263980807378278841700210542636388129203110..
-817502657804662989585645113436610948919115..
-96713445449740592327167368335179909825614..
-98735017941582152577428342727565939273896..
-6898269742124667264973119151498388695846..
-68920641714735267822977302687118990323993525322;
-//Constrain 5
-4753628757745700803654196844657387518143..
-515335942701332803265922908139995845487100..
-44765364973842447542592679547136801904740..
-768460766605009158972571655772696653933..
-4205828108617586472376312719175756409440..
-4833367656379819802023559468960276767693..
-893160785311417748375362617553474915457261350635;
-];
-nbVar=size(objCoef,2)
-conUB=[1192713727115511305613460];
-// Lower Bound of variables
-lb=repmat(0,1,nbVar)
-// Upper Bound of variables
-ub=repmat(1,1,nbVar)
-// Lower Bound of constrains
-intcon=[]
-fori=1:nbVar
-intcon=[intconi];
-end
-// The expected solution :
-// Output variables
-xopt=[0110010101000000010000101101101..
-0000000000010000010000001000011..
-0010010100100101000001100000110010010]
-// Optimal value
-fopt=[24381]
-// Calling Symphony
-[x,f,iter]=symphony_mat(objCoef,intcon,conMatrix,conUB,[],[],lb,ub);
a vector of double, contains coefficients of the variables in the objective
-
intcon :
-
Vector of integer constraints, specified as a vector of positive integers. The values in intcon indicate the components of the decision variable x that are integer-valued. intcon has values from 1 through number of variable.
-
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 :
-
Lower bounds, specified as a vector or array of double. lb represents the lower bounds elementwise in lb тЄ x тЄ ub.
-
ub :
-
Upper bounds, specified as a vector or array of double. ub represents the upper bounds elementwise in lb тЄ x тЄ ub.
-
options :
-
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.
-
status :
-
status flag returned from symphony. See below for details.
-
output :
-
The output data structure contains detailed information about the optimization process. See below for details.
-
-
Description
-
Search the minimum or maximum of a constrained mixed integer linear programming optimization problem specified by :
-
-
The routine calls SYMPHONY written in C by gateway files for the actual computation.
-
The status allows to know the status of the optimization which is given back by Ipopt.
-
status=227 : Optimal Solution Found
-
status=228 : Maximum CPU Time exceeded.
-
status=229 : Maximum Number of Node Limit Exceeded.
-
status=230 : Maximum Number of Iterations Limit Exceeded.
-
For more details on status see the symphony documentation, go to http://www.coin-or.org/SYMPHONY/man-5.6/
-
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
-
-
-
Examples
-
// Objective function
-// Reference: Westerberg, Carl-Henrik, Bengt Bjorklund, and Eskil Hultman. "An application of mixed integer programming in a Swedish steel mill." Interfaces 7, no. 2 (1977): 39-43.
-c=[350*5,330*3,310*4,280*6,500,450,400,100]';
-// Lower Bound of variable
-lb=repmat(0,1,8);
-// Upper Bound of variables
-ub=[repmat(1,1,4)repmat(%inf,1,4)];
-// Constraint Matrix
-Aeq=[5,3,4,6,1,1,1,1;
-5*0.05,3*0.04,4*0.05,6*0.03,0.08,0.07,0.06,0.03;
-5*0.03,3*0.03,4*0.04,6*0.04,0.06,0.07,0.08,0.09;]
-beq=[25,1.25,1.25]
-intcon=[1234];
-// Calling Symphony
-[x,f,status,output]=symphonymat(c,intcon,[],[],Aeq,beq,lb,ub)
-// Press ENTER to continue
-
-
Examples
-
// An advanced case where we set some options in symphony
-// This problem is taken from
-// P.C.Chu and J.E.Beasley
-// "A genetic algorithm for the multidimensional knapsack problem",
-// Journal of Heuristics, vol. 4, 1998, pp63-86.
-// The problem to be solved is:
-// Max sum{j=1,...,n} p(j)x(j)
-// st sum{j=1,...,n} r(i,j)x(j) <= b(i) i=1,...,m
-// x(j)=0 or 1
-// The function to be maximize i.e. P(j)
-c=-1*[5048036671103834585811856690832846813868793..
-82510028606155407976166607078666477461006608..
-87790057378848485394263059163064011699321034..
-95779866962546710515527176543885595551104783..
-959668507855986831821825868852832828799686..
-51067157574051067599663682610221140654909799..
-11626538146255994767679549069046498735658531008632]';
-//Constraint Matrix
-A=[//Constraint 1
-424152321581955169193582375367478162898..
-550553298577493183260224852394958282402604..
-16430821861273772191117276877415873902465..
-32087024478186622665155680101665227597354..
-5977916299884913611275173588471449266420..
-797945746464454588272383714987183731301..
-71891109567708507983808766615554282995946651298;
-//Constraint 2
-509883229569706639114727491481681948687941..
-35025357340124384660951739329146593658816..
-638717779289430851937289159260930248656833..
-8926027874129796786249354614836290893857..
-15886920650479975843158078078858364132653..
-252709129368440314287854460594512239719751..
-708670269832137356960651398893407477552805881850;
-//Constraint 3
-806361199781596669957358259888319751275177..
-88374922926528269481977190551140442867283..
-137359445584401924857448449695083357877..
-482732968113486710439747174260877474841422..
-280684330910791322404403519148948414894147..
-732979765138067582973143732624518847113..
-38297905398859414211011213398173106331254447;
-//Constraint 4
-4041978171000443073965946334448599931776..
-263980807378278841700210542636388129203110..
-817502657804662989585645113436610948919115..
-96713445449740592327167368335179909825614..
-98735017941582152577428342727565939273896..
-6898269742124667264973119151498388695846..
-68920641714735267822977302687118990323993525322;
-//Constrain 5
-4753628757745700803654196844657387518143..
-515335942701332803265922908139995845487100..
-44765364973842447542592679547136801904740..
-768460766605009158972571655772696653933..
-4205828108617586472376312719175756409440..
-4833367656379819802023559468960276767693..
-893160785311417748375362617553474915457261350635;
-];
-nbVar=size(c,1)
-b=[1192713727115511305613460];
-// Lower Bound of variables
-lb=repmat(0,1,nbVar)
-// Upper Bound of variables
-ub=repmat(1,1,nbVar)
-// Lower Bound of constrains
-intcon=[];
-fori=1:nbVar
-intcon=[intconi];
-end
-options=list("time_limit",25);
-// The expected solution :
-// Output variables
-xopt=[0110010101000000010000101101101..
-0000000000010000010000001000011..
-0010010100100101000001100000110010010]
-// Optimal value
-fopt=[24381]
-// Calling Symphony
-[x,f,status,output]=symphonymat(c,intcon,A,b,[],[],lb,ub,options);