基于问题的优化实时编辑器任务快速入门

包括参数或数据

```x0x = -2; x0y = 2; a = 100;```

优化实时编辑器任务

``` ```
``` OptimizationProblem : Solve for: x, y minimize : log(((1 + (100 .* (y - x.^2).^2)) + (1 - x).^2)) subject to : (x.^2 + y.^2) <= 1 variable bounds: -3 <= x <= 3 -2 <= y <= 9 ```
```Solving problem using fmincon. Local 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. ```
```solution = struct with fields: x: 0.7864 y: 0.6177 ```
```reasonSolverStopped = OptimalSolution ```
```objectiveValue = 0.0447 ```

解释结果

`solution.x^2 + solution.y^2 `
```ans = 1.0000 ```

辅助函数

```function objective = rosenbrock(x,y,a) % This function should return a scalar representing an optimization objective. % Example: Concession stand profit % revenue = 3*soda + 5*popcorn + 2*candy; % cost = 1*soda + 2*popcorn + 0.75*candy; % objective = revenue - cost; % profit % Edit the lines below with your calculations. objective = log(1 + a*(y - x^2)^2 + (1 - x)^2); end```