matlab多目标优化模型教程
如何使用Matlab进行最优化和多目标优化问题求解

如何使用Matlab进行最优化和多目标优化问题求解Matlab是一种强大的数学计算工具,广泛应用于各个领域的科学研究和工程实践中。
其中,最优化和多目标优化问题的求解是Matlab的一项重要功能。
本文将介绍如何使用Matlab进行最优化和多目标优化问题的求解,并提供一些实际应用案例。
一、最优化问题求解最优化问题求解是指在给定的约束条件下,寻找一个使得目标函数取得最大(或最小)值的变量组合。
Matlab提供了多种最优化算法,如线性规划、二次规划、非线性规划等。
下面以非线性规划为例,介绍如何使用Matlab进行最优化问题的求解。
1. 准备工作在使用Matlab进行最优化问题求解之前,需要先定义目标函数和约束条件。
目标函数是最优化问题的核心,可以是线性的或非线性的。
约束条件可以是等式约束或不等式约束。
同时,还需要确定变量的取值范围和初值。
2. 选择合适的算法Matlab提供了多个最优化算法,根据问题的特点选择合适的算法是非常重要的。
常用的算法有fmincon、fminunc、fminsearch等。
例如,fmincon函数适用于求解具有约束条件的非线性规划问题,而fminunc函数适用于求解无约束或有约束的非线性规划问题。
3. 调用相应的函数根据选择的算法,调用相应的函数进行求解。
以fmincon函数为例,其调用方式为:```[x, fval] = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)```其中,fun为目标函数,x0为变量的初值,A、b为不等式约束矩阵和向量,Aeq、beq为等式约束矩阵和向量,lb、ub为变量的下界和上界,nonlcon为非线性约束函数,options为求解选项。
4. 解析结果求解完成后,可以通过解析结果来评估求解器的性能。
Matlab提供了fval和exitflag两个输出参数,其中fval表示最优解的目标函数值,exitflag表示求解器的退出标志。
如何在Matlab中进行多目标优化问题求解

如何在Matlab中进行多目标优化问题求解如何在Matlab中进行多目标优化问题求解?多目标优化问题是指存在多个目标函数,且这些目标函数之间相互矛盾或者无法完全同时满足的问题。
在实际应用中,多目标优化问题非常常见,例如在工程设计中寻求最佳平衡点、在金融投资中追求高收益低风险等。
而Matlab作为一种强大的数值计算工具,提供了丰富的优化算法和工具箱,可以帮助我们解决多目标优化问题。
一、多目标优化问题数学建模在解决多目标优化问题之前,首先需要将实际问题转化为数学模型。
假设我们需要优化一个n维的向量x,使得目标函数f(x)同时最小化或最大化。
其中,n为自变量的个数,f(x)可以表示为多个目标函数f1(x)、f2(x)、...、fm(x)的向量形式:f(x) = [f1(x), f2(x), ..., fm(x)]其中,fi(x)(i=1,2,...,m)即为待优化的目标函数。
在多目标优化问题中,一般没有单一的最优解,而是存在一个解集,称为"帕累托前沿(Pareto Frontier)"。
该解集中的每个解被称为"非支配解(Non-Dominated Solution)",即不能被其他解所优化。
因此,多目标优化问题的目标就是找到帕累托前沿中的最佳解。
二、Matlab中的多目标优化算法Matlab提供了多种多目标优化算法和工具箱,包括paretosearch、gamultiobj、NSGA-II等等。
这些算法基于不同的思想和原理,可以根据问题的特点选择合适的算法进行求解。
1. paretosearch算法paretosearch算法采用遗传算法的思想,通过迭代更新种群来寻找非支配解。
该算法适用于求解中小规模的多目标优化问题。
使用paretosearch算法求解多目标优化问题可以按照以下步骤进行:(1)定义目标函数编写目标函数fi(x)(i=1,2,...,m)的代码。
gurobi多目标问题matlab

