VDOC-03 OptRSA DOE

:bulb: 0. 目錄

:mega: 1. 老駱提醒

  • 請先確認,您已經閱讀 VDOC_00_Introduction 中的聲明。
  • 本文延續 VDOC_02_DOE 繼續介紹如何使用VisualDOC結合DOEOptimizationRSA求解問題。

:question: 2. 問題描述

Minimize Objective Function f(x,y):

f(x,y)=(x2+y2)10cos(x)cos(y)

Subject to the Constraint Equation g(x,y):

g(x,y)=(x2+y2)1.5

Design Variables (Side Constraints):

2x22y4

Initial Conditions:

x=2y=2

:mag_right: 3. VisualDOC操作細節

3.1 Optimization Using DOE

本節講述如何將DOE設定為Component Ediror內層,並新增OptimizationComponent Ediror外層

3.1.1 Work Flow

打開DOE with approximations,另存一個新的task,命名為Opt Using DOE。接著至E欄中將Add optimization component拖曳至F欄

101_work_flow

DOE component剪下貼上至Optimization中。

102_work_flow

重新連接所有component

103_work_flow

3.1.2 Data Linker

點選C欄 Data Linker,使用左側的Automatically add data to the selected model自動連接。

301_data_linker

3.1.3 Component Editor

點選C欄 Component Editor外層的Optimization component,並進行下列操作:

  • 設定xyLower BoundUpper Bound
  • 勾選fObjective、不勾選其為Constraint,並確定其Goal維持預設的Minimize
  • 勾選gConstraint,並設定其Lower Bound1.5

201_component_editor

點選C欄 Component Editor中層的DOE component,選擇User Defined,使用Import From File讀入 VDOC_02_DOE 中產生的DOE_with_responses.txt,作為DOE點位,而不重新計算。此外,因為之前曾經另存一個DOE with responsestask,所以也可以選擇使用Import From Database來讀入預先計算好的點位。

在這個問題裡,因為選點策略及數量已經固定,所以其fg的近似函數並不會改變,所以可以在Show Advanced Options裡勾選Reuse approximation from first invocation when run as subflow。如此一來,可以僅進行一次fg近似函數的求解,之後每次在呼叫Optimization component進行最佳化的時候,都可以用第一次fg的近似函數來代替。

202_component_editor

3.1.4 Simulation Monitors

點選C欄 Simulation Monitors,刪除於DOE中所建立的圖表,新增兩張Optimization最常用的BestObjetiveWrostConstraint來輔助觀察。

401_simulation_monitors

3.1.5 Post processing

501_post_processing

502_post_processing

()內為PythonEquation被呼叫次數 x y f g
Opt Using PythonEquation(48) 0.86087 0.87115 -0.26971 1.50000
Opt Using DOE(9) 2.00000 0.29777 -0.07096 4.08891

3.2 Optimization Using DOE(利用PythonEquation驗證)

本節試著驗證看看,如果直接利用PythonEquation component輸入近似的fg,並對其直接進行最佳化,其結果會不會和 3.1 Optimization Using DOE 一樣。

打開Opt Using PythonEquation這個task,另存一task,命名為Opt Using DOE(Verified by PythonEquation),將fg的近似函數,取代原有的方程式。

503_post_processing

504_post_processing

()內為PythonEquation被呼叫次數 x y f g
Opt Using PythonEquation(48) 0.86087 0.87115 -0.26971 1.50000
Opt Using DOE(9) 2.00000 0.29777 -0.07096 4.08891
Opt Using DOE(Verified by PythonEquation)(40) 2.00000 0.29777 -0.07096 4.08891

以上,可證明3.1節與3.2節操作,可得到相同的答案。

3.3 RSA Using DOE

本節講述如何將RSAComponent Ediror外層PythonEquationComponent Ediror內層

3.3.1 Work Flow

打開Opt Using PythonEquation這個task,另存一個新的task,命名為RSA Using DOE。接著至E欄中將Add Response Surface Approximated optimization component拖曳至F欄

104_work_flow

PythonEquation component剪下貼上至RSA中,並刪除DOE component

105_work_flow

重新連接所有component

106_work_flow

3.3.2 Data Linker

點選C欄 Data Linker,使用左側的Automatically add data to the selected model自動連接。

302_data_linker

3.3.3 Component Editor

點選C欄 Component Editor外層的RSA component,並進行下列操作:

  • 設定xLower Bound-2Upper Bound2
  • 設定yLower Bound-2Upper Bound4
  • 勾選fObjective、不勾選其為Constraint,並確定其Goal維持預設的Minimize
  • 勾選gConstraint,並設定其Lower Bound1.5

203_component_editor

點選C欄 Component Editor外層的RSA component,選擇User DefinedStarting Strategy,使用Import From File讀入 VDOC_02_DOE 中產生的DOE_with_responses.txt,作為DOE點位,而不重新計算。當然,如 3.1 Optimization Using DOE 一樣,可以使用Import From Database來讀入預先計算好的點位。Model Order維持預設的Full Quadratic

3.3.4 Simulation Monitors

點選C欄 Simulation Monitors,新增兩張Optimization最常用的BestObjetiveWrostConstraint來輔助觀察。

402_simulation_monitors

3.3.5 Post processing

505_post_processing

506_post_processing

點選Post Processing中的Show Design Points Table,可以看到總共使用點數為33。也就是說扣掉我們輸入的9個點位,PythonEquation component又被呼叫了33 - 9 =24次。

對比直接進行最佳化Opt Using PythonEquation task48次,次數少了48 - 33 = 15次。

這證明RSA+DOE是一個求解問題的好策略。

507_post_processing

()內為PythonEquation被呼叫次數 x y f g
Opt Using PythonEquation(48) 0.86087 0.87115 -0.26971 1.50000
Opt Using DOE(9) 2.00000 0.29777 -0.07096 4.08891
Opt Using DOE(Verified by PythonEquation)(40) 2.00000 0.29777 -0.07096 4.08891
RSA Using DOE(33) 0.86787 0.86306 -0.26985 1.49966

:mailbox: 4. 聯絡老駱

如果您或貴單位:

  • 有導入VR&D產品的意願,但是有報價、採購及發票等問題。
  • 有教育訓練或顧問需求。
  • 有些建言指教。
  • 想交個朋友。
    歡迎透過 :camel: camel@caeml.ai 聯絡老駱。