pso

package
v0.0.0-...-66e9391 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const G_BAD_VALUE = 1e100

Variables

This section is empty.

Functions

This section is empty.

Types

type BBPSO

type BBPSO struct {
}

func (*BBPSO) Move

func (s *BBPSO) Move(p *Particle, g, G int)

type Data

type Data struct {
	X     *Vector
	Value float64
}

type FitnessFunc

type FitnessFunc func(v *Vector) (rt float64)

type Particle

type Particle struct {
	X     *Vector
	V     *Vector
	Value float64
	Best  Data

	Swarm *Swarm
}

func NewParticle

func NewParticle(s *Swarm) *Particle

func (*Particle) Check

func (p *Particle) Check()

func (*Particle) MakeBestData

func (p *Particle) MakeBestData() Data

func (*Particle) Move

func (p *Particle) Move(g, G int)

func (*Particle) Run

func (p *Particle) Run(G int)
func (p *Particle) GetOverFlag() bool {
	return atomic.LoadUint32(&p.isOver) > 0
}

func (*Particle) SetX

func (p *Particle) SetX(px *Vector)

type Problem

type Problem interface {
	GetName() string
	GetDim() int
	GetEps() float64
	GetBound(int) (float64, float64) //获取指定维的取值范围
	GetBounds() []Bound
	GetBestValue() float64 //获取理论最优值
	GetPassValue() float64 //获取可接受值
	GetFunValue(x *Vector) float64
}

type ProblemBase

type ProblemBase struct {
	// contains filtered or unexported fields
}

func NewProblemBase

func NewProblemBase(name string, dim int, best, pass, eps float64, fun FitnessFunc, bounds []Bound) *ProblemBase

func (*ProblemBase) GetBestValue

func (p *ProblemBase) GetBestValue() float64

func (*ProblemBase) GetBound

func (p *ProblemBase) GetBound(d int) (float64, float64)

func (*ProblemBase) GetBounds

func (p *ProblemBase) GetBounds() []Bound

func (*ProblemBase) GetDim

func (p *ProblemBase) GetDim() int

func (*ProblemBase) GetEps

func (p *ProblemBase) GetEps() float64

func (*ProblemBase) GetFunValue

func (p *ProblemBase) GetFunValue(x *Vector) float64

func (*ProblemBase) GetName

func (p *ProblemBase) GetName() string

func (*ProblemBase) GetPassValue

func (p *ProblemBase) GetPassValue() float64

type SPSO

type SPSO struct {
}

func (*SPSO) Move

func (s *SPSO) Move(p *Particle, g, G int)

type Strategy

type Strategy interface {
	Move(p *Particle, g, G int)
}

type Swarm

type Swarm struct {
	NP      int    // 群个体总数.
	Best    Data   // 发现的最佳位置
	FEs     uint32 //函数执行总次数
	Problem Problem
	Opt     Strategy

	IsQuick bool
	// contains filtered or unexported fields
}

Publisher

func NewSwarm

func NewSwarm(np int, opt Strategy, p Problem) (rt *Swarm)

func (*Swarm) Check

func (s *Swarm) Check(d Data)

func (*Swarm) GetBestX

func (s *Swarm) GetBestX() *Vector

func (*Swarm) IncFEs

func (s *Swarm) IncFEs()

func (*Swarm) Init

func (s *Swarm) Init()

func (*Swarm) OffsetOfBest

func (s *Swarm) OffsetOfBest(x *Vector) *Vector

func (*Swarm) Run

func (s *Swarm) Run(G int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL