THANKS EVERYONE. IM WORKING OUT ABOUT THIS ASSIGNMENT
I WISH SOMEONE THAT GIVE ME CODE FOR EXAMPLE AND I JUST LEARN FROM THIS.
WHOLE PDF FILE :
http://www.mediafire.com/view/a1tlyov3fe644n0/Engg1112%20Assignment%201.pdf
Decision making is a problem everyone would face in their daily lives. The complexity of decision making process, defined in economic choice theory and driven by multi-objectives and uncertainty in results, makes making a decision a painful process. In addition, qualitative features, i.e. features without quantifiable measures, can hardly be applied in logical models without expert (experienced) input.
This leads to the rise of ranking approaches among alternatives. Multi-objective ranking can be performed using certain matrix manipulation techniques. The one presented here is eigenvector extraction, which is being used in Analytic Hierarchy Process (AHP) for deciding solutions in complicated problems.
The steps of evaluating the problem are as follow:
1) Define the criteria
2) Ask the user to weight the criteria as follow, using a 1~9 scale
e.g. 4-criteria problem
The table should be left read: e.g. Fuel efficiency is 3 times more important than capacity; safety is 5 times more important that as aesthetics, etc..
3) Calculate the weight vector of the criteria matrix, by:
3.1) Self-multiply the weight matrix
3.2) Get row sum vector of the result matrix
3.3) Normalize importance vector
4) The vector of the criteria is now complete. Repeat the process (2) & (3) for all alternatives. After finishing weighing the alternative within the criteria, multiply the result with the criteria weight.
5) Sum up the scores of all alternatives and find the highest score alternative.
Example:
Consider buying a car. A set of criteria for ranking the alternatives (i.e. cars) are first defined. By performing the following operation, a normalized eigenvector can be extracted, indicating compounded preference over alternatives in the decision.
The next job is to weight the criteria (example as follow):
By conducting step 3, we can find out the importance of the criteria:
(3.1)
(3.2)
(3.3)
The 1st layer problem is then solved, as displayed as follow:
Now we need to weight 4 more sets of importance for each criteria, and solve them one by one. To save time, we consider two alternatives (model A and B) here only.
πΉπΉπΉπΉπ΄π΅π΄13π΅1/31 πΆπΆπΆπ΄π΅π΄11/2π΅21 π΄π΄ π΄π΄π΅π΄11/5π΅51 ππ ππ π΄π΅π΄11π΅11
If properly calculated, we will have:
The score of A is: (0.458*0.25+0.198*0.33+0.174*0.24+0.170*0.5) = 0.5356
The score of B is: (0.458*0.25+0.198*0.67+0.174*0.76+0.170*0.5) = 0.4644
So we should buy vehicle model A in this case.
Problem:
You are required to write a program using C++ to assist potential customers to select their vehicle using the above approach. The company provides five types of vehicles for sale, namely:
- A: Sports car
- B: Sedan
- C: Electric / Hybrid compact
- D: SUV
- E: Flatbed truck
Users first weigh the four criteria they wish to be processed in the program. They would then go through the weighing process and the system should output the importance criteria of the result, and the final decision your calculations made.
Input and output method should follow the sample program of this assignment.
Vehicle Selection Helper
================================================================================
Instruction:
- Questions about personal judgement on certain issues will be displayed
- Enter the relative importance of the criteria when asked
- Questions are set in format of " Rate A VS. B "
- You have to decide whether A is better than or worse than B
- If A is better than B, rate how better it is (weigh t> 1)
- If A is worse than B, rate how worse it is (weight < 1)
- Notice
1. Ranks should be in scale of [0.1-9.9]
2. Numbers of input required are marked at each question
3. Separate multiple input with comma, e.g. (v1,v2,v3) => 1,0.33,5
Press any key to continue...
Rate the following criteria (Fuel efficiency, Capacity, Aesthetics and Safety):
+ Fuel efficiency VS. Capacity, Aesthetics and Safety (x,y,z): 6.0,7,3
+ Capacity VS. Aesthetics and Safety(x,y): 2.5,4
+ Aesthetics VS. Safety(x): 1
=====================Fuel efficiency====================
+ Sports Car VS. Sedan, Hybrid, SUV and Flatbed (w,x,y,z): 4,3,2,1
+ Sedan VS. Hybrid, SUV and Flatbed (x,y,z): 4,3,2
+ Hybrid VS. SUV and Flatbed(x,y): 4,3
+ SUV VS. Flatbed(x): 2
=========================Capacity=======================
+ Sports Car VS. Sedan, Hybrid, SUV and Flatbed (w,x,y,z): 1,2,3,4
+ Sedan VS. Hybrid, SUV and Flatbed (x,y,z): 1,2,3
+ Hybrid VS. SUV and Flatbed(x,y): 1,2
+ SUV VS. Flatbed(x): 1
========================Aesthetics======================
+ Sports Car VS. Sedan, Hybrid, SUV and Flatbed (w,x,y,z): 4,6,5,5
+ Sedan VS. Hybrid, SUV and Flatbed (x,y,z): 3.1,0.05,9
+ Hybrid VS. SUV and Flatbed(x,y): 2,3.1
+ SUV VS. Flatbed(x) : 5
==========================Safety========================
+ Sports Car VS. Sedan, Hybrid, SUV and Flatbed (w,x,y,z): 1,2,4,8
+ Sedan VS. Hybrid, SUV and Flatbed (x,y,z): 3,2,0.05
+ Hybrid VS. SUV and Flatbed(x,y): 1,8
+ SUV VS. Flatbed(x): 1
Ranking Result
==============================================
1. Sports car (0.36)
2. Sedan (0.24)
3. Electric / Hybrid (0.18)
4. SUV (0.12)
5. Flatbed (0.11)
Input 'Y' to display detail results, or otherwise to skip: y
Fuel Cap Aes Safe
============================================================================
Compt 0.37 0.34 0.36 0.33
Sedan 0.27 0.26 0.08 0.09
EleHy 0.17 0.18 0.10 0.28
SUV 0.09 0.13 0.44 0.06
FltBd 0.10 0.09 0.02 0.24
Do you want to try again?: N
Marking:
Scores of the assignment is given using the follow structure:
Program functionality 40%
- Proper program flow
- Proper use of variables
- Completeness of program
- Robustness against unexpected user behavior
Correct calculation 30%
- Correct matrix multiplication
- Correct normalized vector extraction
- Correct answers in suggestion
Output formatting 20%
- Display clarity
- Proper use of numeric formatting
Code clarity 10%
Deadline:
You should submit your program (the source file with file extension .cpp) to the Moodle on or before 8 am, 20th January, 2014.
Appendix: Matrix Multiplication
This supplementary note is written to provide a basic view on how matrix multiplication is conducted in C++. For the basics of matrix operations one can find it from University textbooks of Engineering Mathematics.
Notes for matrix multiplication in C++:
- For 2 matrices A & B, the row count of B must be equal to column count of A
- For 2 matrices of size πΓπ and πΓπ, the resultant of the matrix is of size πΓπ
Steps of calculation should be:
1) Ensure matrices are in correct sizes
2) Declare resultant matrix with corresponding size
3) For each element in the resultant matrix, conduct element-wise matrix summation
A sample code for matrix multiplication is provided.
ENGG1112 Computer Programming and Applications I 2013-2014 Assignment 1
page 8
// matrix.cpp
#include <iostream>
using namespace std;
int main()
{
// demonstrating
const int row=3, col=3, inner=3;
double Result[row][col] = {
{0,0,0},
{0,0,0},
{0,0,0}
};
double A[row][col] = {
{10,0.33333,1},
{3,3,4},
{0.5,0.5,3}
};
double B[row][col] = {
{10,5,1},
{3,3,4},
{0.5,0.5,3}
};
for (int i = 0; i < row; i++)
for (int j = 0; j < col; j++)
for (int k = 0; k < inner; k++)
Result[i][j] += A[i][k] * B[k][j];
for (int i = 0; i < row; i++)
{
for (int j = 0; j < col; j++)
{
cout.width(8);
cout << Result[i][j];
}
cout << endl;
}
system("pause");
return 0;
}