📄 schemegenerate.frm
字号:
VERSION 5.00
Begin VB.Form SchemeGenerate
Caption = "SchemeGenerate"
ClientHeight = 2850
ClientLeft = 60
ClientTop = 345
ClientWidth = 3735
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 2850
ScaleWidth = 3735
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command3
Caption = "初始化Agent2策略集"
Height = 615
Left = 720
TabIndex = 2
Top = 1920
Width = 2175
End
Begin VB.CommandButton Command2
Caption = "初始化Agent1策略集"
Height = 615
Left = 720
TabIndex = 1
Top = 1080
Width = 2175
End
Begin VB.CommandButton Command1
Caption = "初始化Agent样本集"
Height = 615
Left = 720
TabIndex = 0
Top = 240
Width = 2175
End
End
Attribute VB_Name = "SchemeGenerate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'生成报价方案样本集
Sub Generation(strTargetFile As String)
Dim filenum As Integer
Dim tmpDemData As String
'x1表示价格,x2,表示供货时间,x3,表示保修期,u1表示方案的效用
Dim Agent1x1, Agent1x2, Agent1x3, Agent2x1, Agent2x2, Agent2x3, u1, u2, Agent1y1, Agent2y1
Dim i As Integer
filenum = FreeFile
If Dir(strTargetFile, vbNormal) <> "" Then
Kill strTargetFile
End If
Open strTargetFile For Append As #filenum
'price表示随机出的价格
'y1表示不同价格的打分
Dim price
Randomize
For i = 1 To 20
tmpDemData = ""
price = Int((251 * Rnd) + 1000)
Agent1y1 = ((price - 1150) * (price - 1250) * 0.2 / 37500) - ((price - 1000) * (price - 1250) * 0.65 / 15000) + ((price - 1000) * (price - 1150) / 25000)
Agent2y1 = ((price - 1150) * (price - 1250) * 1 / 37500) - ((price - 1000) * (price - 1250) * 0.8 / 15000) + ((price - 1000) * (price - 1150) * 0.5 / 25000)
Agent1x1 = CInt(Agent1y1 * 1000) / 1000
Agent1x2 = 0.75
Agent1x3 = 1
u1 = Agent1x1 * 0.4 + Agent1x2 * 0.22 + Agent1x3 * 0.38
Agent2x1 = CInt(Agent2y1 * 1000) / 1000
Agent2x2 = 1
Agent2x3 = 0.4
u2 = Agent2x1 * 0.25 + Agent2x2 * 0.4 + Agent2x3 * 0.35
temDemData = CStr(CStr(Agent1x1) + "," + CStr(Agent1x2) + "," + CStr(Agent1x3) + "," + CStr(Agent2x1) + "," + CStr(Agent2x2) + "," + CStr(Agent2x3) + "," + CStr(u1) + "," + CStr(u2))
'输出当前方案到文本文件
Print #filenum, temDemData
Next
For i = 1 To 20
tmpDemData = ""
price = Int((251 * Rnd) + 1000)
Agent1y1 = ((price - 1150) * (price - 1250) * 0.2 / 37500) - ((price - 1000) * (price - 1250) * 0.65 / 15000) + ((price - 1000) * (price - 1150) / 25000)
Agent2y1 = ((price - 1150) * (price - 1250) * 1 / 37500) - ((price - 1000) * (price - 1250) * 0.8 / 15000) + ((price - 1000) * (price - 1150) * 0.5 / 25000)
Agent1x1 = CInt(Agent1y1 * 1000) / 1000
Agent1x2 = 0.75
Agent1x3 = 0.5
u1 = Agent1x1 * 0.4 + Agent1x2 * 0.22 + Agent1x3 * 0.38
Agent2x1 = CInt(Agent2y1 * 1000) / 1000
Agent2x2 = 1
Agent2x3 = 0.7
u2 = Agent2x1 * 0.25 + Agent2x2 * 0.4 + Agent2x3 * 0.35
temDemData = CStr(CStr(Agent1x1) + "," + CStr(Agent1x2) + "," + CStr(Agent1x3) + "," + CStr(Agent2x1) + "," + CStr(Agent2x2) + "," + CStr(Agent2x3) + "," + CStr(u1) + "," + CStr(u2))
'输出当前方案到文本文件
Print #filenum, temDemData
Next
For i = 1 To 20
tmpDemData = ""
price = Int((251 * Rnd) + 1000)
Agent1y1 = ((price - 1150) * (price - 1250) * 0.2 / 37500) - ((price - 1000) * (price - 1250) * 0.65 / 15000) + ((price - 1000) * (price - 1150) / 25000)
Agent2y1 = ((price - 1150) * (price - 1250) * 1 / 37500) - ((price - 1000) * (price - 1250) * 0.8 / 15000) + ((price - 1000) * (price - 1150) * 0.5 / 25000)
Agent1x1 = CInt(Agent1y1 * 1000) / 1000
Agent1x2 = 0.75
Agent1x3 = 0.35
u1 = Agent1x1 * 0.4 + Agent1x2 * 0.22 + Agent1x3 * 0.38
Agent2x1 = CInt(Agent2y1 * 1000) / 1000
Agent2x2 = 1
Agent2x3 = 1
u2 = Agent2x1 * 0.25 + Agent2x2 * 0.4 + Agent2x3 * 0.35
temDemData = CStr(CStr(Agent1x1) + "," + CStr(Agent1x2) + "," + CStr(Agent1x3) + "," + CStr(Agent2x1) + "," + CStr(Agent2x2) + "," + CStr(Agent2x3) + "," + CStr(u1) + "," + CStr(u2))
'输出当前方案到文本文件
Print #filenum, temDemData
Next
For i = 1 To 20
tmpDemData = ""
price = Int((251 * Rnd) + 1000)
Agent1y1 = ((price - 1150) * (price - 1250) * 0.2 / 37500) - ((price - 1000) * (price - 1250) * 0.65 / 15000) + ((price - 1000) * (price - 1150) / 25000)
Agent2y1 = ((price - 1150) * (price - 1250) * 1 / 37500) - ((price - 1000) * (price - 1250) * 0.8 / 15000) + ((price - 1000) * (price - 1150) * 0.5 / 25000)
Agent1x1 = CInt(Agent1y1 * 1000) / 1000
Agent1x2 = 0.85
Agent1x3 = 1
u1 = Agent1x1 * 0.4 + Agent1x2 * 0.22 + Agent1x3 * 0.38
Agent2x1 = CInt(Agent2y1 * 1000) / 1000
Agent2x2 = 0.6
Agent2x3 = 0.4
u2 = Agent2x1 * 0.25 + Agent2x2 * 0.4 + Agent2x3 * 0.35
temDemData = CStr(CStr(Agent1x1) + "," + CStr(Agent1x2) + "," + CStr(Agent1x3) + "," + CStr(Agent2x1) + "," + CStr(Agent2x2) + "," + CStr(Agent2x3) + "," + CStr(u1) + "," + CStr(u2))
'输出当前方案到文本文件
Print #filenum, temDemData
Next
For i = 1 To 20
tmpDemData = ""
price = Int((251 * Rnd) + 1000)
Agent1y1 = ((price - 1150) * (price - 1250) * 0.2 / 37500) - ((price - 1000) * (price - 1250) * 0.65 / 15000) + ((price - 1000) * (price - 1150) / 25000)
Agent2y1 = ((price - 1150) * (price - 1250) * 1 / 37500) - ((price - 1000) * (price - 1250) * 0.8 / 15000) + ((price - 1000) * (price - 1150) * 0.5 / 25000)
Agent1x1 = CInt(Agent1y1 * 1000) / 1000
Agent1x2 = 0.85
Agent1x3 = 0.5
u1 = Agent1x1 * 0.4 + Agent1x2 * 0.22 + Agent1x3 * 0.38
Agent2x1 = CInt(Agent2y1 * 1000) / 1000
Agent2x2 = 0.6
Agent2x3 = 0.7
u2 = Agent2x1 * 0.25 + Agent2x2 * 0.4 + Agent2x3 * 0.35
temDemData = CStr(CStr(Agent1x1) + "," + CStr(Agent1x2) + "," + CStr(Agent1x3) + "," + CStr(Agent2x1) + "," + CStr(Agent2x2) + "," + CStr(Agent2x3) + "," + CStr(u1) + "," + CStr(u2))
'输出当前方案到文本文件
Print #filenum, temDemData
Next
For i = 1 To 20
tmpDemData = ""
price = Int((251 * Rnd) + 1000)
Agent1y1 = ((price - 1150) * (price - 1250) * 0.2 / 37500) - ((price - 1000) * (price - 1250) * 0.65 / 15000) + ((price - 1000) * (price - 1150) / 25000)
Agent2y1 = ((price - 1150) * (price - 1250) * 1 / 37500) - ((price - 1000) * (price - 1250) * 0.8 / 15000) + ((price - 1000) * (price - 1150) * 0.5 / 25000)
Agent1x1 = CInt(Agent1y1 * 1000) / 1000
Agent1x2 = 0.85
Agent1x3 = 0.35
u1 = Agent1x1 * 0.4 + Agent1x2 * 0.22 + Agent1x3 * 0.38
Agent2x1 = CInt(Agent2y1 * 1000) / 1000
Agent2x2 = 0.6
Agent2x3 = 1
u2 = Agent2x1 * 0.25 + Agent2x2 * 0.4 + Agent2x3 * 0.35
temDemData = CStr(CStr(Agent1x1) + "," + CStr(Agent1x2) + "," + CStr(Agent1x3) + "," + CStr(Agent2x1) + "," + CStr(Agent2x2) + "," + CStr(Agent2x3) + "," + CStr(u1) + "," + CStr(u2))
'输出当前方案到文本文件
Print #filenum, temDemData
Next
For i = 1 To 20
tmpDemData = ""
price = Int((251 * Rnd) + 1000)
Agent1y1 = ((price - 1150) * (price - 1250) * 0.2 / 37500) - ((price - 1000) * (price - 1250) * 0.65 / 15000) + ((price - 1000) * (price - 1150) / 25000)
Agent2y1 = ((price - 1150) * (price - 1250) * 1 / 37500) - ((price - 1000) * (price - 1250) * 0.8 / 15000) + ((price - 1000) * (price - 1150) * 0.5 / 25000)
Agent1x1 = CInt(Agent1y1 * 1000) / 1000
Agent1x2 = 1
Agent1x3 = 1
u1 = Agent1x1 * 0.4 + Agent1x2 * 0.22 + Agent1x3 * 0.38
Agent2x1 = CInt(Agent2y1 * 1000) / 1000
Agent2x2 = 0
Agent2x3 = 0.4
u2 = Agent2x1 * 0.25 + Agent2x2 * 0.4 + Agent2x3 * 0.35
temDemData = CStr(CStr(Agent1x1) + "," + CStr(Agent1x2) + "," + CStr(Agent1x3) + "," + CStr(Agent2x1) + "," + CStr(Agent2x2) + "," + CStr(Agent2x3) + "," + CStr(u1) + "," + CStr(u2))
'输出当前方案到文本文件
Print #filenum, temDemData
Next
For i = 1 To 20
tmpDemData = ""
price = Int((251 * Rnd) + 1000)
Agent1y1 = ((price - 1150) * (price - 1250) * 0.2 / 37500) - ((price - 1000) * (price - 1250) * 0.65 / 15000) + ((price - 1000) * (price - 1150) / 25000)
Agent2y1 = ((price - 1150) * (price - 1250) * 1 / 37500) - ((price - 1000) * (price - 1250) * 0.8 / 15000) + ((price - 1000) * (price - 1150) * 0.5 / 25000)
Agent1x1 = CInt(Agent1y1 * 1000) / 1000
Agent1x2 = 1
Agent1x3 = 0.5
u1 = Agent1x1 * 0.4 + Agent1x2 * 0.22 + Agent1x3 * 0.38
Agent2x1 = CInt(Agent2y1 * 1000) / 1000
Agent2x2 = 0
Agent2x3 = 0.7
u2 = Agent2x1 * 0.25 + Agent2x2 * 0.4 + Agent2x3 * 0.35
temDemData = CStr(CStr(Agent1x1) + "," + CStr(Agent1x2) + "," + CStr(Agent1x3) + "," + CStr(Agent2x1) + "," + CStr(Agent2x2) + "," + CStr(Agent2x3) + "," + CStr(u1) + "," + CStr(u2))
'输出当前方案到文本文件
Print #filenum, temDemData
Next
For i = 1 To 20
tmpDemData = ""
price = Int((251 * Rnd) + 1000)
Agent1y1 = ((price - 1150) * (price - 1250) * 0.2 / 37500) - ((price - 1000) * (price - 1250) * 0.65 / 15000) + ((price - 1000) * (price - 1150) / 25000)
Agent2y1 = ((price - 1150) * (price - 1250) * 1 / 37500) - ((price - 1000) * (price - 1250) * 0.8 / 15000) + ((price - 1000) * (price - 1150) * 0.5 / 25000)
Agent1x1 = CInt(Agent1y1 * 1000) / 1000
Agent1x2 = 1
Agent1x3 = 0.35
u1 = Agent1x1 * 0.4 + Agent1x2 * 0.22 + Agent1x3 * 0.38
Agent2x1 = CInt(Agent2y1 * 1000) / 1000
Agent2x2 = 0
Agent2x3 = 1
u2 = Agent2x1 * 0.25 + Agent2x2 * 0.4 + Agent2x3 * 0.35
temDemData = CStr(CStr(Agent1x1) + "," + CStr(Agent1x2) + "," + CStr(Agent1x3) + "," + CStr(Agent2x1) + "," + CStr(Agent2x2) + "," + CStr(Agent2x3) + "," + CStr(u1) + "," + CStr(u2))
'输出当前方案到文本文件
Print #filenum, temDemData
Next
Close #filenum
MsgBox "Agent报价方案初始化完毕!"
End Sub
Private Sub Command1_Click()
Generation "d:\BargainPro\Initialization\SchemeData.txt"
End Sub
'生成Agent1策略样本集
Sub GenerateAgent1Policy(strAgent1TargetFile As String)
Dim filenum As Integer
Dim tmpDemData As String
Dim x1, x2, x3, y1, y2, y3
Dim i As Integer
filenum = FreeFile
If Dir(strAgent1TargetFile, vbNormal) <> "" Then
Kill strAgent1TargetFile
End If
Open strAgent1TargetFile For Append As #filenum
temDemData = ""
temDemData = "x1" + "," + "x2" + "," + "x3"
Print #filenum, temDemData
Close #filenum
Open strAgent1TargetFile For Append As #filenum
For i = 1 To 100
tmpDemData = ""
y1 = Rnd()
y2 = Rnd()
y3 = Rnd()
x1 = CInt(y1 * 100) / 100
x2 = CInt(y2 * 100) / 100
x3 = CInt(y3 * 100) / 100
temDemData = CStr(CStr(x1) + "," + CStr(x2) + "," + CStr(x3))
'输出当前方案到文本文件
Print #filenum, temDemData
Next
Close #filenum
MsgBox "Agent1策略初始化完毕!"
End Sub
Private Sub Command2_Click()
GenerateAgent1Policy "d:\BargainPro\Initialization\Agent1PolicyData.txt"
End Sub
'生成Agent2策略样本集
Sub GenerateAgent2Policy(strAgent2TargetFile As String)
Dim filenum As Integer
Dim tmpDemData As String
Dim x1, x2, x3, y1, y2, y3
Dim i As Integer
filenum = FreeFile
If Dir(strAgent2TargetFile, vbNormal) <> "" Then
Kill strAgent2TargetFile
End If
Open strAgent2TargetFile For Append As #filenum
temDemData = ""
temDemData = "y1" + "," + "y2" + "," + "y3"
Print #filenum, temDemData
Close #filenum
Open strAgent2TargetFile For Append As #filenum
For i = 1 To 100
tmpDemData = ""
y1 = Rnd()
y2 = Rnd()
y3 = Rnd()
x1 = CInt(y1 * 100) / 100
x2 = CInt(y2 * 100) / 100
x3 = CInt(y3 * 100) / 100
temDemData = CStr(CStr(x1) + "," + CStr(x2) + "," + CStr(x3))
'输出当前方案到文本文件
Print #filenum, temDemData
Next
Close #filenum
MsgBox "Agent2策略初始化完毕!"
End Sub
Private Sub Command3_Click()
GenerateAgent2Policy "d:\BargainPro\Initialization\Agent2PolicyData.txt"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -