-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExpert_System
More file actions
425 lines (344 loc) · 19 KB
/
Expert_System
File metadata and controls
425 lines (344 loc) · 19 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
/// @brief Unknown Aerial Phenomenon Explanatory Categorizer
/// @file UAPExpertSystem.cpp
/// @author <your name or email address here>
/// @course CPSC-298-6 Programming in C++
#include <iostream>
#include <string>
#include <vector>
int main()
{
std::cout << "Unknown Aerial Phenomenon (UAP) Explanatory Categorizer Expert System" << std::endl;
std::cout << "---------------------------------------------------------------------" << std::endl;
std::cout << std::endl;
// //////////////////////////////////////////////////////////////////////////////////////////////////
// Explanatory Categories
// //////////////////////////////////////////////////////////////////////////////////////////////////
const std::string strExplanatoryCategoryCommonplace = "Commonplace: Airborne Clutter, Natural Phenomena or Sensor Malfunction";
const std::string strExplanatoryCategoryAdvancedSystem = "Advanced System: an advanced development system/prototype aircraft";
const std::string strExplanatoryCategoryOther = "Other: An unknown phenomena. Unidentified; requires additional scientific knowledge to classify";
const std::string strExplanatoryCategoryError = "Unable to characterize UAP Event; insufficient or contradictory information";
// //////////////////////////////////////////////////////////////////////////////////////////////////
// Reason strings associated with Decision variables
// //////////////////////////////////////////////////////////////////////////////////////////////////
// All reason strings may be preprended with "No " if the associated decision variable is false.
const std::string strPrefixNo = "no ";
// Ambient Conditions Reason strings
const std::string strReasonBirdsInVicinity = "birds in vicinity";
const std::string strReasonRecreationalUavActivityFeasible = "recreational UAV activity feasible";
// Means of Detection Reason strings
const std::string strReasonDetectedVisuallyOrPhotographed = "visual or electro-optical (E/O) camera detection";
const std::string strReasonUapDetectedByRadar = "radar detection";
const std::string strReasonDetectedByIR = "infrared (IR) sensor detection";
// Unknown Aerial Phenomenon (UAP) Characteristics Reason strings
const std::string strReasonUapAbruptManeuvers = "abrupt maneuvers performed by UAP";
const std::string strReasonUnusualFlightCharacteristics = "unusual flight characteristics of UAP detected";
const std::string strReasonUapSignatureManagement = "signature management performed by UAP";
// Additional UAP Characteristics Reason strings (used only if detected visually or photographed using electro-optical camera)
const std::string strReasonControlSurfacesVisable = "UAP control surfaces visible";
const std::string strReasonUapDiscernableMeansOfPropulsion = "discernable UAP means of propulsion";
const std::string strReasonUapObservedToUndulateOrChangeShape = "UAP undulation or change in shape observed";
bool bUserWishesToContinue = true;
// /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ //
// TODO: INSERT BEGINNING OF WHILE LOOP HERE
// The conditional expression for the while loop must involve the Boolean variable bUserWishesToContinue,
// defined above:
// /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ //
while(bUserWishesToContinue == true)
{
std::cout << std::endl;
std::cout << "UAP Event Questionnaire" << std::endl;;
std::cout << "For all questions, please answer 1 for Yes and 0 for No." << std::endl;;
std::cout << std::endl;
bool bCategorized = false; // true when Expert System has identified an Explanatory Category to recommend.
// //////////////////////////////////////////////////////////////////////////////////////////////////
// Decision Variables
// //////////////////////////////////////////////////////////////////////////////////////////////////
// Ambient Conditions Decision Variables
bool bBirdsInVicinity = false;
bool bRecreationalUavActivityFeasible = false;
// Means of Detection Decision Variables
bool bUapDetectedVisuallyOrPhotographed = false;
bool bUapDetectedByRadar = false;
bool bUapDetectedByIR = false;
// Unknown Aerial Phenomenon (UAP) Characteristics Decision Variables
bool bUapAbruptManeuvers = false;
bool bUapUnusualFlightCharacteristics = false;
bool bUapSignatureManagement = false;
// Unknown Aerial Phenomenon (UAP) Characteristics (only if visually sighted or photographed) Decision Variables
bool bUapConrolSurfacesVisible = false;
bool bUapDiscernableMeansOfPropulsion = false;
bool bUapObservedToUndulateOrChangeShape = false;
std::string strExplanatoryCategory = strExplanatoryCategoryError;
// //////////////////////////////////////////////////////////////////////////////////////////////////
// Consultation
// //////////////////////////////////////////////////////////////////////////////////////////////////
std::cout << "Were birds such as seaguls present in the vicinity or likely to have been present?" << std::endl;
std::cin >> bBirdsInVicinity;
std::cout << "Was recreational Unmanned Aerial Vehicle atcivity feasbile in the vicinity?" << std::endl;
std::cin >> bRecreationalUavActivityFeasible;
std::cout << "Was the UAP detected visually or photographed with an electro-optical camera?" << std::endl;
std::cin >> bUapDetectedVisuallyOrPhotographed;
std::cout << "Was the UAP detected by radar?" << std::endl;
std::cin >> bUapDetectedByRadar;
std::cout << "Was the UAP detected by an infra-red (IR) sensor (such as Forward-looking Infrared (FLIR))?" << std::endl;
std::cin >> bUapDetectedByIR;
std::cout << "Did the UAP perform abrupt maneuvers, beyond those achievable by known high-performance aircraft?" << std::endl;
std::cin >> bUapAbruptManeuvers;
std::cout << "Did the UAP exhibit unusual flight characteristics, but within the bounds of feasible aircraft performance?" << std::endl;
std::cin >> bUapUnusualFlightCharacteristics;
std::cout << "Did the UAP perform signature management (did its radar return or infrared signature change suddenly)?" << std::endl;
std::cin >> bUapSignatureManagement;
if (bUapDetectedVisuallyOrPhotographed)
{
std::cout << "When sighted or photographed, were control surfaces such as ailerons, flaps or a stabilator visible on the UAP?" << std::endl;
std::cin >> bUapConrolSurfacesVisible;
std::cout << "Was the UAP's means of propulsion discernable (for example, was jet exhaust observed)?" << std::endl;
std::cin >> bUapDiscernableMeansOfPropulsion;
std::cout << "Was the UAP observed to undulate or change shape?" << std::endl;
std::cin >> bUapObservedToUndulateOrChangeShape;
}
std::cout << std::endl;
std::cout << std::endl;
// //////////////////////////////////////////////////////////////////////////////////////////////////
// Rules
// //////////////////////////////////////////////////////////////////////////////////////////////////
// /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ //
// TODO: DEFINE A VARIABLE NAMED vecReason BY INSTANTIATING THE std::vector TEMPLATE CLASS.
// The vector should have elements of the std::string data type. The declaration will have the following
// form where you will replace with question marks (????) with the remainder of the declaration.
// std::vector<?????> vecReason;
// /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ //
std::vector<std::string>vecReason;
if (bUapDetectedVisuallyOrPhotographed)
{
vecReason.push_back(strReasonDetectedVisuallyOrPhotographed);
if (bUapAbruptManeuvers)
{
vecReason.push_back(strReasonUapAbruptManeuvers);
if (bUapDetectedByRadar || bUapDetectedByIR)
{
bUapDetectedByRadar ? vecReason.push_back(strReasonUapDetectedByRadar) : vecReason.push_back(strPrefixNo + strReasonUapDetectedByRadar);
bUapDetectedByIR ? vecReason.push_back(strReasonDetectedByIR) : vecReason.push_back(strPrefixNo + strReasonDetectedByIR);
// Rationale
vecReason.push_back("UAP maneuverability inexplicable; detected by multiple sensor types");
strExplanatoryCategory = strExplanatoryCategoryOther;
bCategorized = true;
}
else
{
bUapDetectedByRadar ? vecReason.push_back(strReasonUapDetectedByRadar) : vecReason.push_back(strPrefixNo + strReasonUapDetectedByRadar);
bUapDetectedByIR ? vecReason.push_back(strReasonDetectedByIR) : vecReason.push_back(strPrefixNo + strReasonDetectedByIR);
// Rationale
vecReason.push_back("UAP maneuverability inexplicable; possible optical illusion");
strExplanatoryCategory = strExplanatoryCategoryError;
bCategorized = true;
}
}
else if (bUapUnusualFlightCharacteristics)
{
vecReason.push_back(strReasonUnusualFlightCharacteristics);
if (bUapDetectedByRadar || bUapDetectedByIR)
{
bUapDetectedByRadar ? vecReason.push_back(strReasonUapDetectedByRadar) : vecReason.push_back(strPrefixNo + strReasonUapDetectedByRadar);
bUapDetectedByIR ? vecReason.push_back(strReasonDetectedByIR) : vecReason.push_back(strPrefixNo + strReasonDetectedByIR);
if (!bUapConrolSurfacesVisible || !bUapDiscernableMeansOfPropulsion)
{
if (!bUapConrolSurfacesVisible)
{
vecReason.push_back(strPrefixNo + strReasonControlSurfacesVisable);
}
if (!bUapDiscernableMeansOfPropulsion)
{
vecReason.push_back(strPrefixNo + strReasonUapDiscernableMeansOfPropulsion);
}
// Rationale
vecReason.push_back("UAP maneuverability exteme but plausible; detected by multiple sensor types; inexlicable control or proplusion mechanism");
strExplanatoryCategory = strExplanatoryCategoryOther;
bCategorized = true;
}
else
{
bUapConrolSurfacesVisible ? vecReason.push_back(strReasonControlSurfacesVisable) : vecReason.push_back(strPrefixNo + strReasonControlSurfacesVisable);
bUapDiscernableMeansOfPropulsion ? vecReason.push_back(strReasonUapDiscernableMeansOfPropulsion) : vecReason.push_back(strPrefixNo + strReasonUapDiscernableMeansOfPropulsion);
// Rationale
vecReason.push_back("UAP maneuverability exteme but plausible; detected by multiple sensor types; control and propulsion plausible");
strExplanatoryCategory = strExplanatoryCategoryAdvancedSystem;
bCategorized = true;
}
}
else
{
vecReason.push_back(strPrefixNo + strReasonUapDetectedByRadar);
vecReason.push_back(strPrefixNo + strReasonDetectedByIR);
if (bUapObservedToUndulateOrChangeShape && bBirdsInVicinity)
{
vecReason.push_back(strReasonUapObservedToUndulateOrChangeShape);
vecReason.push_back(strReasonBirdsInVicinity);
// Flocks of birds can show up on radar and IR and the mass appears to change shape or undulate when viewed as a whole.
// Birds don't always show on radar though if flock is small.
vecReason.push_back("UAP maneuverability exteme but plausible; detected only visually; UAP changes shape or undulates; birds in vicinity");
strExplanatoryCategory = strExplanatoryCategoryCommonplace;
bCategorized = true;
}
else if (bRecreationalUavActivityFeasible)
{
bUapObservedToUndulateOrChangeShape ? vecReason.push_back(strReasonUapObservedToUndulateOrChangeShape) : vecReason.push_back(strPrefixNo + strReasonUapObservedToUndulateOrChangeShape);
bBirdsInVicinity ? vecReason.push_back(strReasonBirdsInVicinity) : vecReason.push_back(strPrefixNo + strReasonBirdsInVicinity);
vecReason.push_back(strReasonRecreationalUavActivityFeasible);
vecReason.push_back("UAP maneuverability exteme but plausible; detected visually; recreational UAVs plausible in vicinity");
strExplanatoryCategory = strExplanatoryCategoryAdvancedSystem;
bCategorized = true;
}
}
}
else
{
if (!bUapConrolSurfacesVisible || !bUapDiscernableMeansOfPropulsion)
{
if (!bUapConrolSurfacesVisible)
{
vecReason.push_back(strPrefixNo + strReasonControlSurfacesVisable);
}
if (!bUapDiscernableMeansOfPropulsion)
{
vecReason.push_back(strPrefixNo + strReasonUapDiscernableMeansOfPropulsion);
}
// Rationale
vecReason.push_back("UAP maneuverability exteme but plausible; detected by multiple sensor types; inexlicable control or proplusion mechanism");
strExplanatoryCategory = strExplanatoryCategoryOther;
bCategorized = true;
}
else
{
vecReason.push_back("UAP exhibits no unusual characteristics; not considered by UAP Task Force");
strExplanatoryCategory = strExplanatoryCategoryError;
bCategorized = true;
}
}
}
else
{
vecReason.push_back(strPrefixNo + strReasonDetectedVisuallyOrPhotographed);
if (bUapAbruptManeuvers)
{
vecReason.push_back(strReasonUapAbruptManeuvers);
// /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ //
// TODO: IN THE FOLLOWING IF BLOCK, ENTER THE BLOCK IF THE UAP WAS BOTH DETECTED BY RADAR
// (bUapDetectedByRadar) AND DETECTED BY INFRARED (bUapDetectedByIR).
// At the start of the block (after the { character), add two reasons to the vecReason vector using
// the push_back() method. The first reason is that the UAP was detected by radar
// (strReasonUapDetectedByRadar) and the second reason is that the UAP was detected by Infra-red
// (strReasonDetectedByIR).
// /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ //
if (bUapDetectedByRadar && bUapDetectedByIR)
{
vecReason.push_back(strReasonUapDetectedByRadar);
vecReason.push_back(strReasonDetectedByIR);
// Rationale
vecReason.push_back("UAP maneuverability inexplicable; detected by multiple sensor types");
strExplanatoryCategory = strExplanatoryCategoryOther;
bCategorized = true;
}
else
{
bUapDetectedByRadar ? vecReason.push_back(strReasonUapDetectedByRadar) : vecReason.push_back(strPrefixNo + strReasonUapDetectedByRadar);
bUapDetectedByIR ? vecReason.push_back(strReasonDetectedByIR) : vecReason.push_back(strPrefixNo + strReasonDetectedByIR);
// Rationale
vecReason.push_back("UAP maneuverability inexplicable; possible sensor anomaly");
strExplanatoryCategory = strExplanatoryCategoryError;
bCategorized = true;
}
}
else if (bUapUnusualFlightCharacteristics)
{
vecReason.push_back(strReasonUnusualFlightCharacteristics);
if (bUapDetectedByRadar && bUapDetectedByIR)
{
vecReason.push_back(strReasonUapDetectedByRadar);
vecReason.push_back(strReasonDetectedByIR);
if (bUapSignatureManagement)
{
vecReason.push_back(strReasonUapSignatureManagement);
// Rationale
vecReason.push_back("UAP maneuverability exteme but plausible; detected by multiple sensor types and employs signature management");
strExplanatoryCategory = strExplanatoryCategoryAdvancedSystem;
bCategorized = true;
}
else
{
vecReason.push_back(strPrefixNo + strReasonUapSignatureManagement);
if (bRecreationalUavActivityFeasible)
{
vecReason.push_back(strReasonRecreationalUavActivityFeasible);
vecReason.push_back("UAP maneuverability exteme but plausible; detected by multiple sensor types and does not employ signature managment; recreational UAVs plausible in vicinity");
strExplanatoryCategory = strExplanatoryCategoryAdvancedSystem;
bCategorized = true;
}
else if (bBirdsInVicinity)
{
vecReason.push_back(strPrefixNo + strReasonRecreationalUavActivityFeasible);
vecReason.push_back(strReasonBirdsInVicinity);
// Rationale
vecReason.push_back("UAP maneuverability exteme but plausible; detected by multiple sensor types and does not employ signature managment, recreational UAV implausible, birds in vicintity");
strExplanatoryCategory = strExplanatoryCategoryAdvancedSystem;
bCategorized = true;
}
}
}
else
{
bUapDetectedByRadar ? vecReason.push_back(strReasonUapDetectedByRadar) : vecReason.push_back(strPrefixNo + strReasonUapDetectedByRadar);
bUapDetectedByIR ? vecReason.push_back(strReasonDetectedByIR) : vecReason.push_back(strPrefixNo + strReasonDetectedByIR);
// Rationale
vecReason.push_back("UAP maneuverability explicable; possible sensor anomaly");
strExplanatoryCategory = strExplanatoryCategoryError;
bCategorized = true;
}
}
else
{
vecReason.push_back("UAP exhibits no unusual characteristics; not considered by UAP Task Force");
strExplanatoryCategory = strExplanatoryCategoryError;
bCategorized = true;
}
}
std::cout << "Rules Engine Status: successfully categorized: " << bCategorized << std::endl;
std::cout << "-----------------------------------------------------------------------------" << std::endl;
std::cout << std::endl;
// //////////////////////////////////////////////////////////////////////////////////////////////////
// Recommendation
// //////////////////////////////////////////////////////////////////////////////////////////////////
std::cout << "Explanatory Category Recommendation: " << strExplanatoryCategory << std::endl;
std::cout << std::endl;
// //////////////////////////////////////////////////////////////////////////////////////////////////
// Explanation of Recommendation
// //////////////////////////////////////////////////////////////////////////////////////////////////
std::cout << "Reason: " << std::endl;
// /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ //
// TODO: ITERATE OVER THE vecReason VECTOR AND EMIT STRINGS TO STANDARD OUTPUT IN ORDER
// Use a for loop; use the vector size() function and the vector at() function as well as std::cout.
// /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ //
for (int i = 0; i < vecReason.size(); i++) {
std::cout << vecReason.at(i) << std::endl;
}
// /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ //
// TODO: QUERY USER IF THEY WISH TO ENTER DATA FOR ANOTHER UAP EVENT
// Prompt user using std::cout; collect input from user using std::cin into char variable cUserResponse;
// allow user to type either 'Y' or 'y' to continue. Any other character is considered 'n'.
// Use an OR operator (or, ||) and the NOT operator (!) in your solution.
// ITERATE AGAIN THROUGH WHILE LOOP OR TERMINATE PROGRAM BASED ON USER RESPONSE
// Alter value of variable bUserWishesToContinue to terminate while loop if user response requires.
// /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ //
std::cout << std::endl;
std::cout << "Do you wish to analyze another UAP Event (y/n)?" << std::endl;
char cUserResponse = 'n';
std::cin >> cUserResponse;
if(cUserResponse == 'y' || cUserResponse == 'n')
{
bUserWishesToContinue == false;
}
} // end while loop
std::cout << std::endl;
std::cout << "UAP Expert System terminated normally" << std::endl;
std::cout << std::endl;
}