# OptimizationValues

Values for optimization problems

## Description

An `OptimizationValues` object holds values used by and returned from `solve` for multiobjective problems. The object also holds starting values for the `x0` argument for solvers that accept multiple start points.

## Creation

The `solve` function returns a vector of `OptimizationValues` objects as the solution to a multiobjective problem.

Create an `OptimizationValues` object for a start point `x0` by using the `optimvalues` function.

## Properties

expand all

Typically, `OptimizationValues` properties are dynamic: they are the names of the optimization variables, objective function or functions, and constraints.

However, you can also have unnamed objective functions or constraints. For those cases, `OptimizationValues` assigns the following properties.

Objective function values, returned or specified as a real array.

Data Types: `double`

Constraint values, returned or specified as a real array.

Data Types: `double`

## Object Functions

 `paretoplot` Pareto plot of multiobjective values

## Examples

collapse all

Create and solve a multiobjective problem using optimization variables.

```x = optimvar("x",LowerBound=-3,UpperBound=3); prob = optimproblem; prob.Objective = [x^2;(x-1)^2]; % Tradeoff region between x = 0 and x = 1 prob.Constraints.con1 = x^2 <= 1/2; % Demonstrate constraints prob.Constraints.con2 = x^2 >= 1/10; % Second constraint rng default % For reproducibility [sol,fval,exitflag,output] = solve(prob,Solver="paretosearch")```
```Solving problem using paretosearch. Pareto set found that satisfies the constraints. Optimization completed because the relative change in the volume of the Pareto set is less than 'options.ParetoSetChangeTolerance' and constraints are satisfied to within 'options.ConstraintTolerance'. ```
```sol = 1x60 OptimizationValues vector with properties: Variables properties: x: [0.6366 0.3952 0.6812 0.5353 0.4299 0.6951 0.3813 0.3223 ... ] Objective properties: Objective: [2x60 double] Constraints properties: con1: [-0.0947 -0.3438 -0.0360 -0.2134 -0.3152 -0.0169 -0.3546 ... ] con2: [-0.3053 -0.0562 -0.3640 -0.1866 -0.0848 -0.3831 -0.0454 ... ] ```
```fval = 2×60 0.4053 0.1562 0.4640 0.2866 0.1848 0.4831 0.1454 0.1039 0.1295 0.1016 0.1406 0.3329 0.1300 0.3210 0.2673 0.3223 0.1115 0.4253 0.1170 0.4749 0.3164 0.1099 0.4375 0.1814 0.2936 0.4727 0.4395 0.1820 0.2789 0.2261 0.4568 0.1658 0.4862 0.1197 0.1529 0.1086 0.3525 0.1225 0.1057 0.2628 0.2197 0.4902 0.1760 0.3665 0.2411 0.1092 0.4911 0.1914 0.1182 0.3742 0.1320 0.3658 0.1016 0.2159 0.3250 0.0930 0.3828 0.4593 0.4098 0.4640 0.3906 0.1789 0.4090 0.1879 0.2333 0.1869 0.4436 0.1210 0.4328 0.0966 0.1914 0.4469 0.1146 0.3296 0.2099 0.0977 0.1136 0.3288 0.2227 0.2751 0.1051 0.3514 0.0916 0.4277 0.3708 0.4496 0.1650 0.4224 0.4555 0.2375 0.2822 0.0899 0.3369 0.1557 0.2591 0.4483 0.0895 0.3164 0.4307 0.1508 ```
```exitflag = SolverConvergedSuccessfully ```
```output = struct with fields: iterations: 16 funccount: 282 volume: 1.8535 averagedistance: 0.0089 spread: 0.2737 maxconstraint: 0 message: 'Pareto set found that satisfies the constraints. ...' rngstate: [1x1 struct] solver: 'paretosearch' ```

The `paretosearch` solver converges in 16 iterations to a feasible solution. Plot the solution.

`paretoplot(sol)` Choose an arbitrary point to examine in the plot using Data Tips:  The pictured point is at index 48. Examine solution 48.

`arbitrarysol = sol(48)`
```arbitrarysol = OptimizationValues with properties: Variables properties: x: 0.4375 Objective properties: Objective: [2x1 double] Constraints properties: con1: -0.3086 con2: -0.0914 ```

The constraint values are negative, meaning the pictured point is feasible.

`arbitrarysol.Objective`
```ans = 2×1 0.1914 0.3164 ```

The objective values match the values in the Data Tips.

## Limitations

• `OptimizationValues` objects support horizontal concatenation only. In other words, you can have only row vectors of `OptimizationValues` objects.

## Version History

Introduced in R2022a