Main Content

이 번역 페이지는 최신 내용을 담고 있지 않습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.

optimoptions

최적화 옵션 만들기

설명

예제

options= optimoptions(SolverName)SolverName솔버에 대한 디폴트 옵션 집합을 반환합니다.

예제

options= optimoptions(SolverName,Name,Value)는하나이상의이름——값쌍의인수를사용하여설정한지정된파라미터를가진options를 반환합니다.

예제

options= optimoptions(oldoptions,Name,Value)는 명명된 파라미터가 지정된 값으로 변경된oldoptions의 복사본을 반환합니다.

예제

options= optimoptions(SolverName,oldoptions)SolverName솔버의 디폴트 옵션을 반환하고oldoptions의 해당 옵션을options로 복사합니다.

예제

options= optimoptions(prob)prob최적화 문제 또는 방정식 문제에 대한 디폴트 옵션 집합을 반환합니다.

options= optimoptions(prob,Name,Value)는하나이상의이름——값쌍의인수를사용하여설정한지정된파라미터를가진 options를 반환합니다.

예제

모두 축소

fmincon솔버에 대한 디폴트 옵션을 만듭니다.

options = optimoptions('fmincon')
options = fmincon options: Options used by current Algorithm ('interior-point'): (Other available algorithms: 'active-set', 'sqp', 'sqp-legacy', 'trust-region-reflective') Set properties: No options set. Default properties: Algorithm: 'interior-point' BarrierParamUpdate: 'monotone' CheckGradients: 0 ConstraintTolerance: 1.0000e-06 Display: 'final' FiniteDifferenceStepSize: 'sqrt(eps)' FiniteDifferenceType: 'forward' HessianApproximation: 'bfgs' HessianFcn: [] HessianMultiplyFcn: [] HonorBounds: 1 MaxFunctionEvaluations: 3000 MaxIterations: 1000 ObjectiveLimit: -1.0000e+20 OptimalityTolerance: 1.0000e-06 OutputFcn: [] PlotFcn: [] ScaleProblem: 0 SpecifyConstraintGradient: 0 SpecifyObjectiveGradient: 0 StepTolerance: 1.0000e-10 SubproblemAlgorithm: 'factorization' TypicalX: 'ones(numberOfVariables,1)' UseParallel: 0 Show options not used by current Algorithm ('interior-point')

sqp알고리즘을 사용하고 최대 1500회 반복하도록fmincon에 대한 옵션을 설정합니다.

options = optimoptions(@fmincon,'Algorithm','sqp','MaxIterations',1500)
options = fmincon options: Options used by current Algorithm ('sqp'): (Other available algorithms: 'active-set', 'interior-point', 'sqp-legacy', 'trust-region-reflective') Set properties: Algorithm: 'sqp' MaxIterations: 1500 Default properties: CheckGradients: 0 ConstraintTolerance: 1.0000e-06 Display: 'final' FiniteDifferenceStepSize: 'sqrt(eps)' FiniteDifferenceType: 'forward' MaxFunctionEvaluations: '100*numberOfVariables' ObjectiveLimit: -1.0000e+20 OptimalityTolerance: 1.0000e-06 OutputFcn: [] PlotFcn: [] ScaleProblem: 0 SpecifyConstraintGradient: 0 SpecifyObjectiveGradient: 0 StepTolerance: 1.0000e-06 TypicalX: 'ones(numberOfVariables,1)' UseParallel: 0 Show options not used by current Algorithm ('sqp')

기존 옵션을 새 값으로 업데이트합니다.

levenberg-marquardt알고리즘을 사용하고 최대 1500회 함수를 실행하도록lsqnonlin솔버에 대한 옵션을 설정합니다.

oldoptions = optimoptions(@lsqnonlin,'Algorithm','levenberg-marquardt',...'MaxFunctionEvaluations',1500)
oldoptions = lsqnonlin options: Options used by current Algorithm ('levenberg-marquardt'): (Other available algorithms: 'trust-region-reflective') Set properties: Algorithm: 'levenberg-marquardt' MaxFunctionEvaluations: 1500 Default properties: CheckGradients: 0 Display: 'final' FiniteDifferenceStepSize: 'sqrt(eps)' FiniteDifferenceType: 'forward' FunctionTolerance: 1.0000e-06 MaxIterations: 400 OutputFcn: [] PlotFcn: [] SpecifyObjectiveGradient: 0 StepTolerance: 1.0000e-06 TypicalX: 'ones(numberOfVariables,1)' UseParallel: 0 Show options not used by current Algorithm ('levenberg-marquardt')

