이 번역 페이지는 최신 내용을 담고 있지 않습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.
optimoptions
최적화 옵션 만들기
구문
설명
은 options
= optimoptions(SolverName
)SolverName
솔버에 대한 디폴트 옵션 집합을 반환합니다.
는 하나 이상의 이름-값 쌍의 인수를 사용하여 설정한 지정된 파라미터를 가진 options
= optimoptions(SolverName
,Name,Value
)options
를 반환합니다.
는 명명된 파라미터가 지정된 값으로 변경된 options
= optimoptions(oldoptions
,Name,Value
)oldoptions
의 복사본을 반환합니다.
는 options
= optimoptions(SolverName
,oldoptions
)SolverName
솔버의 디폴트 옵션을 반환하고 oldoptions
의 해당 옵션을 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' EnableFeasibilityMode: 0 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 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')
적용 가능한 옵션을 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)' HessianApproximation: 'bfgs' 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
에 전달되지 않습니다.
최적화 문제에 대한 솔버와 디폴트 옵션 찾기
최적화 문제를 만들고 디폴트 솔버와 옵션을 찾습니다.
rng default x = 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×1
1.6035
0.0000
0.8029
입력 인수
SolverName
— 솔버 이름
문자형 벡터 | string형 | 함수 핸들
솔버 이름으로, 문자형 벡터, string형 또는 함수 핸들로 지정됩니다.
예: 'fmincon'
예: @fmincon
데이터형: char
| function_handle
| string
oldoptions
— optimoptions
로 생성되는 옵션
options 객체
optimoptions
함수로 생성되는 옵션으로, options 객체로 지정됩니다.
예: oldoptions = optimoptions(@fminunc)
prob
— 문제 객체
OptimizationProblem
객체 | EquationProblem
객체
문제 객체로, OptimizationProblem
또는 EquationProblem
객체로 지정됩니다. 문제 기반 최적화 워크플로 또는 방정식 풀이를 위한 문제 기반 워크플로의 절차에 따라 prob
를 만듭니다.
prob
를 사용한 구문을 통해 문제에 대한 디폴트 솔버를 확인하고 알고리즘이나 다른 옵션을 수정할 수 있습니다.
예: prob = optimproblem('Objective',myobj)
. 여기서 myobj
는 최적화 표현식입니다.
이름-값 인수
선택적 인수 쌍을 Name1=Value1,...,NameN=ValueN
으로 지정합니다. 여기서 Name
은 인수 이름이고 Value
는 대응값입니다. 이름-값 인수는 다른 인수 뒤에 와야 하지만, 인수 쌍의 순서는 상관없습니다.
R2021a 이전 릴리스에서는 쉼표를 사용하여 각 이름과 값을 구분하고 Name
을 따옴표로 묶으십시오.
예: optimoptions(@fmincon,'Display','iter','FunctionTolerance',1e-10)
은 반복 과정을 표시하고 FunctionTolerance
가 1e-10
이 되도록 fmincon
옵션을 설정합니다.
관련된 이름-값 쌍의 인수는 해당 솔버에 대한 옵션 표를 참조하십시오.
fgoalattain
options
fmincon
options
fminimax
options
fminunc
options
fseminf
options
fsolve
options
ga
options
(Global Optimization Toolbox)gamultiobj
options
(Global Optimization Toolbox)intlinprog
options
linprog
options
lsqcurvefit
options
lsqlin
options
lsqnonlin
options
paretosearch
options
(Global Optimization Toolbox)particleswarm
options
(Global Optimization Toolbox)patternsearch
options
(Global Optimization Toolbox)quadprog
options
simulannealbnd
options
(Global Optimization Toolbox)surrogateopt
options
(Global Optimization Toolbox)
출력 인수
options
— 최적화 옵션
options 객체
SolverName
솔버에 대한 최적화 옵션으로, options 객체로 반환됩니다.
대체 기능
라이브 편집기 작업
최적화 라이브 편집기 작업을 사용해 옵션을 시각적으로 설정할 수 있습니다. 예제는 fmincon 솔버로 최적화 라이브 편집기 작업 사용 항목을 참조하십시오.
확장 기능
버전 내역
R2013a에 개발됨
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)