MaplePrimes - Global Optimization Posts and Questions
http://www.mapleprimes.com/products/Maple Toolboxes/Global Optimization
en-us2023 Maplesoft, A Division of Waterloo Maple Inc.Maplesoft Document SystemWed, 31 May 2023 16:58:22 GMTWed, 31 May 2023 16:58:22 GMTGlobal Optimization Questions and Posts on MaplePrimeshttp://www.mapleprimes.com/images/mapleprimeswhite.jpgMaplePrimes - Global Optimization Posts and Questions
http://www.mapleprimes.com/products/Maple Toolboxes/Global Optimization
Optimizing Mini Golf in MapleSim
https://www.mapleprimes.com/maplesoftblog/211934-Optimizing-Mini-Golf-In-MapleSim?ref=Feed:MaplePrimes:Version Global Optimization
<p>Playing mini-golf recently, I realized that my protractor can only help me so far since it can't calculate the speed of the swing needed. I decided a more sophisticated tool was needed and modeled a trick-shot in MapleSim.</p>
<p>To start, I laid out the obstacles, the ball and club, the ground, and some additional visualizations in the MapleSim environment.</p>
<p><img src="/view.aspx?sf=211934_post/Mini_Golf_Model_1.png"></p>
<p> </p>
<p>When running the simulation, my first result wasn't even close to the hole (similar to when I play in real life!).</p>
<p><img src="/view.aspx?sf=211934_post/MapleSim_Mini_Golf_(Not_Optimized).gif"></p>
<p> </p>
<p>The model clearly needed to be optimized. I went to the Optimization app in MapleSim (this can be found under Add Apps or Templates <img src="/view.aspx?sf=211934_post/App.png"> on the left hand side).</p>
<p><img src="/view.aspx?sf=211934_post/Add_Apps_or_Templates.png"></p>
<p> </p>
<p>Inside the app I clicked "Load System" then selected the parameters I wanted to optimize.</p>
<p><img src="/view.aspx?sf=211934_post/Parameter_Optimization.png"></p>
<p> </p>
<p>For this case, I'm optimizing 's' (the speed of the club) and 'theta' (the angle of the club). For the Objective Function I added a Relative Translation Sensor to the model and attached a probe to the Vector Norm of the output.</p>
<p><img src="/view.aspx?sf=211934_post/Mini_Golf_Model_2.png"></p>
<p> </p>
<p>Inside the app, I switched to the Objective Function section. Selecting Probes, I added the new probe as the Objective Function by giving it a weight of 1.</p>
<p><img src="/view.aspx?sf=211934_post/Parameter_Optimization_Obj.png"></p>
<p> </p>
<p> </p>
<p>Scrolling down to "Execute Parameter Optimization", I checked the "Use Global Optimization Toolbox" checkbox, and clicked Run Parameter Optimization.</p>
<p><img src="/view.aspx?sf=211934_post/Execute_Param_Op.png"></p>
<p> </p>
<p>Following a run time of 120 seconds, the app returns the graph of the objective function. </p>
<p><img src="/view.aspx?sf=211934_post/Plot_Results.png"></p>
<p> </p>
<p>Below the plot, optimal values for the parameters are given. Plugging these back into the parameter block for the simulation we see that the ball does in fact go into the hole. Success!</p>
<p><img src="/view.aspx?sf=211934_post/MapleSim_Mini_Golf.gif"></p>
<p> </p>
<p><img src="/view.aspx?sf=211934_post/MapleSim_Mini_Golf_(Tracking).gif"></p>
<p> </p>
<p><a href="/view.aspx?sf=211934_post/Mini_golf_Global_Optimization.msim">Mini_golf_Global_Optimization.msim</a></p>
<p>Playing mini-golf recently, I realized that my protractor can only help me so far since it can't calculate the speed of the swing needed. I decided a more sophisticated tool was needed and modeled a trick-shot in MapleSim.</p>
<p>To start, I laid out the obstacles, the ball and club, the ground, and some additional visualizations in the MapleSim environment.</p>
<p><img src="/view.aspx?sf=211934_post/Mini_Golf_Model_1.png"></p>
<p> </p>
<p>When running the simulation, my first result wasn't even close to the hole (similar to when I play in real life!).</p>
<p><img src="/view.aspx?sf=211934_post/MapleSim_Mini_Golf_(Not_Optimized).gif"></p>
<p> </p>
<p>The model clearly needed to be optimized. I went to the Optimization app in MapleSim (this can be found under Add Apps or Templates <img src="/view.aspx?sf=211934_post/App.png"> on the left hand side).</p>
<p><img src="/view.aspx?sf=211934_post/Add_Apps_or_Templates.png"></p>
<p> </p>
<p>Inside the app I clicked "Load System" then selected the parameters I wanted to optimize.</p>
<p><img src="/view.aspx?sf=211934_post/Parameter_Optimization.png"></p>
<p> </p>
<p>For this case, I'm optimizing 's' (the speed of the club) and 'theta' (the angle of the club). For the Objective Function I added a Relative Translation Sensor to the model and attached a probe to the Vector Norm of the output.</p>
<p><img src="/view.aspx?sf=211934_post/Mini_Golf_Model_2.png"></p>
<p> </p>
<p>Inside the app, I switched to the Objective Function section. Selecting Probes, I added the new probe as the Objective Function by giving it a weight of 1.</p>
<p><img src="/view.aspx?sf=211934_post/Parameter_Optimization_Obj.png"></p>
<p> </p>
<p> </p>
<p>Scrolling down to "Execute Parameter Optimization", I checked the "Use Global Optimization Toolbox" checkbox, and clicked Run Parameter Optimization.</p>
<p><img src="/view.aspx?sf=211934_post/Execute_Param_Op.png"></p>
<p> </p>
<p>Following a run time of 120 seconds, the app returns the graph of the objective function. </p>
<p><img src="/view.aspx?sf=211934_post/Plot_Results.png"></p>
<p> </p>
<p>Below the plot, optimal values for the parameters are given. Plugging these back into the parameter block for the simulation we see that the ball does in fact go into the hole. Success!</p>
<p><img src="/view.aspx?sf=211934_post/MapleSim_Mini_Golf.gif"></p>
<p> </p>
<p><img src="/view.aspx?sf=211934_post/MapleSim_Mini_Golf_(Tracking).gif"></p>
<p> </p>
<p><a href="/view.aspx?sf=211934_post/Mini_golf_Global_Optimization.msim">Mini_golf_Global_Optimization.msim</a></p>
211934Wed, 12 Feb 2020 20:06:25 ZTechnicalSupportTechnicalSupportrandomize in GlobalOptimization
https://www.mapleprimes.com/questions/228178-Randomize-In-GlobalOptimization?ref=Feed:MaplePrimes:Version Global Optimization
<p>Does global optimization toolbox has randomization option it gives same value every time</p>
<p>Does global optimization toolbox has randomization option it gives same value every time</p>
228178Wed, 30 Oct 2019 18:23:09 Zradaarradaarthread safe or not
https://www.mapleprimes.com/questions/228165-Thread-Safe-Or-Not?ref=Feed:MaplePrimes:Version Global Optimization
<p>Does globalsolve from global optimization toolbox thread safe or not</p>
<p>Does globalsolve from global optimization toolbox thread safe or not</p>
228165Tue, 29 Oct 2019 07:31:31 ZradaarradaarGlobalOptimization benchmarks
https://www.mapleprimes.com/questions/228144-GlobalOptimization-Benchmarks?ref=Feed:MaplePrimes:Version Global Optimization
<p>Does Maplesoft provide success percentage of this toolbox on benchmark functions?. I cannot see much options in the global solve command (from maple help page) other than population size etc. </p>
<p>Does Maplesoft provide success percentage of this toolbox on benchmark functions?. I cannot see much options in the global solve command (from maple help page) other than population size etc. </p>
228144Sat, 26 Oct 2019 15:12:44 Zradaarradaarlocal optimizer in GlobalOptimization
https://www.mapleprimes.com/questions/228143-Local-Optimizer-In-GlobalOptimization?ref=Feed:MaplePrimes:Version Global Optimization
<p>I would like to know whether a local optimizer is combined with the present global optimization toolbox?. I read that toolbox has differential evolution and surrogate optimization techniques etc. These methods guarantee near-optimal solutions and it is often recommended to use a local optimization technique in conjunction with global optimization techniques. </p>
<p>I would like to know whether a local optimizer is combined with the present global optimization toolbox?. I read that toolbox has differential evolution and surrogate optimization techniques etc. These methods guarantee near-optimal solutions and it is often recommended to use a local optimization technique in conjunction with global optimization techniques. </p>
228143Sat, 26 Oct 2019 10:47:51 ZradaarradaarWhen GlobalOpimization is wrong , but Optimization is right!
https://www.mapleprimes.com/questions/227978-When-GlobalOpimization-Is-Wrong--But?ref=Feed:MaplePrimes:Version Global Optimization
<p>first I define some constants (note I may change the constants later based on the context of the application)</p>
<p>p_l := 10^(-15); <br>
epsilon := 1.09*10^(-10);<br>
p_B := 1.09*10^(-8);</p>
<p>n_A := 10^7; <br>
k_A := 0;<br>
n_B := 10^8; <br>
k_B := 0;</p>
<p>then I define a function l(x,y):</p>
<p>l := (x, y) -> x^k_A*(1 - x)^(n_A - k_A)*y^k_B*(1 - y)^(n_B - k_B)</p>
<p>Now I use both with(GlobalOptimization) and with(Optimization) to maximize l(x,y) give some constraints and I get:</p>
<p>GlobalSolve(l(x_1, y_1), x_1 = p_l .. epsilon, y_1 = p_B .. 1, maximize, initialpoint = [x_1 = 0, y_1 = 0]);<br>
[-0., [x_1 = 1.09000000000000 10^(-10) , y_1 = 0.633548870211381]]</p>
<p><br>
Maximize(l(x_1, y_1), x_1 = p_l .. epsilon, y_1 = p_B .. 1, initialpoint = [x_1 = 0, y_1 = 0]);<br>
[0.33621648834727435318, [x_1 = 1.00000000000000 10^(-15) , y_1 = 1.0900000000000000000 10^(-8) ] ]</p>
<p> </p>
<p>Clearly the second answer is right and the first is wrong... I am not sure why the ``global optimazation'' is doing worse than the normal and free ``optimazation''.. Am I using the GlobalSolve in a wrong way??</p>
<p>first I define some constants (note I may change the constants later based on the context of the application)</p>
<p>p_l := 10^(-15); <br />
epsilon := 1.09*10^(-10);<br />
p_B := 1.09*10^(-8);</p>
<p>n_A := 10^7; <br />
k_A := 0;<br />
n_B := 10^8; <br />
k_B := 0;</p>
<p>then I define a function l(x,y):</p>
<p>l := (x, y) -> x^k_A*(1 - x)^(n_A - k_A)*y^k_B*(1 - y)^(n_B - k_B)</p>
<p>Now I use both with(GlobalOptimization) and with(Optimization) to maximize l(x,y) give some constraints and I get:</p>
<p>GlobalSolve(l(x_1, y_1), x_1 = p_l .. epsilon, y_1 = p_B .. 1, maximize, initialpoint = [x_1 = 0, y_1 = 0]);<br />
[-0., [x_1 = 1.09000000000000 10^(-10) , y_1 = 0.633548870211381]]</p>
<p><br />
Maximize(l(x_1, y_1), x_1 = p_l .. epsilon, y_1 = p_B .. 1, initialpoint = [x_1 = 0, y_1 = 0]);<br />
[0.33621648834727435318, [x_1 = 1.00000000000000 10^(-15) , y_1 = 1.0900000000000000000 10^(-8) ] ]</p>
<p> </p>
<p>Clearly the second answer is right and the first is wrong... I am not sure why the ``global optimazation'' is doing worse than the normal and free ``optimazation''.. Am I using the GlobalSolve in a wrong way??</p>
227978Fri, 04 Oct 2019 11:33:15 Zweidade37211weidade37211