青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

eryar

PipeCAD - Plant Piping Design Software.
PlantAssistant - Translate AVEVA RVM/SP3D VUE to glTF, STEP, etc.
posts - 606, comments - 590, trackbacks - 0, articles - 0

Use PSO to find minimum in OpenCASCADE

Posted on 2017-04-18 22:51 eryar 閱讀(1345) 評論(0)  編輯 收藏 引用 所屬分類: 2.OpenCASCADE

Use PSO to find minimum in OpenCASCADE

eryar@163.com

Abstract. Starting from OCCT6.8.0 will include one more algorithm for solving global optimization problems. Its development has been triggered by insufficient performance and robustness of existing algorithm of minimization of curve-surface distance in Extrema package. The PSO, Algorithms in this family are stochastic, and this feature can be perceived as opposite to robustness. However, we found it was not only much faster than original deterministic one, but also more robust in complex real-world situations. In particular, it has been able to find solution in situations like tangential or degenerated geometries where deterministic algorithms work poor and require extensive oversampling for robust results. The paper mainly focus on the usage and applications of the PSO algorithm.

Key Words. PSO, Particle Swarm Optimization, Minimization

1.Introduction

粒子群優(yōu)化(Particle Swarm Optimization, PSO)算法是Kennedy和Eberhart受人工生命研究結(jié)果的啟發(fā)、通過模擬鳥群覓食過程中的遷徙和群聚行為而提出的一種基于群體智能的全局隨機(jī)搜索算法,自然界中各種生物體均具有一定的群體行為,而人工生命的主要研究領(lǐng)域之一是探索自然界生物的群體行為,從而在計算機(jī)上構(gòu)建其群體模型。自然界中的鳥群和魚群的群體行為一直是科學(xué)家的研究興趣,生物學(xué)家Craig Reynolds在1987年提出了一個非常有影響的鳥群聚集模型,在他的仿真中,每一個個體遵循:

      (1) 避免與鄰域個體相沖撞;

      (2) 匹配鄰域個體的速度;

      (3) 飛向鳥群中心,且整個群體飛向目標(biāo)。

仿真中僅利用上面三條簡單的規(guī)則,就可以非常接近的模擬出鳥群飛行的現(xiàn)象。1995年,美國社會心理學(xué)家James Kennedy和電氣工程師Russell Eberhart共同提出了粒子群算法,其基本思想是受對鳥類群體行為進(jìn)行建模與仿真的研究結(jié)果的啟發(fā)。他們的模型和仿真算法主要對Frank Heppner的模型進(jìn)行了修正,以使粒子飛向解空間并在最好解處降落。Kennedy在他的書中描述了粒子群算法思想的起源。

粒子群優(yōu)化由于其算法簡單,易于實現(xiàn),無需梯度信息,參數(shù)少等特點在連續(xù)優(yōu)化問題和離散問題中都表現(xiàn)出良好的效果,特別是因為其天然的實數(shù)編碼特點適合處理實優(yōu)化問題。近年來成為國際上智能優(yōu)化領(lǐng)域研究的熱點。PSO算法最早應(yīng)用于非線性連續(xù)函數(shù)的優(yōu)化和神經(jīng)元網(wǎng)絡(luò)的訓(xùn)練,后來也被用于解決約束優(yōu)化問題、多目標(biāo)優(yōu)化問題,動態(tài)優(yōu)化問題等。

在OpenCASCADE中很多問題可以歸結(jié)為非線性連續(xù)函數(shù)的優(yōu)化問題,如求極值的包中計算曲線和曲面之間的極值點,或曲線與曲線間的極值點等問題。本文主要關(guān)注OpenCASCADE中PSO的用法,在理解其用法的基礎(chǔ)上再來理解其他相關(guān)的應(yīng)用。

2. PSO Usage

為了提高程序的性能及穩(wěn)定性,OpenCASCADE引入了智能化的算法PSO(Particle Swarm Optimization),相關(guān)的類為math_PSO,其類聲明的代碼如下:


//! In this class implemented variation of Particle Swarm Optimization (PSO) method.
//! A. Ismael F. Vaz, L. N. Vicente 
//! "A particle swarm pattern search method for bound constrained global optimization"
//!
//! Algorithm description:
//! Init Section:
//! At start of computation a number of "particles" are placed in the search space.
//! Each particle is assigned a random velocity.
//!
//! Computational loop:
//! The particles are moved in cycle, simulating some "social" behavior, so that new position of
//! a particle on each step depends not only on its velocity and previous path, but also on the
//! position of the best particle in the pool and best obtained position for current particle.
//! The velocity of the particles is decreased on each step, so that convergence is guaranteed.
//!
//! Algorithm output:
//! Best point in param space (position of the best particle) and value of objective function.
//!
//! Pros:
//! One of the fastest algorithms.
//! Work over functions with a lot local extremums.
//! Does not require calculation of derivatives of the functional.
//!
//! Cons:
//! Convergence to global minimum not proved, which is a typical drawback for all stochastic algorithms.
//! The result depends on random number generator.
//!
//! Warning: PSO is effective to walk into optimum surrounding, not to get strict optimum.
//! Run local optimization from pso output point.
//! Warning: In PSO used fixed seed in RNG, so results are reproducible.