Gurobi多目标问题在Matlab中的解决一、Gurobi简介Gurobi是一款强大的商业数学建模工具,广泛应用于优化领域。
它提供了多种优化算法,能够高效地解决线性规划、整数规划、二次规划等各种优化问题。
在实际工程和科学研究中,经常遇到多目标优化问题,即需要同时优化多个目标函数。
本文将介绍如何使用Gurobi在Matlab中解决多目标优化问题。
二、多目标优化问题的定义在多目标优化问题中,我们需要最小化或最大化多个目标函数,而且这些目标函数之间往往存在相互矛盾的关系。
在生产计划中,一个目标函数可能是最大化产量,另一个目标函数可能是最小化成本。
在实际应用中,我们需要找到一组可行的解,使得所有目标函数都达到一个较好的平衡。
三、Gurobi在Matlab中的调用在Matlab中调用Gurobi需要先安装Gurobi的Matlab接口。
安装完成后,我们可以在Matlab命令窗口中输入命令"gurobi"来验证是否成功安装。
接下来,我们需要在Matlab中编写代码,定义优化问题的目标函数、约束条件和变量类型。
在定义目标函数时,我们需要考虑多个目标函数之间的相关性,以及它们之间的权重关系。
在定义约束条件和变量类型时,我们需要考虑多目标函数之间可能存在的约束条件和变量之间的相互制约关系。
四、多目标优化问题的解决方法Gurobi提供了多种解决多目标优化问题的方法,包括加权法、约束法和Pareto最优解法等。
在加权法中,我们将多个目标函数进行线性组合,并引入权重因子来平衡各个目标函数之间的重要性。
在约束法中,我们将多个目标函数作为多个约束条件,通过逐步添加约束条件来找到最优解。
在Pareto最优解法中,我们寻找一组可行解,使得没有其他可行解能比它在所有目标函数上都更好。
五、案例分析以生产计划为例,假设我们需要同时考虑最大化产量和最小化成本两个目标。
我们可以先使用加权法,通过调整权重因子来平衡这两个目标的重要性,找到一个较好的解。
使用Matlab进行多目标优化和约束优化

使用Matlab进行多目标优化和约束优化引言:多目标优化和约束优化是现代科学和工程领域中的重要问题。
在很多实际应用中,我们常常面对的是多个目标参数之间存在冲突的情况,同时还需要满足一定的约束条件。
这就需要我们采用适当的方法和工具进行多目标优化和约束优化。
本文将介绍如何使用Matlab进行多目标优化和约束优化。
一、多目标优化多目标优化是指在优化问题中存在多个目标函数,我们的目标是同时优化这些目标函数。
在Matlab中,可以使用多种方法进行多目标优化,其中常用的方法包括遗传算法、粒子群算法和模拟退火等。
1.1 遗传算法遗传算法是一种模拟生物进化过程的优化算法。
它模拟了遗传的过程,通过交叉、变异和选择等操作,利用群体中不断进化的个体来搜索最优解。
在多目标优化中,遗传算法常用于生成一组非支配解,即没有解能同时优于其他解的情况。
Matlab中提供了相关的工具箱,如Global Optimization Toolbox和Multiobjective Optimization Toolbox,可以方便地进行多目标优化。
1.2 粒子群算法粒子群算法是一种基于群体行为的优化算法。
它通过模拟鸟群或鱼群等群体的行为,寻找最优解。
在多目标优化中,粒子群算法也可以生成一组非支配解。
Matlab中的Particle Swarm Optimization Toolbox提供了相关函数和工具,可以实现多目标优化。
1.3 模拟退火模拟退火是一种模拟金属冶炼过程的优化算法。
它通过模拟金属在高温下退火的过程,通过温度控制来逃离局部最优解,最终达到全局最优解。
在多目标优化中,模拟退火算法可以通过调整温度参数来生成一组非支配解。
Matlab中也提供了相关的函数和工具,可以进行多目标优化。
二、约束优化约束优化是指在优化问题中存在一定的约束条件,我们的目标是在满足这些约束条件的前提下,使目标函数达到最优。
在Matlab中,也有多种方法可以进行约束优化,其中常用的方法包括罚函数法、惩罚函数法和内点法等。
如何在MATLAB中进行多目标优化

