nego

package
v0.0.0-...-406ed31 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecisionMaker

type DecisionMaker struct {
	LeftX    float64
	Width    float64
	Y        float64
	LinearFn geom.LinearFunc
}

func NewDecisionMaker

func NewDecisionMaker(leftX float64, width float64) *DecisionMaker

func (*DecisionMaker) Hit

func (d *DecisionMaker) Hit(c geom.Circle) bool

func (*DecisionMaker) Left

func (d *DecisionMaker) Left() geom.PointF

func (*DecisionMaker) Right

func (d *DecisionMaker) Right() geom.PointF

func (*DecisionMaker) Update

func (d *DecisionMaker) Update(xCenter float64)

type Equip

type Equip struct {
	Name           string
	ImprovedCount  int
	ImprovedByNext bool
	ImprovedByPrev bool
}

func (Equip) CalcedImprovedCount

func (e Equip) CalcedImprovedCount() int

type Manager

type Manager struct {
	Name       string
	Processors []ProposalProcessor
}

func NewManager

func NewManager(name string, processors ...ProposalProcessor) *Manager

func (*Manager) Process

func (m *Manager) Process(proposal *Proposal)

type Negotiation

type Negotiation struct {
	Size               geom.PointF
	DecisionMaker      *DecisionMaker
	VendorSelector     *VendorSelector
	LastSelectedVendor *Vendor
	Managers           []*Manager
	Money              int
	ProposalDelay      *Proposal
	Proposals          []*Proposal
	ApprovedEquips     []*Equip
}

func (*Negotiation) End

func (n *Negotiation) End() bool

func (*Negotiation) ManagerXLeftRight

func (n *Negotiation) ManagerXLeftRight(idx int) (l, r float64)

func (*Negotiation) ManagerY

func (n *Negotiation) ManagerY() float64

func (*Negotiation) ProposalStartPosition

func (n *Negotiation) ProposalStartPosition(idx int) geom.PointF

func (*Negotiation) Reset

func (n *Negotiation) Reset(money int)

func (*Negotiation) UpdateDecisionMaker

func (n *Negotiation) UpdateDecisionMaker(decisionMakerX float64)

func (*Negotiation) UpdateOthers

func (n *Negotiation) UpdateOthers()

type Proposal

type Proposal struct {
	Equip           *Equip
	Cost            int
	Hit             geom.Circle
	Velocity        geom.PointF
	Rotate          float64
	RotateVelocity  float64
	CustomImageName string
}

func (*Proposal) AddRotateVelocity

func (p *Proposal) AddRotateVelocity(v float64)

func (*Proposal) BoundBottom

func (p *Proposal) BoundBottom(y float64)

func (*Proposal) BoundLeft

func (p *Proposal) BoundLeft(x float64)

func (*Proposal) BoundRight

func (p *Proposal) BoundRight(x float64)

func (*Proposal) BoundTop

func (p *Proposal) BoundTop(y float64)

func (*Proposal) Clone

func (p *Proposal) Clone() *Proposal

func (*Proposal) ImageName

func (p *Proposal) ImageName() string

func (*Proposal) MultiplyVelocity

func (p *Proposal) MultiplyVelocity(v float64)

func (*Proposal) Update

func (p *Proposal) Update()

type ProposalProcessor

type ProposalProcessor interface {
	Process(proposal *Proposal)
}

type ProposalProcessorAccelerate

type ProposalProcessorAccelerate struct {
	Value float64
}

func (*ProposalProcessorAccelerate) Process

func (p *ProposalProcessorAccelerate) Process(proposal *Proposal)

type ProposalProcessorCustomImageName

type ProposalProcessorCustomImageName struct {
	ImageName string
}

func (*ProposalProcessorCustomImageName) Process

func (p *ProposalProcessorCustomImageName) Process(proposal *Proposal)

type ProposalProcessorImprove

type ProposalProcessorImprove struct {
}

func (*ProposalProcessorImprove) Process

func (p *ProposalProcessorImprove) Process(proposal *Proposal)

type ProposalProcessorReduceCost

type ProposalProcessorReduceCost struct {
	Multiplier float64
}

func (*ProposalProcessorReduceCost) Process

func (p *ProposalProcessorReduceCost) Process(proposal *Proposal)

type ProposalProcessorRotate

type ProposalProcessorRotate struct {
	Value float64
}

func (*ProposalProcessorRotate) Process

func (p *ProposalProcessorRotate) Process(proposal *Proposal)

type ProposalProcessorStopRotate

type ProposalProcessorStopRotate struct {
}

func (*ProposalProcessorStopRotate) Process

func (p *ProposalProcessorStopRotate) Process(proposal *Proposal)

type Vendor

type Vendor struct {
	Name string
	// contains filtered or unexported fields
}

func NewVendor

func NewVendor(name string, proposals []*Proposal, rnd *rand.Rand) *Vendor

func (*Vendor) Propose

func (v *Vendor) Propose(pos geom.PointF) *Proposal

type VendorSelector

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

func NewVendorSelector

func NewVendorSelector(vendors []*Vendor, interval int, rnd *rand.Rand) *VendorSelector

func (*VendorSelector) IndexOf

func (s *VendorSelector) IndexOf(vendor *Vendor) int

func (*VendorSelector) Reset

func (s *VendorSelector) Reset()

func (*VendorSelector) Update

func (s *VendorSelector) Update() (*Vendor, bool)

func (*VendorSelector) Vendors

func (s *VendorSelector) Vendors() []*Vendor

Jump to

Keyboard shortcuts

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