prob = optimproblem
prob = optimproblem(Name, Value)
[sol, fval] = solve(prob, x0)
| Parameter | Description |
|---|---|
| Objective | objective expression to minimize or maximize. |
| Constraints | structure of named optimization constraints. |
| Name, Value | problem properties such as Objective, Description, and ObjectiveSense. |
| Parameter | Description |
|---|---|
| prob | optimization problem object. |
| sol | solution structure returned by solve. |
| fval | objective value at the solution. |
optim.problemdef.OptimizationProblem stores an objective, constraints, variables, objective sense, and description.
Use optimproblem to create the object and solve to compute a solution.
x = optimvar('x', 2, 1, 'LowerBound', 0);
prob = optimproblem('Objective', (x(1) - 1)^2 + (x(2) - 2)^2);
prob.Constraints.limit = x(1) + x(2) <= 4;
[sol, fval] = solve(prob)
| Version | Description |
|---|---|
| 2.0.0 | initial version |