class math_PSO
{
public:

  /**
  * Constructor.
  *
  * @param theFunc defines the objective function. It should exist during all lifetime of class instance.
  * @param theLowBorder defines lower border of search space.
  * @param theUppBorder defines upper border of search space.
  * @param theSteps defines steps of regular grid, used for particle generation.
                    This parameter used to define stop condition (TerminalVelocity).
  * @param theNbParticles defines number of particles.
  * @param theNbIter defines maximum number of iterations.
  
*/
  Standard_EXPORT math_PSO(math_MultipleVarFunction* theFunc,
                           const math_Vector& theLowBorder,
                           const math_Vector& theUppBorder,
                           const math_Vector& theSteps,
                           const Standard_Integer theNbParticles = 32,
                           const Standard_Integer theNbIter = 100);

  //! Perform computations, particles array is constructed inside of this function.
  Standard_EXPORT void Perform(const math_Vector& theSteps,
                               Standard_Real& theValue,
                               math_Vector& theOutPnt,
                               const Standard_Integer theNbIter = 100);

  //! Perform computations with given particles array.
  Standard_EXPORT void Perform(math_PSOParticlesPool& theParticles,
                               Standard_Integer theNbParticles,
                               Standard_Real& theValue,
                               math_Vector& theOutPnt,
                               const Standard_Integer theNbIter = 100);

private:

  void performPSOWithGivenParticles(math_PSOParticlesPool& theParticles,
                                    Standard_Integer theNbParticles,
                                    Standard_Real& theValue,
                                    math_Vector& theOutPnt,
                                    const Standard_Integer theNbIter = 100);

  math_MultipleVarFunction *myFunc;
  math_Vector myLowBorder; // Lower border.
  math_Vector myUppBorder; // Upper border.
  math_Vector mySteps; // steps used in PSO algorithm.
  Standard_Integer myN; // Dimension count.
  Standard_Integer myNbParticles; // Particles number.
  Standard_Integer myNbIter;
};

math_PSO的輸入主要為:求極小值的多元函數(shù)math_MultipleVarFunction,各個自變量的取值范圍。下面通過一個具體的例子來說明如何將數(shù)學(xué)問題轉(zhuǎn)換成代碼,利用程序來求解。在《最優(yōu)化方法》中找到如下例題:

wps266B.tmp

實現(xiàn)代碼如下所示:

