nrpa

package
v0.0.0-...-11aa50a Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartPlayoutActor

func StartPlayoutActor(ctx context.Context, t *entities.TSPTW) *playoutActor

Types

type Level

type Level struct {
	Policy            [][]float64
	BestRollout       *Rollout
	LegalMovesPerStep [][]int
}

Data structure for each NRPA recursive call (level)

func (*Level) AdaptPolicy

func (l *Level) AdaptPolicy(policyTmp [][]float64)

Adapt the level policy by increasing the probability of the current BestRollout

type Message

type Message struct {
	Rollout           *Rollout
	LegalMovesPerStep [][]int
}

type NRPA

type NRPA struct {
	NInter              int
	DataPerLevel        []*Level
	StabilizationFactor int
	Levels              int

	StaticData *StaticData
	Actors     []*playoutActor
	// contains filtered or unexported fields
}

func NewNRPA

func NewNRPA(tsptw *entities.TSPTW, config *cli.Config, data *StaticData) *NRPA

func (*NRPA) FindCurrentBest

func (n *NRPA) FindCurrentBest() *Rollout

func (*NRPA) PreAllocate

func (n *NRPA) PreAllocate() [][]float64

func (*NRPA) RunConcurrent

func (n *NRPA) RunConcurrent(ctx context.Context, levels int, t *entities.TSPTW, out chan *Rollout, wg *sync.WaitGroup)

Run Parallel Stable NRPA with actors to compute the leaves

func (*NRPA) StableNRPA

func (n *NRPA) StableNRPA(level int, nLevel *Level, policy [][]float64) *Rollout

type NrpaActor

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

func StartNRPAActor

func StartNRPAActor(ctx context.Context, t *entities.TSPTW) *NrpaActor

func (*NrpaActor) Loop

func (a *NrpaActor) Loop(ctx context.Context)

func (*NrpaActor) RunNRPA

func (a *NrpaActor) RunNRPA(config *cli.Config, chOut chan *Rollout, wg *sync.WaitGroup)

type PlayoutData

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

func NewPlayoutData

func NewPlayoutData(t *entities.TSPTW) *PlayoutData

func (*PlayoutData) Reset

func (d *PlayoutData) Reset()

type Rollout

type Rollout struct {
	Tour     []int
	Length   int
	Score    float64
	Makespan float64

	Violations int
	// contains filtered or unexported fields
}

Data structure for a NRPA Rollout

func NewRollout

func NewRollout(data *PlayoutData) *Rollout

func (*Rollout) Do

func (r *Rollout) Do(policy [][]float64) float64

Do a Rollout for a TSPTW with the given policy

type StaticData

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

func NewStaticData

func NewStaticData(t *entities.TSPTW) *StaticData

Jump to

Keyboard shortcuts

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