質問編集履歴

2

乱数について追記

2016/08/17 13:20

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -49,6 +49,8 @@
49
49
  スタックトレースという言葉が聞きなれなかったので調べてきました.
50
50
 
51
51
  スタックトレースは多分わかったのですが,本題とは別の問題があるかもしれないことに気づきました.実行するごとにスタックトレースの内容がいちいち変化します.
52
+
53
+ プログラム中には乱数を用いていますが,プログラムの最初から最後まで乱数のシードは固定してあります.
52
54
 
53
55
  題の問題とは別の問題が発生しているかもしれないので,この質問を取り下げて新しく質問しなおすべきでしたら新しく質問し直します.
54
56
 

1

スタックトレースの追記

2016/08/17 13:20

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -41,3 +41,139 @@
41
41
  Object[]の値とsizeの値が異なっていますが,自分の中ではこれが原因かと考えています.
42
42
 
43
43
  ですが,解決方法がわかりません.どのように解決したら良いでしょうか.
44
+
45
+
46
+
47
+ ###追記2016/8/17 22:05
48
+
49
+ スタックトレースという言葉が聞きなれなかったので調べてきました.
50
+
51
+ スタックトレースは多分わかったのですが,本題とは別の問題があるかもしれないことに気づきました.実行するごとにスタックトレースの内容がいちいち変化します.
52
+
53
+ 題の問題とは別の問題が発生しているかもしれないので,この質問を取り下げて新しく質問しなおすべきでしたら新しく質問し直します.
54
+
55
+ ```
56
+
57
+ Exception in thread "main" java.lang.NullPointerException
58
+
59
+ at sol.aoki.Cicada.growToAdult(AgentBasedCicadas.java:619)
60
+
61
+ at sol.aoki.AgentBasedCicadas.Simulating(AgentBasedCicadas.java:371)
62
+
63
+ at sol.aoki.AgentBasedCicadas.main(AgentBasedCicadas.java:51)
64
+
65
+ ```
66
+
67
+
68
+
69
+ ```
70
+
71
+ Exception in thread "main" java.lang.NullPointerException
72
+
73
+ at sol.aoki.AgentBasedCicadas.Simulating(AgentBasedCicadas.java:424)
74
+
75
+ at sol.aoki.AgentBasedCicadas.main(AgentBasedCicadas.java:51)
76
+
77
+ ```
78
+
79
+
80
+
81
+ ```
82
+
83
+ Exception in thread "main" java.lang.ClassCastException: [I cannot be cast to sol.aoki.Cicada
84
+
85
+ at sol.aoki.AgentBasedCicadas.Simulating(AgentBasedCicadas.java:424)
86
+
87
+ at sol.aoki.AgentBasedCicadas.main(AgentBasedCicadas.java:51)
88
+
89
+ ```
90
+
91
+
92
+
93
+ ```
94
+
95
+ Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
96
+
97
+ at sol.aoki.Cicada.getGene(AgentBasedCicadas.java:815)
98
+
99
+ at sol.aoki.AgentBasedCicadas.Simulating(AgentBasedCicadas.java:425)
100
+
101
+ at sol.aoki.AgentBasedCicadas.main(AgentBasedCicadas.java:51)
102
+
103
+ ```
104
+
105
+
106
+
107
+ ```
108
+
109
+ Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
110
+
111
+ at sol.aoki.Cicada.getLowerGene(AgentBasedCicadas.java:761)
112
+
113
+ at sol.aoki.Cicada.canBeAdult(AgentBasedCicadas.java:749)
114
+
115
+ at sol.aoki.Cicada.growToAdult(AgentBasedCicadas.java:620)
116
+
117
+ at sol.aoki.AgentBasedCicadas.Simulating(AgentBasedCicadas.java:371)
118
+
119
+ at sol.aoki.AgentBasedCicadas.main(AgentBasedCicadas.java:51)
120
+
121
+ ```
122
+
123
+
124
+
125
+ ```
126
+
127
+ Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
128
+
129
+ at sol.aoki.Cicada.getGene(AgentBasedCicadas.java:815)
130
+
131
+ at sol.aoki.AgentBasedCicadas.Simulating(AgentBasedCicadas.java:425)
132
+
133
+ at sol.aoki.AgentBasedCicadas.main(AgentBasedCicadas.java:51)
134
+
135
+ ```
136
+
137
+
138
+
139
+ ```
140
+
141
+ #
142
+
143
+ # A fatal error has been detected by the Java Runtime Environment:
144
+
145
+ #
146
+
147
+ # SIGSEGV (0xb) at pc=0x00000001055a3791, pid=28582, tid=10499
148
+
149
+ #
150
+
151
+ # JRE version: Java(TM) SE Runtime Environment (8.0_45-b14) (build 1.8.0_45-b14)
152
+
153
+ # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.45-b02 mixed mode bsd-amd64 compressed oops)
154
+
155
+ # Problematic frame:
156
+
157
+ # V [libjvm.dylib+0x1a3791] oopDesc::size()+0x2d
158
+
159
+ #
160
+
161
+ # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
162
+
163
+ #
164
+
165
+ # An error report file with more information is saved as:
166
+
167
+ # /Users/aoki/Documents/workspace/AgentBasedCicadas/hs_err_pid28582.log
168
+
169
+ #
170
+
171
+ # If you would like to submit a bug report, please visit:
172
+
173
+ # http://bugreport.java.com/bugreport/crash.jsp
174
+
175
+ #
176
+
177
+
178
+
179
+ ```