/*
Copyright(C) 2017 Shing Liu(eryar@163.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

// NOTE
// ----
// Tool: Visual Studio 2013 & OpenCASCADE7.1.0
// Date: 2017-04-18  20:52 

#include <math_PSO.hxx>

#pragma comment(lib, "TKernel.lib")
#pragma comment(lib, "TKMath.lib")

// define function:
// f(x) = x1 - x2 + 2x1^2 + 2x1x2 + x2^2
class TestFunction : public math_MultipleVarFunction
{
public:
    virtual Standard_Integer NbVariables() const
    {
        return 2;
    }

    virtual Standard_Boolean Value(const math_Vector& X, Standard_Real& F)
    {
        F = X(1) - X(2) + 2.0 * X(1) * X(1) + 2.0 * X(1) * X(2) + X(2) * X(2);

        return Standard_True;
    }

};


void test()
{
    TestFunction aFunction;
    math_Vector aLowerBorder(1, aFunction.NbVariables());
    math_Vector aUpperBorder(1, aFunction.NbVariables());
    math_Vector aSteps(1, aFunction.NbVariables());

    aLowerBorder(1) = -10.0;
    aLowerBorder(2) = -10.0;

    aUpperBorder(1) = 10.0;
    aUpperBorder(2) = 10.0;

    aSteps(1) = 0.1;
    aSteps(2) = 0.1;

    Standard_Real aValue = 0.0;
    math_Vector aOutput(1, aFunction.NbVariables());

    math_PSO aPso(&aFunction, aLowerBorder, aUpperBorder, aSteps);
    aPso.Perform(aSteps, aValue, aOutput);

    std::cout << "Minimum value: " << aValue << " at (" << aOutput(1) << ", " << aOutput(2) << ")" << std::endl;

}

int main(int argc, char* argv[])
{
    test();

    return 0;
}

計算結(jié)果為最小值-1.25, 在x1=-1,x2=1.50013處取得,如下圖所示:

wps267B.tmp

3.Applications

計算曲線和曲面之間的極值,也是一個計算多元函數(shù)的極值問題。對應(yīng)的類為Extrema_GenExtCS。

4.Conclusion

常見的優(yōu)化算法如共軛梯度法、Netwon-Raphson法(math_NewtonMinimum),F(xiàn)letcher-Reeves法(math_FRPR)、Broyden-Fletcher-Glodfarb-Shanno法(math_BFGS)等都是局部優(yōu)化方法,所有這些局部優(yōu)化方法都是針對無約束優(yōu)化問題提出的,而且對目標(biāo)函數(shù)均有一定的解析性要求,如Newton-Raphson要求目標(biāo)函數(shù)連續(xù)可微,同時要求其一階導(dǎo)數(shù)連續(xù)。OpenCASCADE中的math_NewtonMinimu中還要求多元函數(shù)具有Hessian矩陣,即二階導(dǎo)數(shù)連續(xù)。

隨著現(xiàn)科學(xué)技術(shù)的不斷發(fā)展和多學(xué)科的相互交叉與滲透,很多實際工程優(yōu)化問題不僅需要大量的復(fù)雜科學(xué)計算,而且對算法的實時性要求也特別高,這些復(fù)雜優(yōu)化問題通常具有以下特點:

1) 優(yōu)化問題的對象涉及很多因素,導(dǎo)致優(yōu)化問題的目標(biāo)函數(shù)的自變量維數(shù)很多,通常達(dá)到數(shù)百維甚至上萬維,使得求解問題的計算量大大增加;

2) 優(yōu)化問題本身的復(fù)雜性導(dǎo)致目標(biāo)函數(shù)是非線性,同時由于有些目標(biāo)函數(shù)具有不可導(dǎo),不連續(xù)、極端情況下甚至函數(shù)本身不能解析的表達(dá);如曲線或曲面退化導(dǎo)致的尖點或退化點的不連續(xù)情況;

3) 目標(biāo)函數(shù)在定義域內(nèi)具有多個甚至無數(shù)個極值點,函數(shù)的解空間形狀復(fù)雜。

當(dāng)以上三個因素中一個或幾個出現(xiàn)在優(yōu)化問題中時,將會極大地增加優(yōu)化問題求解的困難程度,單純地基于解析確定性的優(yōu)化方法很難奏效,因此必須結(jié)合其他方法來解決這些問題。

PSO算法簡單,易于實現(xiàn)且不需要目標(biāo)函數(shù)的梯度(一階可導(dǎo))和Hassian矩陣(二階可導(dǎo)),速度快,性能高。但是PSO也有不足之處,這是許多智能算法的共性,即只能找到滿足條件的解,這個解不能確定為精確解。

5.References

1. aml. Application of stohastic algorithms in extrema. https://dev.opencascade.org/index.php?q=node/988

2. 何堅勇. 最優(yōu)化方法. 清華大學(xué)出版社. 2007

3. 沈顯君. 自適應(yīng)粒子群優(yōu)化算法及其應(yīng)用. 清華大學(xué)出版社. 2015

4. 汪定偉, 王俊偉, 王洪峰, 張瑞友, 郭哲. 智能優(yōu)化方法. 高等教育出版社. 2007

 

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            欧美日韩精品一区| 亚洲一区二区免费在线| 在线亚洲欧美专区二区| 樱桃国产成人精品视频| 亚洲自拍另类| 亚洲午夜伦理| 欧美精品不卡| 欧美福利电影在线观看| 国产一区二区av| 亚洲天天影视| 一区二区国产日产| 欧美高清视频一二三区| 麻豆精品传媒视频| 国产日韩欧美一二三区| 亚洲午夜免费福利视频| 亚洲先锋成人| 欧美日韩第一区日日骚| 亚洲激情社区| 91久久精品美女| 裸体丰满少妇做受久久99精品 | 一区二区三区四区国产精品| 久久嫩草精品久久久精品一| 久久久久9999亚洲精品| 国产日韩欧美视频在线| 亚洲欧美日韩国产另类专区| 亚洲欧美国产精品va在线观看| 欧美国产一区在线| 91久久夜色精品国产网站| 91久久精品日日躁夜夜躁欧美| 巨胸喷奶水www久久久免费动漫| 久久免费视频在线观看| 在线播放日韩专区| 免费成人黄色av| 亚洲国产高清一区二区三区| 亚洲精品无人区| 欧美黑人多人双交| 日韩视频一区二区三区| 亚洲在线视频| 国产一区二区三区在线观看视频| 欧美一区在线视频| 免费久久精品视频| 日韩午夜免费视频| 国产精品嫩草久久久久| 久久丁香综合五月国产三级网站| 久久亚裔精品欧美| 亚洲日本欧美日韩高观看| 欧美激情视频给我| 在线视频中文亚洲| 久久综合伊人77777| 亚洲日本中文字幕区| 欧美三级乱码| 午夜精品福利电影| 欧美国产综合| 国产精品99久久久久久人| 国产欧美日韩综合| 麻豆国产精品777777在线| 亚洲精品少妇| 久久亚洲二区| 一本到12不卡视频在线dvd| 国产精品女主播在线观看| 久久精品91久久香蕉加勒比 | 亚洲欧美伊人| 蜜臀91精品一区二区三区| 亚洲美女淫视频| 国产亚洲一区精品| 欧美成人免费在线观看| 亚洲综合色在线| 亚洲国产另类精品专区| 欧美资源在线观看| aa级大片欧美三级| 好吊一区二区三区| 欧美午夜片欧美片在线观看| 久久久久久久尹人综合网亚洲 | 亚洲第一级黄色片| 欧美在线视频免费| 一区二区三区高清视频在线观看| 韩国女主播一区二区三区| 欧美日韩精品不卡| 久久中文精品| 性久久久久久久久久久久| 亚洲精品一品区二品区三品区| 久久久久国产精品厨房| 亚洲免费一在线| 亚洲精品护士| 在线成人av| 国产一区二区在线免费观看 | 亚洲性视频h| 亚洲欧洲精品一区二区三区波多野1战4| 午夜精品福利一区二区三区av| 亚洲国产日韩欧美在线图片| 国产欧美在线视频| 国产精品久久久久久户外露出| 欧美sm极限捆绑bd| 久久久天天操| 久久成人国产| 午夜精品999| 亚洲一区欧美激情| 99天天综合性| 亚洲精选视频免费看| 欧美高清hd18日本| 美日韩精品视频| 久久久www成人免费毛片麻豆| 亚洲欧美日韩一区二区三区在线| 亚洲最黄网站| 夜夜夜精品看看| 一区二区三区视频在线播放| 亚洲伦伦在线| 一本大道久久精品懂色aⅴ| 亚洲伦理在线观看| 日韩午夜电影在线观看| 日韩亚洲视频| 一本一本久久a久久精品综合妖精| 最近看过的日韩成人| 亚洲成色www8888| 亚洲国产99精品国自产| 亚洲国产精品成人va在线观看| 黑人操亚洲美女惩罚| 韩国三级在线一区| 精品动漫3d一区二区三区| 一区精品在线播放| 亚洲观看高清完整版在线观看| 亚洲国产精品久久| 亚洲毛片在线看| 一卡二卡3卡四卡高清精品视频| 一区二区三区产品免费精品久久75| 中文国产成人精品| 性久久久久久久久| 久久免费国产精品1| 欧美国产第一页| 99精品热视频| 欧美一区国产二区| 欧美77777| 欧美丝袜第一区| 国产原创一区二区| 亚洲精品欧洲| 欧美一级午夜免费电影| 久久躁狠狠躁夜夜爽| 欧美韩日亚洲| 亚洲天堂偷拍| 另类亚洲自拍| 国产精品高清免费在线观看| 国内精品伊人久久久久av影院 | 性18欧美另类| 欧美成人日韩| 国产精品一级| 亚洲激情啪啪| 午夜精品理论片| 欧美不卡三区| 亚洲午夜国产一区99re久久| 久久一综合视频| 欧美日韩中文| 激情欧美丁香| 亚洲欧美日韩精品在线| 欧美国产精品人人做人人爱| 一区二区三区四区在线| 久久精品国产综合精品| 欧美日本一区二区三区 | 日韩一二在线观看| 久久精品视频免费| 一本久道综合久久精品| 开心色5月久久精品| 国产欧美一区二区精品仙草咪| 亚洲精品国产精品乱码不99| 久久成人精品无人区| 亚洲黑丝在线| 久久久久久久网| 国产精品视频你懂的| 在线亚洲一区| 亚洲高清不卡| 久久久久久有精品国产| 国产农村妇女毛片精品久久莱园子| 日韩午夜三级在线| 欧美国产免费| 久久精品视频在线| 国产麻豆91精品| 亚洲免费在线电影| 最新精品在线| 美女视频网站黄色亚洲| 韩国精品一区二区三区| 久久精品二区| 性欧美1819sex性高清| 国产精品色网| 亚洲欧美激情视频| 99精品国产福利在线观看免费| 欧美精品三级在线观看| 最新亚洲视频| 欧美激情日韩| 欧美大片免费观看在线观看网站推荐| 国产亚洲欧美aaaa| 久久精品水蜜桃av综合天堂| 亚洲少妇中出一区| 欧美午夜国产| 亚洲在线免费视频| 亚洲图中文字幕| 国产精品日本一区二区| 午夜在线一区| 香蕉久久夜色精品国产| 国产婷婷一区二区| 久久午夜电影网| 六月丁香综合|