如何在MATLAB中进行多目标优化多目标优化问题是指在存在多个冲突目标的情况下,求解一个能够同时最小化或最大化多个目标函数的问题。
在实际应用中,多目标优化问题被广泛应用于工程优化、金融投资、交通规划等领域。
在MATLAB中,有多种方法可以用来解决多目标优化问题,本文将介绍其中的几种常用方法。
一、多目标优化问题的定义在开始使用MATLAB进行多目标优化之前,首先需要明确多目标优化问题的数学定义。
一般而言,多目标优化问题可以表示为:```minimize f(x) = [f1(x), f2(x), ..., fm(x)]subject to g(x) ≤ 0, h(x) = 0lb ≤ x ≤ ub```其中,f(x)为多个目标函数,g(x)和h(x)为约束条件,lb和ub分别为决策变量的下界和上界。
问题的目标是找到一组决策变量x,使得目标函数f(x)取得最小值。
二、多目标优化问题的解法在MATLAB中,有多种方法可以用来解决多目标优化问题。
下面将介绍其中的几种常见方法。
1. 非支配排序遗传算法(Non-dominated Sorting Genetic Algorithm,NSGA)NSGA是一种经典的多目标优化算法,它将候选解集划分为多个等级或层次,从而使得每个解在候选解集内具备非劣势性。
在MATLAB中,可以使用多目标遗传算法工具箱(Multi-Objective Optimization Toolbox)中的`gamultiobj`函数来实现NSGA算法。
该函数可以通过指定目标函数、约束条件和决策变量范围等参数来求解多目标优化问题。
2. 多目标粒子群优化算法(Multi-objective Particle Swarm Optimization,MOPSO)MOPSO是一种基于群体智能的多目标优化算法,它模拟了粒子的行为,通过不断迭代寻找最优解。
在MATLAB中,可以使用多目标粒子群优化工具箱(Multi-Objective Particle Swarm Optimization Toolbox)中的`mopso`函数来实现MOPSO算法。
如何使用Matlab进行多目标优化

如何使用Matlab进行多目标优化使用Matlab进行多目标优化概述:多目标优化是在现实问题中常见的一种优化方法,即需要优化多个目标函数,而非只有一个目标函数。
这篇文章将介绍如何使用Matlab进行多目标优化,包括问题建模、求解方法和实例分析。
1. 问题建模在进行多目标优化之前,需要将实际问题建模为数学模型。
首先,明确问题的决策变量和目标函数。
决策变量是需要优化的参数或变量,而目标函数是需要最小化或最大化的指标。
例如,我们要优化一个生产系统的成本和产量,可以将成本设为一个目标函数,产量设为另一个目标函数。
2. 目标权重设定由于多目标优化存在矛盾或折衷的情况,需要设定目标函数的权重。
权重反映了各个目标函数的重要性,较高的权重意味着对应的目标更重要。
例如,在上述生产系统的例子中,如果成本比产量更重要,可以给成本赋予较高的权重。
3. 多目标优化求解方法Matlab提供了多种多目标优化求解方法,常用的有基于进化算法的优化方法,例如遗传算法、粒子群优化算法等。
这些方法通过不断迭代搜索解空间,逐步找到最优解。
以下是使用Matlab进行多目标优化的一般步骤:a) 定义优化问题的问题函数,包括目标函数和约束条件。
b) 设定优化问题的求解选项,例如优化算法、迭代次数和收敛准则等。
c) 运行优化求解器,获得最优解或近似最优解。
d) 对求解结果进行分析和评价。
4. 多目标优化实例分析为了更好地理解如何使用Matlab进行多目标优化,我们以一个简单的例子进行分析。
假设有一个三维空间内的旅行商问题,即找到一条路径,使得旅行距离最短、花费最少以及时间最短。
我们可以将问题建模为一个三目标优化问题:目标一:最小化旅行距离。
目标二:最小化旅行花费。
目标三:最小化旅行时间。
通过定义目标函数和约束条件,我们可以使用Matlab的多目标优化求解器,如gamultiobj函数,来获得近似最优解。
在求解过程中,可以通过设置收敛准则、种群大小等选项来调节求解参数。
在Matlab中使用多目标优化进行多准则决策制定

