-
Notifications
You must be signed in to change notification settings - Fork 2
/
simulateContainer.m
84 lines (69 loc) · 2.1 KB
/
simulateContainer.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
classdef simulateContainer < matlab.mixin.Copyable
properties
% state = '';
% action = '';
% movecost = 0.0;
% velocity = [];
% profit = 0.0;
% calcFuncval = 0.0;
% risk = 0.0;
%
% particle = particle();
state;
action;
movecost;
velocity;
profit;
calcFuncval;
risk;
distanceToGlobalBest;
particle;
end
methods
function obj = simulateContainer()
obj.state = '';
obj.action = '';
obj.movecost = 0.0;
obj.velocity = [];
obj.profit = 0.0;
obj.calcFuncval = 0.0;
obj.risk = 0.0;
obj.distanceToGlobalBest = 0.0;
obj.particle = particle();
end
function ret = getState(obj)
ret = obj.state;
end
function ret = getAction(obj)
ret = obj.action;
end
function ret = getMovecost(obj)
ret = obj.movecost;
end
function ret = getVelocity(obj)
ret = obj.velocity;
end
function ret = getProfit(obj)
ret = obj.profit;
end
function ret = getRisk(obj)
ret = obj.risk;
end
function ret = getdistanceToGlobalBest(obj)
ret = obj.distanceToGlobalBest;
end
function obj = setProperties(obj, state, action, movecost, velocity, profit, calcFuncval, risk, distanceToGlobalBest)
obj.state = state;
obj.action = action;
obj.movecost = movecost;
obj.velocity = velocity;
obj.profit = profit;
obj.calcFuncval = calcFuncval;
obj.risk = risk;
obj.distanceToGlobalBest = distanceToGlobalBest;
end
function ret = printShortValues(obj)
ret = sprintf('[movecost=%f; profit=%f; calcFuncval=%f]', obj.getMovecost, obj.getProfit, obj.calcFuncval);
end
end
end