algo

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MulanPSL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewK8sStrategy

func NewK8sStrategy(task *Task, providers ...*Provider) *k8sStrategy

Types

type Provider

type Provider struct {
	Pid           int64
	CpuSum        float64
	MemSum        float64
	DiskSum       float64
	CpuCost       float64
	MemCost       float64
	DiskCost      float64
	CpuAvail      float64
	MemAvail      float64
	DiskAvail     float64
	CurReplicas   int
	MaxReplicas   int
	MaxTaskCanRun int     //记录该厂商针对当前可以接收的最大任务数
	TrustDegree   float64 //信任度取值为0到1,默认初始为1
	LearnIndex    float64 //云厂商生产成本的学习指数
	PartWill      float64 //合作意愿
	ProfitSum     float64
	ProfitPerTask map[int]float64
}

func NewProvider

func NewProvider(Pid int64, CpuSum float64, MemSum float64, DiskSum float64, CpuCost float64, MemCost float64, DiskCost float64) *Provider

func (*Provider) GenMaxResourceNum

func (p *Provider) GenMaxResourceNum(t *Task)

type Strategy

type Strategy struct {
	Tasksolution     []int   //对应1种任务分配方案
	Resourcesolution [][]int //有多种资源购买方案
	ValueSum         float64 //记录该参与联盟最大策略的总分值
	Profit           float64 //记录该参与联盟最大策略的利润
	HighDegree       float64 //记录该参与联盟最大策略的高可用度值
}

func NewStrategy

func NewStrategy() *Strategy

type Task

type Task struct {
	Tid              int
	Replicas         int //副本数
	Cpu              float64
	Mem              float64
	Disk             float64
	Time             int //单个副本的运行时间
	T0               int
	T1               int
	Pr               float64 //延迟最低,用户满意度为1时用户的支付价格
	B                int
	MaxscoreStrategy *Strategy
	ResourcePerTask  [][]int //存储调度后每个云厂商的具体占用资源剩余执行时间
}

func NewTask

func NewTask(id int, replicas int, cpu float64, mem float64, disk float64, time int, t0 int, t1 int, Pr float64) *Task

func ScheduleWithFullCollaboration

func ScheduleWithFullCollaboration(strategyService strategyService, ProviderList []*Provider) (*Task, error)

Jump to

Keyboard shortcuts

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