在Matlab中使用多目标优化进行多准则决策制定随着社会的发展和科学技术的进步,人们在决策过程中需要考虑的因素越来越多,往往会涉及到多个准则。
面对这种情况,我们可以利用多目标优化算法来帮助决策者做出最佳的选择。
本文将介绍如何在Matlab中使用多目标优化进行多准则决策制定。
一个多准则决策问题通常涉及到多个决策变量和多个目标函数。
其中,决策变量是指需要决策者选择的决策因素,而目标函数是评价决策的准则。
多目标优化的目标是找到一组最优解,使得所有目标函数的值都能够达到最优。
在Matlab中,使用多目标优化算法进行多准则决策制定非常方便。
首先,我们需要定义决策变量和目标函数。
决策变量可以是连续的、离散的或者混合的。
而目标函数可以是线性的、非线性的、单目标的或者多目标的。
接下来,我们需要选择适合的多目标优化算法。
Matlab提供了多种多目标优化算法,包括非支配排序遗传算法(NSGA)、多目标遗传算法(MOGA)等。
根据具体情况选择合适的算法。
然后,我们需要定义问题的约束条件。
约束条件是指决策变量在决策空间中的限制条件。
约束条件可以是等式约束或者不等式约束。
在定义约束条件时,我们需要确保解空间的可行性。
在完成上述步骤后,我们可以使用Matlab中的优化函数进行多目标优化。
常用的优化函数有fmincon、gamultiobj等。
这些函数可以根据定义的决策变量、目标函数和约束条件,自动寻找最佳解集。
在进行多目标优化时,我们需要考虑目标之间的权重关系。
权重反映了各目标函数之间的重要性。
在Matlab中,可以通过设定权重向量来定义目标的优先级。
权重向量的选择需要根据具体情况来确定,可以根据专家知识或者利用模糊层次分析法等方法。
最后,我们需要根据优化结果进行决策制定。
在多目标优化中,我们通常得到一个解集,而不是单个最优解。
解集中的每个解都是一种最优解,并且在不同的权重下具有不同的优势。
决策者可以根据自己的需求和权衡来选择最终的决策。
Matlab中的多目标优化算法实现指南