MaxFunctionEvaluations를 2000으로 늘립니다.

options = optimoptions(oldoptions,'MaxFunctionEvaluations',2000)
options = lsqnonlin options: Options used by current Algorithm ('levenberg-marquardt'): (Other available algorithms: 'trust-region-reflective') Set properties: Algorithm: 'levenberg-marquardt' MaxFunctionEvaluations: 2000 Default properties: CheckGradients: 0 Display: 'final' FiniteDifferenceStepSize: 'sqrt(eps)' FiniteDifferenceType: 'forward' FunctionTolerance: 1.0000e-06 MaxIterations: 400 OutputFcn: [] PlotFcn: [] SpecifyObjectiveGradient: 0 StepTolerance: 1.0000e-06 TypicalX: 'ones(numberOfVariables,1)' UseParallel: 0 Show options not used by current Algorithm ('levenberg-marquardt')

점 표기법을 사용하여 기존 옵션을 새 값으로 업데이트합니다.

levenberg-marquardt알고리즘을 사용하고 최대 1500회 함수를 실행하도록lsqnonlin솔버에 대한 옵션을 설정합니다.

options = optimoptions(@lsqnonlin,'Algorithm','levenberg-marquardt',...'MaxFunctionEvaluations',1500)
options = lsqnonlin options: Options used by current Algorithm ('levenberg-marquardt'): (Other available algorithms: 'trust-region-reflective') Set properties: Algorithm: 'levenberg-marquardt' MaxFunctionEvaluations: 1500 Default properties: CheckGradients: 0 Display: 'final' FiniteDifferenceStepSize: 'sqrt(eps)' FiniteDifferenceType: 'forward' FunctionTolerance: 1.0000e-06 MaxIterations: 400 OutputFcn: [] PlotFcn: [] SpecifyObjectiveGradient: 0 StepTolerance: 1.0000e-06 TypicalX: 'ones(numberOfVariables,1)' UseParallel: 0 Show options not used by current Algorithm ('levenberg-marquardt')

점 표기법을 사용하여MaxFunctionEvaluations를 2000으로 늘립니다.

options.MaxFunctionEvaluations = 2000
options = lsqnonlin options: Options used by current Algorithm ('levenberg-marquardt'): (Other available algorithms: 'trust-region-reflective') Set properties: Algorithm: 'levenberg-marquardt' MaxFunctionEvaluations: 2000 Default properties: CheckGradients: 0 Display: 'final' FiniteDifferenceStepSize: 'sqrt(eps)' FiniteDifferenceType: 'forward' FunctionTolerance: 1.0000e-06 MaxIterations: 400 OutputFcn: [] PlotFcn: [] SpecifyObjectiveGradient: 0 StepTolerance: 1.0000e-06 TypicalX: 'ones(numberOfVariables,1)' UseParallel: 0 Show options not used by current Algorithm ('levenberg-marquardt')

fmincon솔버에 대한 디폴트가 아닌 옵션을fminunc솔버에 대한 옵션으로 전달합니다.

sqp 알고리즘을 사용하고 최대 1500회 반복하도록fmincon에 대한 옵션을 설정합니다.

oldoptions = optimoptions(@fmincon,'Algorithm','sqp','MaxIterations',1500)
oldoptions = fmincon选项:选择使用的咕咕叫ent Algorithm ('sqp'): (Other available algorithms: 'active-set', 'interior-point', 'sqp-legacy', 'trust-region-reflective') Set properties: Algorithm: 'sqp' MaxIterations: 1500 Default properties: CheckGradients: 0 ConstraintTolerance: 1.0000e-06 Display: 'final' FiniteDifferenceStepSize: 'sqrt(eps)' FiniteDifferenceType: 'forward' MaxFunctionEvaluations: '100*numberOfVariables' ObjectiveLimit: -1.0000e+20 OptimalityTolerance: 1.0000e-06 OutputFcn: [] PlotFcn: [] ScaleProblem: 0 SpecifyConstraintGradient: 0 SpecifyObjectiveGradient: 0 StepTolerance: 1.0000e-06 TypicalX: 'ones(numberOfVariables,1)' UseParallel: 0 Show options not used by current Algorithm ('sqp')

적용 가능한 옵션을fminunc솔버로 전달합니다.

