You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tada! That's how you do it. Now let's dive in a little more into what each part means and how to customize it all to your needs.
37
+
38
+
## Understanding the Solution Object
39
+
40
+
The solution object is a `SciMLBase.AbstractNoTimeSolution`, and thus it follows the
41
+
[SciMLBase Solution Interface for non-timeseries objects](https://docs.sciml.ai/SciMLBase/stable/interfaces/Solutions/) and is documented at the [solution type page](@ref solution).
42
+
However, for simplicity let's show a bit of it in action.
43
+
44
+
An optimization solution has an array interface so that it acts like the array that it solves for. This array syntax is shorthand for simply grabbing the solution `u`. For example:
45
+
46
+
```@example intro
47
+
sol[1] == sol.u[1]
48
+
```
49
+
50
+
```@example intro
51
+
Array(sol) == sol.u
52
+
```
53
+
54
+
`sol.objective` returns the final cost of the optimization. We can validate this by plugging it into our function:
55
+
56
+
```@example intro
57
+
rosenbrock(sol.u, p)
58
+
```
59
+
60
+
```@example intro
61
+
sol.objective
62
+
```
63
+
64
+
The `sol.retcode` gives us more information about the solution process.
65
+
66
+
```@example intro
67
+
sol.retcode
68
+
```
69
+
70
+
Here it says `ReturnCode.Success` which means that the solutuion successfully solved. We can learn more about the different return codes at
71
+
[the ReturnCode part of the SciMLBase documentation](https://docs.sciml.ai/SciMLBase/stable/interfaces/Solutions/#retcodes).
72
+
73
+
If we are interested about some of the statistics of the solving process, for example to help choose a better solver, we can investigate the `sol.stats`
74
+
75
+
```@example intro
76
+
sol.stats
77
+
```
78
+
79
+
That's just a bit of what's in there, check out the other pages for more information but now let's move onto customization.
80
+
20
81
## Import a different solver package and solve the problem
21
82
22
83
OptimizationOptimJL is a wrapper for [Optim.jl](https://github.com/JuliaNLSolvers/Optim.jl) and OptimizationBBO is a wrapper for [BlackBoxOptim.jl](https://github.com/robertfeldt/BlackBoxOptim.jl).
0 commit comments