咨询热线
18888889999
notice 网站公告
— 杏彩体育资讯 —
为 求解器创建默认选项。
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' 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 Options not used by current Algorithm ('interior-point') Default properties: FunctionTolerance: 1.0000e-06
为 设置选项,以使用 算法和最多 1500 次迭代。
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: 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 Options not used by current Algorithm ('sqp') Default properties: BarrierParamUpdate: 'monotone' EnableFeasibilityMode: 0 FunctionTolerance: 1.0000e-06 HessianApproximation: 'not applicable' HessianFcn: [] HessianMultiplyFcn: [] HonorBounds: 1 SubproblemAlgorithm: 'factorization'
用新值更新现有选项。
为 求解器设置选项,以使用 算法和最多 1500 个函数计算
oldoptions=optimoptions(@lsqnonlin,'Algorithm','levenberg-marquardt',... 'MaxFunctionEvaluations',1500)
oldoptions=lsqnonlin options: Options used by current Algorithm ('levenberg-marquardt'): (Other available algorithms: 'interior-point', 'trust-region-reflective') Set properties: Algorithm: 'levenberg-marquardt' MaxFunctionEvaluations: 1500 Default properties: 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 Options not used by current Algorithm ('levenberg-marquardt') Default properties: BarrierParamUpdate: 'monotone' ConstraintTolerance: 1.0000e-06 JacobianMultiplyFcn: [] OptimalityTolerance: 1.0000e-06 SpecifyConstraintGradient: 0 SubproblemAlgorithm: 'factorization'
将 增加到 2000。
options=optimoptions(oldoptions,'MaxFunctionEvaluations',2000)
options=lsqnonlin options: Options used by current Algorithm ('levenberg-marquardt'): (Other available algorithms: 'interior-point', 'trust-region-reflective') Set properties: Algorithm: 'levenberg-marquardt' MaxFunctionEvaluations: 2000 Default properties: 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 Options not used by current Algorithm ('levenberg-marquardt') Default properties: BarrierParamUpdate: 'monotone' ConstraintTolerance: 1.0000e-06 JacobianMultiplyFcn: [] OptimalityTolerance: 1.0000e-06 SpecifyConstraintGradient: 0 SubproblemAlgorithm: 'factorization'
使用圆点表示法用新值更新现有选项。
为 求解器设置选项,以使用 算法和最多 1500 个函数计算
options=optimoptions(@lsqnonlin,'Algorithm','levenberg-marquardt',... 'MaxFunctionEvaluations',1500)
options=lsqnonlin options: Options used by current Algorithm ('levenberg-marquardt'): (Other available algorithms: 'interior-point', 'trust-region-reflective') Set properties: Algorithm: 'levenberg-marquardt' MaxFunctionEvaluations: 1500 Default properties: 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 Options not used by current Algorithm ('levenberg-marquardt') Default properties: BarrierParamUpdate: 'monotone' ConstraintTolerance: 1.0000e-06 JacobianMultiplyFcn: [] OptimalityTolerance: 1.0000e-06 SpecifyConstraintGradient: 0 SubproblemAlgorithm: 'factorization'
使用圆点表示法将 增加到 2000。
options.MaxFunctionEvaluations=2000
options=lsqnonlin options: Options used by current Algorithm ('levenberg-marquardt'): (Other available algorithms: 'interior-point', 'trust-region-reflective') Set properties: Algorithm: 'levenberg-marquardt' MaxFunctionEvaluations: 2000 Default properties: 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 Options not used by current Algorithm ('levenberg-marquardt') Default properties: BarrierParamUpdate: 'monotone' ConstraintTolerance: 1.0000e-06 JacobianMultiplyFcn: [] OptimalityTolerance: 1.0000e-06 SpecifyConstraintGradient: 0 SubproblemAlgorithm: 'factorization'
将 求解器的非默认选项转移到 求解器的选项。
为 设置选项,以使用 sqp 算法和最多 1500 次迭代。
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: 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 Options not used by current Algorithm ('sqp') Default properties: BarrierParamUpdate: 'monotone' EnableFeasibilityMode: 0 FunctionTolerance: 1.0000e-06 HessianApproximation: 'not applicable' HessianFcn: [] HessianMultiplyFcn: [] HonorBounds: 1 SubproblemAlgorithm: 'factorization'
将适用选项迁移到 求解器。
options=optimoptions(@fminunc,oldoptions)
options=fminunc options: Options used by current Algorithm ('quasi-newton'): (Other available algorithms: 'trust-region') Set properties: 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 Options not used by current Algorithm ('quasi-newton') Set properties: FunctionTolerance: 1.0000e-06 HessianFcn: [] HessianMultiplyFcn: [] SubproblemAlgorithm: 'factorization'
算法选项不会传输到 ,因为 不是 的有效算法选项。
创建优化问题并找到默认的求解器和选项。
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 Options not used by current Algorithm ('interior-point-convex') Default properties: FunctionTolerance: 'default dependent on problem' HessianMultiplyFcn: [] ObjectiveLimit: -1.0000e+20 SubproblemAlgorithm: 'cg' TypicalX: 'ones(numberOfVariables,1)'
默认求解器是 。
设置选项以使用迭代输出。查找解。
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
如有需求请您联系我们!
地址:海南省海口市58号
电话:18888889999
手机:海南省海口市58号
Copyright © 2012-2018 首页-杏彩体育中国官方网站 版权所有 ICP备案编:琼ICP备88889999号