Matlab中的多目标优化算法实现指南简介:多目标优化是在现实问题中常见的一种情况,例如在工程设计、金融投资和决策支持等领域。
Matlab作为一种强大的数值计算和工程仿真软件,提供了多种多目标优化算法的工具箱,如NSGA-II、MOGA等。
本文将介绍如何使用Matlab实现多目标优化算法,并给出一些应用示例。
一、多目标优化问题多目标优化问题是指在存在多个冲突的目标函数的情况下,找到一组最优解,使得这些目标函数能够达到最优。
在现实问题中,通常会涉及到多个目标,例如在工程设计中同时考虑成本和性能,或者在金融投资中同时考虑风险和收益等。
二、Matlab的多目标优化工具箱Matlab提供了多种多目标优化算法的工具箱,如Global Optimization Toolbox、Optimization Toolbox等。
这些工具箱可以帮助用户快速实现多目标优化算法,并且提供了丰富的优化函数和评价指标。
三、NSGA-II算法实现NSGA-II(Non-dominated Sorting Genetic Algorithm II)是一种常用的多目标优化算法,它通过遗传算法的方式来搜索最优解。
在Matlab中,我们可以使用NSGA-II工具箱来实现该算法。
1. 确定目标函数首先,我们需要确定待优化的问题中具体的目标函数,例如最小化成本和最大化性能等。
在Matlab中,我们可以使用函数句柄来定义这些目标函数。
2. 设定决策变量决策变量是影响目标函数的参数,我们需要确定这些变量的取值范围。
在Matlab中,可以使用函数句柄或者向量来定义这些变量。
3. 设定其他参数除了目标函数和决策变量,NSGA-II算法还需要其他一些参数,例如种群大小、迭代次数等。
在Matlab中,我们可以使用结构体来存储这些参数。
4. 运行算法将目标函数、决策变量和其他参数传递给NSGA-II工具箱,然后运行算法。
Matlab会自动进行优化计算,并给出一组最优解。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
fgoalattainSolve multiobjective goal attainment problemsEquationFinds the minimum of a problem specified byx, weight, goal, b, beq, lb, and ub are vectors, A and Aeq are matrices, and c(x), ceq(x), and F(x) are functions that return vectors. F(x), c(x), and ceq(x) can be nonlinear functions.Syntaxx = fgoalattain(fun,x0,goal,weight)x = fgoalattain(fun,x0,goal,weight,A,b)x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq)x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub)x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon)x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon,... options)x = fgoalattain(problem)[x,fval] = fgoalattain(...)[x,fval,attainfactor] = fgoalattain(...)[x,fval,attainfactor,exitflag] = fgoalattain(...)[x,fval,attainfactor,exitflag,output] = fgoalattain(...)[x,fval,attainfactor,exitflag,output,lambda] = fgoalattain(...)Descriptionfgoalattain solves the goal attainment problem, which is one formulation for minimizing a multiobjective optimization problem.x = fgoalattain(fun,x0,goal,weight) tries to make the objective functions supplied by fun attain the goals specified by goal by varying x, starting at x0, with weight specified by weight.x = fgoalattain(fun,x0,goal,weight,A,b) solves the goal attainment problem subject to the linear inequalities A*x ≤ b.x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq) solves the goal attainment problem subject to the linear equalities Aeq*x = beq as well. Set A = [] and b = [] if no inequalities exist.x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub) defines a set of lower and upper bounds on the design variables in x, so that the solution is always in the range lb ≤ x ≤ ub.x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon) subjects the goal attainment problem to the nonlinear inequalities c(x) or nonlinear equality constraints ceq(x) defined in nonlcon. fgoalattain optimizes such that c(x) ≤ 0 and ceq(x) = 0. Set lb = [] and/or ub = [] if no bounds exist.x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon,... options) minimizes with the optimization options specified in the structure options. Use optimset to set these options.x = fgoalattain(problem) finds the minimum for problem, where problem is a structure described in Input Arguments.Create the structure problem by exporting a problem from Optimization Tool, as described in Exporting to the MATLAB Workspace.[x,fval] = fgoalattain(...) returns the values of the objective functions computed in fun at the solution x.[x,fval,attainfactor] = fgoalattain(...) returns the attainment factor at the solution x.[x,fval,attainfactor,exitflag] = fgoalattain(...) returns a value exitflag that describes the exit condition of fgoalattain.[x,fval,attainfactor,exitflag,output] = fgoalattain(...) returns a structure output that contains information about the optimization.[x,fval,attainfactor,exitflag,output,lambda] = fgoalattain(...) returns a structure lambda whose fields contain the Lagrange multipliers at the solution x.Input ArgumentsFunction Arguments contains general descriptions of arguments passed into fgoalattain. This section provides function-specific details for fun, goal, nonlcon, options, weight, and problem:fun The function to be minimized. fun is a function that acceptsa vector x and returns a vector F, the objective functionsevaluated at x. The function fun can be specified as a functionhandle for a function file:x = fgoalattain(@myfun,x0,goal,weight)where myfun is a MATLAB function such asfunction F = myfun(x)F = ... % Compute function values at x.fun can also be a function handle for an anonymous function.x = fgoalattain(@(x)sin(x.*x),x0,goal,weight);If the user-defined values for x and F are matrices, they areconverted to a vector using linear indexing.To make an objective function as near as possible to a goalvalue, (i.e., neither greater than nor less than) use optimsetto set the GoalsExactAchieve option to the number of objectivesrequired to be in the neighborhood of the goal values. Suchobjectives must be partitioned into the first elements of thevector F returned by fun.If the gradient of the objective function can also be computedand the GradObj option is 'on', as set byoptions = optimset('GradObj','on')then the function fun must return, in the second outputargument, the gradient value G, a matrix, at x. The gradientconsists of the partial derivative dF/dx of each F at the pointx. If F is a vector of length m and x has length n, where n isthe length of x0, then the gradient G of F(x) is an n-by-m matrixwhere G(i,j) is the partial derivative of F(j) with respect tox(i) (i.e., the jth column of G is the gradient of the jthobjective function F(j)).goal Vector of values that the objectives attempt to attain. The vector is the same length as the number of objectives F returnedby fun. fgoalattain attempts to minimize the values in thevector F to attain the goal values given by goal.nonlcon The function that computes the nonlinear inequality constraints c(x) ≤ 0 and the nonlinear equality constraintsceq(x) = 0. The function nonlcon accepts a vector x and returnstwo vectors c and ceq. The vector c contains the nonlinearinequalities evaluated at x, and ceq contains the nonlinearequalities evaluated at x. The function nonlcon can bespecified as a function handle.x = fgoalattain(@myfun,x0,goal,weight,A,b,Aeq,beq,...lb,ub,@mycon)where mycon is a MATLAB function such asfunction [c,ceq] = mycon(x)c = ... % compute nonlinear inequalities at x.ceq = ... % compute nonlinear equalities at x.If the gradients of the constraints can also be computed andthe GradConstr option is 'on', as set byoptions = optimset('GradConstr','on')then the function nonlcon must also return, in the third andfourth output arguments, GC, the gradient of c(x), and GCeq,the gradient of ceq(x). Nonlinear Constraints explains how to"conditionalize" the gradients for use in solvers that do notaccept supplied gradients.If nonlcon returns a vector c of m components and x has lengthn, where n is the length of x0, then the gradient GC of c(x)is an n-by-m matrix, where GC(i,j) is the partial derivativeof c(j) with respect to x(i) (i.e., the jth column of GC is thegradient of the jth inequality constraint c(j)). Likewise, ifceq has p components, the gradient GCeq of ceq(x) is an n-by-pmatrix, where GCeq(i,j) is the partial derivative of ceq(j)with respect to x(i) (i.e., the jth column of GCeq is thegradient of the jth equality constraint ceq(j)).Passing Extra Parameters explains how to parameterize thenonlinear constraint function nonlcon, if necessary.options Options provides the function-specific details for the options values.weight A weighting vector to control the relative underattainment or overattainment of the objectives in fgoalattain. When thevalues of goal are all nonzero, to ensure the same percentageof under- or overattainment of the active objectives, set theweighting function to abs(goal). (The active objectives are theset of objectives that are barriers to further improvement ofthe goals at the solution.)When the weighting function weight is positive, fgoalattainattempts to make the objectives less than the goal values. Tomake the objective functions greater than the goal values, setweight to be negative rather than positive. To make an objectivefunction as near as possible to a goal value, use theGoalsExactAchieve option and put that objective as the firstelement of the vector returned by fun (see the precedingdescription of fun and options).problem objective Vector of objective functionsx0 Initial point for xgoal Goals to attainweight Relative importance factors of goalsAineq Matrix for linear inequality constraintsbineq Vector for linear inequality constraintsAeq Matrix for linear equality constraintsbeq Vector for linear equality constraintslb Vector of lower boundsub Vector of upper boundsnonlcon Nonlinear constraint functionsolver 'fgoalattain'options Options structure created with optimset Output ArgumentsFunction Arguments contains general descriptions of arguments returned by fgoalattain. This section provides function-specific details for attainfactor, exitflag, lambda, and output:attainfactor The amount of over- or underachievement of the goals. If attainfactor is negative, the goals have been overachieved;if attainfactor is positive, the goals have beenunderachieved.attainfactor contains the value of γ at the solution. Anegative value of γindicates overattainment in the goals.exitflag Integer identifying the reason the algorithm terminated.The following lists the values of exitflag and thecorresponding reasons the algorithm terminated.1 Function converged to a solutions x.4 Magnitude of the search direction lessthan the specified tolerance andconstraint violation less thanoptions.TolCon5 Magnitude of directional derivative lessthan the specified tolerance andconstraint violation less thanoptions.TolCon0 Number of iterations exceededoptions.MaxIter or number of functionevaluations exceeded options.FunEvals-1 Algorithm was terminated by the outputfunction.-2 No feasible point was found.lambda Structure containing the Lagrange multipliers at the solution x (separated by constraint type). The fields of thestructure arelower Lower bounds lbupper Upper bounds ubineqlin Linear inequalitieseqlin Linear equalitiesineqnonlin Nonlinear inequalitieseqnonlin Nonlinear equalitiesoutput Structure containing information about the optimization.The fields of the structure areiterations Number of iterations takenfuncCount Number of function evaluationslssteplength Size of line search step relative tosearch directionstepsize Final displacement in xalgorithm Optimization algorithm usedfirstorderopt Measure of first-order optimalityconstrviolation Maximum of constraint functionsmessage Exit messageOptionsOptimization options used by fgoalattain. You can use optimset to set or change the values of these fields in the options structure options. See Optimization Options for detailed information.DerivativeCheck Compare user-supplied derivatives (gradients ofobjective or constraints) to finite-differencingderivatives. The choices are 'on' or the default,'off'.Diagnostics Display diagnostic information about the functionto be minimized or solved. The choices are 'on' orthe default, 'off'.DiffMaxChange Maximum change in variables for finite-differencegradients (a positive scalar). The default is 0.1.DiffMinChange Minimum change in variables for finite-differencegradients (a positive scalar). The default is 1e-8. Display Level of display.∙'off' displays no output.∙'iter' displays output at each iteration, andgives the default exit message.∙'iter-detailed' displays output at eachiteration, and gives the technical exitmessage.∙'notify' displays output only if the functiondoes not converge, and gives the default exitmessage.∙'notify-detailed' displays output only if thefunction does not converge, and gives thetechnical exit message.∙'final' (default) displays just the finaloutput, and gives the default exit message.∙'final-detailed' displays just the finaloutput, and gives the technical exit message.FinDiffType Finite differences, used to estimate gradients, areeither 'forward' (default), or 'central'(centered). 'central' takes twice as many functionevaluations, but should be more accurate.The algorithm is careful to obey bounds whenestimating both types of finite differences. So, forexample, it could take a backward, rather than aforward, difference to avoid evaluating at a pointoutside bounds.FunValCheck Check whether objective function and constraintsvalues are valid. 'on' displays an error when theobjective function or constraints return a valuethat is complex, Inf, or NaN. The default, 'off',displays no error.GoalsExactAchieve Specifies the number of objectives for which it isrequired for the objective fun to equal the goal goal(a nonnegative integer). Such objectives should bepartitioned into the first few elements of F. Thedefault is 0.GradConstr Gradient for nonlinear constraint functions definedby the user. When set to 'on', fgoalattain expectsthe constraint function to have four outputs, asdescribed in nonlcon in the Input Arguments section.When set to the default, 'off', gradients of thenonlinear constraints are estimated by finitedifferences.GradObj Gradient for the objective function defined by theuser. See the preceding description of fun to seehow to define the gradient in fun. Set to 'on' tohave fgoalattain use a user-defined gradient of theobjective function. The default, 'off',causesfgoalattain to estimate gradients usingfinite differences.MaxFunEvals Maximum number of function evaluations allowed (apositive integer). The default is100*numberOfVariables.MaxIter Maximum number of iterations allowed (a positiveinteger). The default is 400.MaxSQPIter Maximum number of SQP iterations allowed (a positiveinteger). The default is 10*max(numberOfVariables,numberOfInequalities + numberOfBounds)MeritFunction Use goal attainment/minimax merit function if setto 'multiobj', the default. Use fmincon meritfunction if set to 'singleobj'.OutputFcn Specify one or more user-defined functions that anoptimization function calls at each iteration,either as a function handle or as a cell array offunction handles. The default is none ([]). SeeOutput Function.PlotFcns Plots various measures of progress while thealgorithm executes, select from predefined plots orwrite your own. Pass a function handle or a cellarray of function handles. The default is none ([]).∙@optimplotx plots the current point∙@optimplotfunccount plots the function count∙@optimplotfval plots the function value∙@optimplotconstrviolation plots the maximumconstraint violation∙@optimplotstepsize plots the step sizeFor information on writing a custom plot function,see Plot Functions.RelLineSrchBnd Relative bound (a real nonnegative scalar value) onthe line search step length such that the totaldisplacement in x satisfies|Δx(i)| ≤relLineSrchBnd· max(|x(i)|,|typicalx(i)|). This option provides control over themagnitude of the displacements in x for cases inwhich the solver takes steps that are considered toolarge. The default is none ([]).RelLineSrchBndDurat ion Number of iterations for which the bound specified in RelLineSrchBnd should be active (default is 1).TolCon Termination tolerance on the constraint violation,a positive scalar. The default is 1e-6.TolConSQP Termination tolerance on inner iteration SQPconstraint violation, a positive scalar. Thedefault is 1e-6.TolFun Termination tolerance on the function value, apositive scalar. The default is 1e-6.TolX Termination tolerance on x, a positive scalar. Thedefault is 1e-6.TypicalX Typical x values. The number of elements in TypicalXis equal to the number of elements in x0, thestarting point. The default value isones(numberofvariables,1). fgoalattain usesTypicalX for scaling finite differences forgradient estimation.UseParallel When 'always', estimate gradients in parallel.Disable by setting to the default, 'never'. ExamplesConsider a linear system of differential equations.An output feedback controller, K, is designed producing a closed loop systemThe eigenvalues of the closed loop system are determined from the matrices A, B, C, and K using the command eig(A+B*K*C). Closed loop eigenvalues must lie on the real axis in the complex plane to the left of the points [-5,-3,-1]. In order not to saturate the inputs, no element in K can be greater than 4 or be less than -4.The system is a two-input, two-output, open loop, unstable system, with state-space matrices.The set of goal values for the closed loop eigenvalues is initialized as goal = [-5,-3,-1];To ensure the same percentage of under- or overattainment in the active objectives at the solution, the weighting matrix, weight, is set to abs(goal).Starting with a controller, K = [-1,-1; -1,-1], first write a function file, eigfun.m.function F = eigfun(K,A,B,C)F = sort(eig(A+B*K*C)); % Evaluate objectivesNext, enter system matrices and invoke an optimization routine.A = [-0.5 0 0; 0 -2 10; 0 1 -2];B = [1 0; -2 2; 0 1];C = [1 0 0; 0 0 1];K0 = [-1 -1; -1 -1]; % Initialize controller matrixgoal = [-5 -3 -1]; % Set goal values for the eigenvalues weight = abs(goal); % Set weight for same percentagelb = -4*ones(size(K0)); % Set lower bounds on the controllerub = 4*ones(size(K0)); % Set upper bounds on the controller options = optimset('Display','iter'); % Set display parameter[K,fval,attainfactor] = fgoalattain(@(K)eigfun(K,A,B,C),...K0,goal,weight,[],[],[],[],lb,ub,[],options)You can run this example by using the demonstration script goaldemo. (From the MATLAB Help browser or the MathWorks™ Web site documentation, you can click the demo name to display the demo.) After about 11 iterations, a solution isActive inequalities (to within options.TolCon = 1e-006):lower upper ineqlinineqnonlin1 12 24K =-4.0000 -0.2564-4.0000 -4.0000fval =-6.9313-4.1588-1.4099attainfactor =-0.3863DiscussionThe attainment factor indicates that each of the objectives has been overachieved by at least 38.63% over the original design goals. The active constraints, in this case constraints 1 and 2, are the objectives that are barriers to further improvement and for which the percentage of overattainment is met exactly. Three of the lower bound constraints are also active.In the preceding design, the optimizer tries to make the objectives less than the goals. For a worst-case problem where the objectives must be as near to the goals as possible, use optimset to set the GoalsExactAchieve option to the number of objectives for which this is required.Consider the preceding problem when you want all the eigenvalues to be equal to the goal values. A solution to this problem is found by invoking fgoalattain with the GoalsExactAchieve option set to 3.options = optimset('GoalsExactAchieve',3);[K,fval,attainfactor] = fgoalattain(...@(K)eigfun(K,A,B,C),K0,goal,weight,[],[],[],[],lb,ub,[],... options)After about seven iterations, a solution isK =-1.5954 1.2040-0.4201 -2.9046fval =-5.0000-3.0000-1.0000attainfactor =1.0859e-20In this case the optimizer has tried to match the objectives to the goals. The attainment factor (of 1.0859e-20) indicates that the goals have been matched almost exactly.NotesThis problem has discontinuities when the eigenvalues become complex; this explains why the convergence is slow. Although the underlying methods assume the functions are continuous, the method is able to make stepstoward the solution because the discontinuities do not occur at the solution point. When the objectives and goals are complex, fgoalattain tries to achieve the goals in a least-squares sense.AlgorithmMultiobjective optimization concerns the minimization of a set of objectives simultaneously. One formulation for this problem, and implemented in fgoalattain, is the goal attainment problem of Gembicki[3]. This entails the construction of a set of goal values for the objective functions. Multiobjective optimization is discussed in Multiobjective Optimization.In this implementation, the slack variable γis used as a dummy argument to minimize the vector of objectives F(x) simultaneously; goal is a set of values that the objectives attain. Generally, prior to the optimization, it is not known whether the objectives will reach the goals (under attainment) or be minimized less than the goals (overattainment). A weighting vector, weight, controls the relative underattainment or overattainment of the objectives.fgoalattain uses a sequential quadratic programming (SQP) method, which is described in Sequential Quadratic Programming (SQP). Modifications are made to the line search and Hessian. In the line search an exact merit function (see [1] and [4]) is used together with the merit function proposed by [5]and [6]. The line search is terminated when either merit function shows improvement. A modified Hessian, which takes advantage of the special structure of the problem, is also used (see [1] and [4]). A full description of the modifications used is found in Goal Attainment Method in "Introduction to Algorithms." Setting the MeritFunction option to 'singleobj' withoptions = optimset(options,'MeritFunction','singleobj')uses the merit function and Hessian used in fmincon.See also SQP Implementation for more details on the algorithm used and the types of procedures displayed under the Procedures heading when the Display option is set to 'iter'.LimitationsThe objectives must be continuous. fgoalattain might give only local solutions.。