options = optimoptions(@fminunc,oldoptions)
options = fminunc options: Options used by current Algorithm ('quasi-newton'): (Other available algorithms: 'trust-region') Set properties: CheckGradients: 0 FiniteDifferenceType: 'forward' MaxIterations: 1500 OptimalityTolerance: 1.0000e-06 PlotFcn: [] SpecifyObjectiveGradient: 0 StepTolerance: 1.0000e-06 Default properties: Algorithm: 'quasi-newton' Display: 'final' FiniteDifferenceStepSize: 'sqrt(eps)' MaxFunctionEvaluations: '100*numberOfVariables' ObjectiveLimit: -1.0000e+20 OutputFcn: [] TypicalX: 'ones(numberOfVariables,1)' UseParallel: 0 Show options not used by current Algorithm ('quasi-newton')

'sqp'fminunc에 유효한 알고리즘 옵션이 아니므로, 알고리즘 옵션이fminunc에 전달되지 않습니다.

최적화 문제를 만들고 디폴트 솔버와 옵션을 찾습니다.

rngdefaultx = optimvar('x',3,'LowerBound',0); expr = x'*(eye(3) + randn(3))*x - randn(1,3)*x; prob = optimproblem('Objective',expr); options = optimoptions(prob)
options = quadprog options: Options used by current Algorithm ('interior-point-convex'): (Other available algorithms: 'active-set', 'trust-region-reflective') Set properties: No options set. Default properties: Algorithm: 'interior-point-convex' ConstraintTolerance: 1.0000e-08 Display: 'final' LinearSolver: 'auto' MaxIterations: 200 OptimalityTolerance: 1.0000e-08 StepTolerance: 1.0000e-12 Show options not used by current Algorithm ('interior-point-convex')

디폴트 솔버는quadprog입니다.

반복 과정을 표시하도록 옵션을 설정합니다. 해를 구합니다.

options.Display ='iter'; sol = solve(prob,'Options',options);
Solving problem using quadprog. Your Hessian is not symmetric. Resetting H=(H+H')/2. Iter Fval Primal Infeas Dual Infeas Complementarity 0 2.018911e+00 0.000000e+00 2.757660e+00 6.535839e-01 1 -2.170204e+00 0.000000e+00 8.881784e-16 2.586177e-01 2 -3.405808e+00 0.000000e+00 8.881784e-16 2.244054e-03 3 -3.438788e+00 0.000000e+00 3.356690e-16 7.261144e-09 Minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance.
sol.x
ans =3×11.6035 0.0000 0.8029

입력 인수

모두 축소

솔버이름으로,문자형벡터,字符串형또는함수핸들로지정됩니다。

예:'fmincon'

예:@fmincon

데이터형:char|function_handle|string

optimoptions함수로 생성되는 옵션으로, options 객체로 지정됩니다.

예:oldoptions = optimoptions(@fminunc)

문제 객체로,OptimizationProblem또는EquationProblem객체로 지정됩니다.Problem-Based Optimization Workflow또는방정식 풀이를 위한 문제 기반 워크플로의 절차에 따라prob를 만듭니다.

prob를 사용한 구문을 통해 문제에 대한 디폴트 솔버를 확인하고 알고리즘이나 다른 옵션을 수정할 수 있습니다.

예:prob = optimproblem('Objective',myobj). 여기서myobj는 최적화 표현식입니다.

이름-값 쌍의 인수

선택적으로Name,Value인수가 쉼표로 구분되어 지정됩니다. 여기서Name은 인수 이름이고Value는 대응값입니다.Name은 따옴표 안에 표시해야 합니다.Name1,Value1,...,NameN,ValueN과 같이 여러 개의 이름-값 쌍의 인수를 어떤 순서로든 지정할 수 있습니다.

예:optimoptions(@fmincon,'Display','iter','FunctionTolerance',1e-10)은 반복 과정을 표시하고FunctionTolerance1e-10이 되도록fmincon옵션을 설정합니다.

관련된 이름-값 쌍의 인수는 해당 솔버에 대한 옵션 표를 참조하십시오.

출력 인수

모두 축소

SolverName솔버에 대한 최적화 옵션으로, options 객체로 반환됩니다.

대체 기능

라이브 편집기 작업

최적화라이브 편집기 작업을 사용해 옵션을 시각적으로 설정할 수 있습니다. 예제는fmincon 솔버로 최적화 라이브 편집기 작업 사용항목을 참조하십시오.

확장 기능

R2013a에 개발됨