Topsis-Prabhsimar-102483078 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,187 @@
1
+ Metadata-Version: 2.4
2
+ Name: Topsis-Prabhsimar-102483078
3
+ Version: 1.0.2
4
+ Summary: A Python package for TOPSIS multi-criteria decision making
5
+ Author: Prabhsimar Singh
6
+ Author-email: prabhsimar@example.com
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Intended Audience :: Education
11
+ Classifier: Topic :: Scientific/Engineering
12
+ Requires-Python: >=3.6
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: numpy
15
+ Requires-Dist: pandas
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: classifier
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: requires-dist
22
+ Dynamic: requires-python
23
+ Dynamic: summary
24
+
25
+ # Topsis-Prabhsimar-102483078
26
+
27
+ PyPI version | License: MIT
28
+
29
+ ---
30
+
31
+ ## 📌 Description
32
+
33
+ This package implements the **TOPSIS (Technique for Order Preference by Similarity to Ideal Solution)** method, a popular **multi-criteria decision-making (MCDM)** technique.
34
+
35
+ TOPSIS is used to rank alternatives based on their relative distance from:
36
+ - an **ideal best solution**
37
+ - an **ideal worst solution**
38
+
39
+ It helps decision-makers choose the best option among multiple alternatives.
40
+
41
+ ---
42
+
43
+ ## 🧠 Applications of TOPSIS
44
+
45
+ TOPSIS is widely used in:
46
+ - Product selection and comparison
47
+ - Supplier evaluation
48
+ - Project prioritization
49
+ - Performance assessment
50
+ - Resource allocation
51
+ - Investment analysis
52
+
53
+ ---
54
+
55
+ ## ⚙️ Installation
56
+
57
+ Install the package using pip:
58
+
59
+ ```bash
60
+ pip install Topsis-Prabhsimar-102483078
61
+ ```
62
+
63
+ ## 🚀 Usage
64
+
65
+ After installation, the topsis command becomes available in the terminal.
66
+
67
+ ### Basic Syntax
68
+
69
+ ```
70
+ topsis <input_csv> <weights> <impacts> <output_csv>
71
+ ```
72
+
73
+ ### Parameters
74
+
75
+ | Parameter | Description |
76
+ |-----------|-------------|
77
+ | input_csv | Path to the CSV file containing the decision matrix |
78
+ | weights | Comma-separated numerical weights for each criterion |
79
+ | impacts | Comma-separated impacts (+ for benefit, - for cost) |
80
+ | output_csv | Path where the output CSV file will be saved |
81
+
82
+ ---
83
+
84
+ ## 📊 Example
85
+
86
+ ### Input File (sample.csv)
87
+
88
+ ```
89
+ Model,Storage(in GB),Camera(in MP),Price(in $),Rating
90
+ M1,16,12,250,5
91
+ M2,16,8,200,3
92
+ M3,32,16,300,4
93
+ M4,32,8,275,4
94
+ M5,16,16,225,2
95
+ ```
96
+
97
+ ### Decision Criteria
98
+
99
+ **Weights Vector**
100
+ ```
101
+ 0.25,0.25,0.25,0.25
102
+ ```
103
+
104
+ **Impacts Vector**
105
+ ```
106
+ +,+,-,+
107
+ ```
108
+
109
+ - Storage → Benefit (+)
110
+ - Camera → Benefit (+)
111
+ - Price → Cost (-)
112
+ - Rating → Benefit (+)
113
+
114
+ ### Command
115
+
116
+ ```bash
117
+ topsis sample.csv "0.25,0.25,0.25,0.25" "+,+,-,+" output.csv
118
+ ```
119
+
120
+ ---
121
+
122
+ ## 📈 Output
123
+
124
+ The output CSV file will contain two additional columns:
125
+ - Topsis Score (closeness coefficient)
126
+ - Rank
127
+
128
+ ### Sample Output
129
+
130
+ | Model | Storage | Camera | Price | Rating | Topsis Score | Rank |
131
+ |-------|---------|--------|-------|--------|--------------|------|
132
+ | M3 | 32 | 16 | 300 | 4 | 0.69 | 1 |
133
+ | M4 | 32 | 8 | 275 | 4 | 0.53 | 2 |
134
+ | M1 | 16 | 12 | 250 | 5 | 0.53 | 3 |
135
+ | M5 | 16 | 16 | 225 | 2 | 0.40 | 4 |
136
+ | M2 | 16 | 8 | 200 | 3 | 0.30 | 5 |
137
+
138
+ ---
139
+
140
+ ## 📋 Input File Requirements
141
+
142
+ - CSV format only
143
+ - First column must contain alternative names
144
+ - Remaining columns must be numeric
145
+ - No missing values
146
+ - Minimum 2 criteria columns required
147
+
148
+ ---
149
+
150
+ ## ⚠️ Important Notes
151
+
152
+ - Number of weights must equal number of criteria columns
153
+ - Number of impacts must equal number of criteria columns
154
+ - Weights must be positive numbers
155
+ - Impacts must be either + or -
156
+ - All criterion values must be numeric
157
+
158
+ ---
159
+
160
+ ## 🔧 How TOPSIS Works
161
+
162
+ 1. Normalize the decision matrix
163
+ 2. Apply weights to normalized values
164
+ 3. Determine ideal best and ideal worst solutions
165
+ 4. Compute distances from ideal best and worst
166
+ 5. Calculate closeness coefficient
167
+ 6. Rank alternatives based on score
168
+
169
+ ---
170
+
171
+ ## 📝 License
172
+
173
+ This project is licensed under the MIT License.
174
+
175
+ ---
176
+
177
+ ## 👤 Author
178
+
179
+ **Prabhsimar Singh**
180
+ Roll Number: 102483078
181
+
182
+ ---
183
+
184
+ ## 📚 Academic Note
185
+
186
+ This package was developed as part of an academic assignment for
187
+ **UCS654 – Prescriptive Analytics**
@@ -0,0 +1,163 @@
1
+ # Topsis-Prabhsimar-102483078
2
+
3
+ PyPI version | License: MIT
4
+
5
+ ---
6
+
7
+ ## 📌 Description
8
+
9
+ This package implements the **TOPSIS (Technique for Order Preference by Similarity to Ideal Solution)** method, a popular **multi-criteria decision-making (MCDM)** technique.
10
+
11
+ TOPSIS is used to rank alternatives based on their relative distance from:
12
+ - an **ideal best solution**
13
+ - an **ideal worst solution**
14
+
15
+ It helps decision-makers choose the best option among multiple alternatives.
16
+
17
+ ---
18
+
19
+ ## 🧠 Applications of TOPSIS
20
+
21
+ TOPSIS is widely used in:
22
+ - Product selection and comparison
23
+ - Supplier evaluation
24
+ - Project prioritization
25
+ - Performance assessment
26
+ - Resource allocation
27
+ - Investment analysis
28
+
29
+ ---
30
+
31
+ ## ⚙️ Installation
32
+
33
+ Install the package using pip:
34
+
35
+ ```bash
36
+ pip install Topsis-Prabhsimar-102483078
37
+ ```
38
+
39
+ ## 🚀 Usage
40
+
41
+ After installation, the topsis command becomes available in the terminal.
42
+
43
+ ### Basic Syntax
44
+
45
+ ```
46
+ topsis <input_csv> <weights> <impacts> <output_csv>
47
+ ```
48
+
49
+ ### Parameters
50
+
51
+ | Parameter | Description |
52
+ |-----------|-------------|
53
+ | input_csv | Path to the CSV file containing the decision matrix |
54
+ | weights | Comma-separated numerical weights for each criterion |
55
+ | impacts | Comma-separated impacts (+ for benefit, - for cost) |
56
+ | output_csv | Path where the output CSV file will be saved |
57
+
58
+ ---
59
+
60
+ ## 📊 Example
61
+
62
+ ### Input File (sample.csv)
63
+
64
+ ```
65
+ Model,Storage(in GB),Camera(in MP),Price(in $),Rating
66
+ M1,16,12,250,5
67
+ M2,16,8,200,3
68
+ M3,32,16,300,4
69
+ M4,32,8,275,4
70
+ M5,16,16,225,2
71
+ ```
72
+
73
+ ### Decision Criteria
74
+
75
+ **Weights Vector**
76
+ ```
77
+ 0.25,0.25,0.25,0.25
78
+ ```
79
+
80
+ **Impacts Vector**
81
+ ```
82
+ +,+,-,+
83
+ ```
84
+
85
+ - Storage → Benefit (+)
86
+ - Camera → Benefit (+)
87
+ - Price → Cost (-)
88
+ - Rating → Benefit (+)
89
+
90
+ ### Command
91
+
92
+ ```bash
93
+ topsis sample.csv "0.25,0.25,0.25,0.25" "+,+,-,+" output.csv
94
+ ```
95
+
96
+ ---
97
+
98
+ ## 📈 Output
99
+
100
+ The output CSV file will contain two additional columns:
101
+ - Topsis Score (closeness coefficient)
102
+ - Rank
103
+
104
+ ### Sample Output
105
+
106
+ | Model | Storage | Camera | Price | Rating | Topsis Score | Rank |
107
+ |-------|---------|--------|-------|--------|--------------|------|
108
+ | M3 | 32 | 16 | 300 | 4 | 0.69 | 1 |
109
+ | M4 | 32 | 8 | 275 | 4 | 0.53 | 2 |
110
+ | M1 | 16 | 12 | 250 | 5 | 0.53 | 3 |
111
+ | M5 | 16 | 16 | 225 | 2 | 0.40 | 4 |
112
+ | M2 | 16 | 8 | 200 | 3 | 0.30 | 5 |
113
+
114
+ ---
115
+
116
+ ## 📋 Input File Requirements
117
+
118
+ - CSV format only
119
+ - First column must contain alternative names
120
+ - Remaining columns must be numeric
121
+ - No missing values
122
+ - Minimum 2 criteria columns required
123
+
124
+ ---
125
+
126
+ ## ⚠️ Important Notes
127
+
128
+ - Number of weights must equal number of criteria columns
129
+ - Number of impacts must equal number of criteria columns
130
+ - Weights must be positive numbers
131
+ - Impacts must be either + or -
132
+ - All criterion values must be numeric
133
+
134
+ ---
135
+
136
+ ## 🔧 How TOPSIS Works
137
+
138
+ 1. Normalize the decision matrix
139
+ 2. Apply weights to normalized values
140
+ 3. Determine ideal best and ideal worst solutions
141
+ 4. Compute distances from ideal best and worst
142
+ 5. Calculate closeness coefficient
143
+ 6. Rank alternatives based on score
144
+
145
+ ---
146
+
147
+ ## 📝 License
148
+
149
+ This project is licensed under the MIT License.
150
+
151
+ ---
152
+
153
+ ## 👤 Author
154
+
155
+ **Prabhsimar Singh**
156
+ Roll Number: 102483078
157
+
158
+ ---
159
+
160
+ ## 📚 Academic Note
161
+
162
+ This package was developed as part of an academic assignment for
163
+ **UCS654 – Prescriptive Analytics**
@@ -0,0 +1,187 @@
1
+ Metadata-Version: 2.4
2
+ Name: Topsis-Prabhsimar-102483078
3
+ Version: 1.0.2
4
+ Summary: A Python package for TOPSIS multi-criteria decision making
5
+ Author: Prabhsimar Singh
6
+ Author-email: prabhsimar@example.com
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Intended Audience :: Education
11
+ Classifier: Topic :: Scientific/Engineering
12
+ Requires-Python: >=3.6
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: numpy
15
+ Requires-Dist: pandas
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: classifier
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: requires-dist
22
+ Dynamic: requires-python
23
+ Dynamic: summary
24
+
25
+ # Topsis-Prabhsimar-102483078
26
+
27
+ PyPI version | License: MIT
28
+
29
+ ---
30
+
31
+ ## 📌 Description
32
+
33
+ This package implements the **TOPSIS (Technique for Order Preference by Similarity to Ideal Solution)** method, a popular **multi-criteria decision-making (MCDM)** technique.
34
+
35
+ TOPSIS is used to rank alternatives based on their relative distance from:
36
+ - an **ideal best solution**
37
+ - an **ideal worst solution**
38
+
39
+ It helps decision-makers choose the best option among multiple alternatives.
40
+
41
+ ---
42
+
43
+ ## 🧠 Applications of TOPSIS
44
+
45
+ TOPSIS is widely used in:
46
+ - Product selection and comparison
47
+ - Supplier evaluation
48
+ - Project prioritization
49
+ - Performance assessment
50
+ - Resource allocation
51
+ - Investment analysis
52
+
53
+ ---
54
+
55
+ ## ⚙️ Installation
56
+
57
+ Install the package using pip:
58
+
59
+ ```bash
60
+ pip install Topsis-Prabhsimar-102483078
61
+ ```
62
+
63
+ ## 🚀 Usage
64
+
65
+ After installation, the topsis command becomes available in the terminal.
66
+
67
+ ### Basic Syntax
68
+
69
+ ```
70
+ topsis <input_csv> <weights> <impacts> <output_csv>
71
+ ```
72
+
73
+ ### Parameters
74
+
75
+ | Parameter | Description |
76
+ |-----------|-------------|
77
+ | input_csv | Path to the CSV file containing the decision matrix |
78
+ | weights | Comma-separated numerical weights for each criterion |
79
+ | impacts | Comma-separated impacts (+ for benefit, - for cost) |
80
+ | output_csv | Path where the output CSV file will be saved |
81
+
82
+ ---
83
+
84
+ ## 📊 Example
85
+
86
+ ### Input File (sample.csv)
87
+
88
+ ```
89
+ Model,Storage(in GB),Camera(in MP),Price(in $),Rating
90
+ M1,16,12,250,5
91
+ M2,16,8,200,3
92
+ M3,32,16,300,4
93
+ M4,32,8,275,4
94
+ M5,16,16,225,2
95
+ ```
96
+
97
+ ### Decision Criteria
98
+
99
+ **Weights Vector**
100
+ ```
101
+ 0.25,0.25,0.25,0.25
102
+ ```
103
+
104
+ **Impacts Vector**
105
+ ```
106
+ +,+,-,+
107
+ ```
108
+
109
+ - Storage → Benefit (+)
110
+ - Camera → Benefit (+)
111
+ - Price → Cost (-)
112
+ - Rating → Benefit (+)
113
+
114
+ ### Command
115
+
116
+ ```bash
117
+ topsis sample.csv "0.25,0.25,0.25,0.25" "+,+,-,+" output.csv
118
+ ```
119
+
120
+ ---
121
+
122
+ ## 📈 Output
123
+
124
+ The output CSV file will contain two additional columns:
125
+ - Topsis Score (closeness coefficient)
126
+ - Rank
127
+
128
+ ### Sample Output
129
+
130
+ | Model | Storage | Camera | Price | Rating | Topsis Score | Rank |
131
+ |-------|---------|--------|-------|--------|--------------|------|
132
+ | M3 | 32 | 16 | 300 | 4 | 0.69 | 1 |
133
+ | M4 | 32 | 8 | 275 | 4 | 0.53 | 2 |
134
+ | M1 | 16 | 12 | 250 | 5 | 0.53 | 3 |
135
+ | M5 | 16 | 16 | 225 | 2 | 0.40 | 4 |
136
+ | M2 | 16 | 8 | 200 | 3 | 0.30 | 5 |
137
+
138
+ ---
139
+
140
+ ## 📋 Input File Requirements
141
+
142
+ - CSV format only
143
+ - First column must contain alternative names
144
+ - Remaining columns must be numeric
145
+ - No missing values
146
+ - Minimum 2 criteria columns required
147
+
148
+ ---
149
+
150
+ ## ⚠️ Important Notes
151
+
152
+ - Number of weights must equal number of criteria columns
153
+ - Number of impacts must equal number of criteria columns
154
+ - Weights must be positive numbers
155
+ - Impacts must be either + or -
156
+ - All criterion values must be numeric
157
+
158
+ ---
159
+
160
+ ## 🔧 How TOPSIS Works
161
+
162
+ 1. Normalize the decision matrix
163
+ 2. Apply weights to normalized values
164
+ 3. Determine ideal best and ideal worst solutions
165
+ 4. Compute distances from ideal best and worst
166
+ 5. Calculate closeness coefficient
167
+ 6. Rank alternatives based on score
168
+
169
+ ---
170
+
171
+ ## 📝 License
172
+
173
+ This project is licensed under the MIT License.
174
+
175
+ ---
176
+
177
+ ## 👤 Author
178
+
179
+ **Prabhsimar Singh**
180
+ Roll Number: 102483078
181
+
182
+ ---
183
+
184
+ ## 📚 Academic Note
185
+
186
+ This package was developed as part of an academic assignment for
187
+ **UCS654 – Prescriptive Analytics**
@@ -0,0 +1,10 @@
1
+ README.md
2
+ setup.py
3
+ Topsis_Prabhsimar_102483078.egg-info/PKG-INFO
4
+ Topsis_Prabhsimar_102483078.egg-info/SOURCES.txt
5
+ Topsis_Prabhsimar_102483078.egg-info/dependency_links.txt
6
+ Topsis_Prabhsimar_102483078.egg-info/entry_points.txt
7
+ Topsis_Prabhsimar_102483078.egg-info/requires.txt
8
+ Topsis_Prabhsimar_102483078.egg-info/top_level.txt
9
+ topsis_prabhsimar_102483078/__init__.py
10
+ topsis_prabhsimar_102483078/topsis.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ topsis = topsis_prabhsimar_102483078.topsis:topsis
@@ -0,0 +1 @@
1
+ topsis_prabhsimar_102483078
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,34 @@
1
+ from setuptools import setup, find_packages
2
+ from pathlib import Path
3
+
4
+ # Read README.md for PyPI description
5
+ this_directory = Path(__file__).parent
6
+ long_description = (this_directory / "README.md").read_text(encoding="utf-8")
7
+
8
+ setup(
9
+ name="Topsis-Prabhsimar-102483078",
10
+ version="1.0.2",
11
+ author="Prabhsimar Singh",
12
+ author_email="prabhsimar@example.com",
13
+ description="A Python package for TOPSIS multi-criteria decision making",
14
+ long_description=long_description,
15
+ long_description_content_type="text/markdown",
16
+ packages=find_packages(),
17
+ install_requires=[
18
+ "numpy",
19
+ "pandas"
20
+ ],
21
+ python_requires=">=3.6",
22
+ classifiers=[
23
+ "Programming Language :: Python :: 3",
24
+ "Operating System :: OS Independent",
25
+ "License :: OSI Approved :: MIT License",
26
+ "Intended Audience :: Education",
27
+ "Topic :: Scientific/Engineering",
28
+ ],
29
+ entry_points={
30
+ "console_scripts": [
31
+ "topsis=topsis_prabhsimar_102483078.topsis:topsis"
32
+ ]
33
+ },
34
+ )
@@ -0,0 +1,77 @@
1
+ import pandas as pd
2
+ import numpy as np
3
+ import sys
4
+ import os
5
+
6
+ def topsis():
7
+ if len(sys.argv) != 5:
8
+ print("Usage: topsis <InputFile> <Weights> <Impacts> <OutputFile>")
9
+ sys.exit(1)
10
+
11
+ input_file = sys.argv[1]
12
+ weights = sys.argv[2]
13
+ impacts = sys.argv[3]
14
+ output_file = sys.argv[4]
15
+
16
+ if not os.path.isfile(input_file):
17
+ print("Error: Input file not found")
18
+ sys.exit(1)
19
+
20
+ data = pd.read_csv(input_file)
21
+
22
+ if data.shape[1] < 3:
23
+ print("Error: Input file must contain at least 3 columns")
24
+ sys.exit(1)
25
+
26
+ try:
27
+ criteria = data.iloc[:, 1:].astype(float)
28
+ except:
29
+ print("Error: Criteria columns must be numeric")
30
+ sys.exit(1)
31
+
32
+ weights = weights.split(",")
33
+ impacts = impacts.split(",")
34
+
35
+ if len(weights) != criteria.shape[1] or len(impacts) != criteria.shape[1]:
36
+ print("Error: Number of weights, impacts, and criteria columns must match")
37
+ sys.exit(1)
38
+
39
+ try:
40
+ weights = np.array(weights, dtype=float)
41
+ except:
42
+ print("Error: Weights must be numeric")
43
+ sys.exit(1)
44
+
45
+ for i in impacts:
46
+ if i not in ["+", "-"]:
47
+ print("Error: Impacts must be '+' or '-'")
48
+ sys.exit(1)
49
+
50
+ norm = np.sqrt((criteria ** 2).sum())
51
+ normalized = criteria / norm
52
+ weighted = normalized * weights
53
+
54
+ ideal_best = []
55
+ ideal_worst = []
56
+
57
+ for i in range(weighted.shape[1]):
58
+ if impacts[i] == "+":
59
+ ideal_best.append(weighted.iloc[:, i].max())
60
+ ideal_worst.append(weighted.iloc[:, i].min())
61
+ else:
62
+ ideal_best.append(weighted.iloc[:, i].min())
63
+ ideal_worst.append(weighted.iloc[:, i].max())
64
+
65
+ ideal_best = np.array(ideal_best)
66
+ ideal_worst = np.array(ideal_worst)
67
+
68
+ dist_best = np.sqrt(((weighted - ideal_best) ** 2).sum(axis=1))
69
+ dist_worst = np.sqrt(((weighted - ideal_worst) ** 2).sum(axis=1))
70
+
71
+ score = dist_worst / (dist_best + dist_worst)
72
+ rank = score.rank(ascending=False, method="dense")
73
+
74
+ data["Topsis Score"] = score
75
+ data["Rank"] = rank.astype(int)
76
+
77
+ data.to_csv(output_file, index=False)