topsis-Prince-3619


Nametopsis-Prince-3619 JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/Prince-05/TOPSIS
SummaryA Python package to implement the TOPSIS method for decision making.
upload_time2025-01-17 20:39:20
maintainerNone
docs_urlNone
authorPrince
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements pandas numpy
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TOPSIS Package

This repository contains a Python implementation of the **TOPSIS** (Technique for Order of Preference by Similarity to Ideal Solution) method, a multi-criteria decision-making technique. The package supports command-line execution and enables users to calculate TOPSIS scores and rankings based on input data.

---

## **Features**
- Calculates TOPSIS scores and rankings for multi-criteria decision-making.
- Handles both positive and negative impacts of criteria.
- Provides results in a CSV file with scores and rankings.
- Fully customizable through weights and impacts specified as command-line arguments.

---

## **Installation**

To install the package from PyPI:

```bash
pip install topsis-Prince-3619
```

---

## **Usage**

### **Command-Line Interface (CLI)**
Run the TOPSIS program directly from the command line:

```bash
python3 -m Topsis <InputDataFile> <Weights> <Impacts> <ResultFileName>
```

### **Arguments**
1. `<InputDataFile>`: Path to the input CSV file.
   - The first column must contain object names (e.g., M1, M2, M3).
   - The remaining columns must contain numeric values for criteria.

2. `<Weights>`: Comma-separated weights for the criteria (e.g., `"1,1,1,2"`).

3. `<Impacts>`: Comma-separated impacts for the criteria (`+` for positive impact, `-` for negative impact).

4. `<ResultFileName>`: Name of the output CSV file where results will be saved.

---

## **Example**

### **Input Data**
Input file (`102203619-data.csv`):

| Model | Criterion 1 | Criterion 2 | Criterion 3 | Criterion 4 |
|-------|-------------|-------------|-------------|-------------|
| M1    | 250         | 16          | 12          | 5           |
| M2    | 200         | 18          | 8           | 3           |
| M3    | 300         | 14          | 16          | 10          |
| M4    | 275         | 17          | 10          | 8           |

### **Command**
```bash
topsis 102203619-data.csv "1,1,1,2" "+,+,-,+" result.csv
```

### **Output File**
Output file (`result.csv`):

| Model | Criterion 1 | Criterion 2 | Criterion 3 | Criterion 4 | Topsis Score | Rank |
|-------|-------------|-------------|-------------|-------------|--------------|------|
| M1    | 250         | 16          | 12          | 5           | 0.5346       | 2    |
| M2    | 200         | 18          | 8           | 3           | 0.3084       | 4    |
| M3    | 300         | 14          | 16          | 10          | 0.6912       | 1    |
| M4    | 275         | 17          | 10          | 8           | 0.5340       | 3    |

---

## **How It Works**
1. **Normalization**:
   The decision matrix is normalized using vector normalization:
   
   \[
   R_{ij} = \frac{a_{ij}}{\sqrt{\sum_{k=1}^{m} a_{kj}^2}}
   \]

2. **Weighted Normalized Matrix**:
   Each criterion is weighted according to user-defined weights:
   
   \[
   V_{ij} = R_{ij} \cdot w_j
   \]

3. **Identify Ideal Solutions**:
   - **Positive Ideal Solution (PIS)**: Maximum values for positive impacts and minimum values for negative impacts.
   - **Negative Ideal Solution (NIS)**: Minimum values for positive impacts and maximum values for negative impacts.

4. **Calculate Separation Measures**:
   - Separation from PIS (\( S_i^+ \)) and NIS (\( S_i^- \)) are computed using Euclidean distance.

5. **Calculate TOPSIS Scores**:
   - The score is calculated as:
     \[
     C_i = \frac{S_i^-}{S_i^+ + S_i^-}
     \]

6. **Rank Alternatives**:
   - Alternatives are ranked based on their scores, with higher scores indicating better performance.

---

## **Development**

### **Project Structure**
```
topsis-package/
├── topsis/
│   ├── __init__.py
│   ├── __main__.py
├── README.md
├── LICENSE
├── setup.py
├── pyproject.toml
└── MANIFEST.in
```

### **Dependencies**
- `numpy`
- `pandas`

### **Setup for Development**
1. Clone the repository:
   ```bash
   git clone https://github.com/Prince-05/TOPSIS
   ```
2. Navigate to the project directory:
   ```bash
   cd Topsis-Prince-3619
   ```
3. Install dependencies:
   ```bash
   pip install -r requirements.txt
   ```

---

## **Testing**
Run the tests to ensure the package works correctly:
```bash
pytest
```

---

## **License**
This project is licensed under the MIT License. See the `LICENSE` file for details.

---

## **Contributing**
Contributions are welcome! Please follow these steps:
1. Fork the repository.
2. Create a new branch for your feature or bug fix.
3. Submit a pull request with a detailed explanation of your changes.

---

## **Contact**
For any questions or issues, please contact:
- **Name**: Prince
- **Email**: pprince_be22@thapar.edu
- **GitHub**: [Prince-05](https://github.com/Prince-05)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Prince-05/TOPSIS",
    "name": "topsis-Prince-3619",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Prince",
    "author_email": "pprince_be22@thapar.edu",
    "download_url": "https://files.pythonhosted.org/packages/86/82/4da4694ead6a3a45c937b6e4128af9e07f80a7649a77d163eaccc5ff3b91/topsis_prince_3619-1.2.0.tar.gz",
    "platform": null,
    "description": "# TOPSIS Package\n\nThis repository contains a Python implementation of the **TOPSIS** (Technique for Order of Preference by Similarity to Ideal Solution) method, a multi-criteria decision-making technique. The package supports command-line execution and enables users to calculate TOPSIS scores and rankings based on input data.\n\n---\n\n## **Features**\n- Calculates TOPSIS scores and rankings for multi-criteria decision-making.\n- Handles both positive and negative impacts of criteria.\n- Provides results in a CSV file with scores and rankings.\n- Fully customizable through weights and impacts specified as command-line arguments.\n\n---\n\n## **Installation**\n\nTo install the package from PyPI:\n\n```bash\npip install topsis-Prince-3619\n```\n\n---\n\n## **Usage**\n\n### **Command-Line Interface (CLI)**\nRun the TOPSIS program directly from the command line:\n\n```bash\npython3 -m Topsis <InputDataFile> <Weights> <Impacts> <ResultFileName>\n```\n\n### **Arguments**\n1. `<InputDataFile>`: Path to the input CSV file.\n   - The first column must contain object names (e.g., M1, M2, M3).\n   - The remaining columns must contain numeric values for criteria.\n\n2. `<Weights>`: Comma-separated weights for the criteria (e.g., `\"1,1,1,2\"`).\n\n3. `<Impacts>`: Comma-separated impacts for the criteria (`+` for positive impact, `-` for negative impact).\n\n4. `<ResultFileName>`: Name of the output CSV file where results will be saved.\n\n---\n\n## **Example**\n\n### **Input Data**\nInput file (`102203619-data.csv`):\n\n| Model | Criterion 1 | Criterion 2 | Criterion 3 | Criterion 4 |\n|-------|-------------|-------------|-------------|-------------|\n| M1    | 250         | 16          | 12          | 5           |\n| M2    | 200         | 18          | 8           | 3           |\n| M3    | 300         | 14          | 16          | 10          |\n| M4    | 275         | 17          | 10          | 8           |\n\n### **Command**\n```bash\ntopsis 102203619-data.csv \"1,1,1,2\" \"+,+,-,+\" result.csv\n```\n\n### **Output File**\nOutput file (`result.csv`):\n\n| Model | Criterion 1 | Criterion 2 | Criterion 3 | Criterion 4 | Topsis Score | Rank |\n|-------|-------------|-------------|-------------|-------------|--------------|------|\n| M1    | 250         | 16          | 12          | 5           | 0.5346       | 2    |\n| M2    | 200         | 18          | 8           | 3           | 0.3084       | 4    |\n| M3    | 300         | 14          | 16          | 10          | 0.6912       | 1    |\n| M4    | 275         | 17          | 10          | 8           | 0.5340       | 3    |\n\n---\n\n## **How It Works**\n1. **Normalization**:\n   The decision matrix is normalized using vector normalization:\n   \n   \\[\n   R_{ij} = \\frac{a_{ij}}{\\sqrt{\\sum_{k=1}^{m} a_{kj}^2}}\n   \\]\n\n2. **Weighted Normalized Matrix**:\n   Each criterion is weighted according to user-defined weights:\n   \n   \\[\n   V_{ij} = R_{ij} \\cdot w_j\n   \\]\n\n3. **Identify Ideal Solutions**:\n   - **Positive Ideal Solution (PIS)**: Maximum values for positive impacts and minimum values for negative impacts.\n   - **Negative Ideal Solution (NIS)**: Minimum values for positive impacts and maximum values for negative impacts.\n\n4. **Calculate Separation Measures**:\n   - Separation from PIS (\\( S_i^+ \\)) and NIS (\\( S_i^- \\)) are computed using Euclidean distance.\n\n5. **Calculate TOPSIS Scores**:\n   - The score is calculated as:\n     \\[\n     C_i = \\frac{S_i^-}{S_i^+ + S_i^-}\n     \\]\n\n6. **Rank Alternatives**:\n   - Alternatives are ranked based on their scores, with higher scores indicating better performance.\n\n---\n\n## **Development**\n\n### **Project Structure**\n```\ntopsis-package/\n\u251c\u2500\u2500 topsis/\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u251c\u2500\u2500 __main__.py\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 LICENSE\n\u251c\u2500\u2500 setup.py\n\u251c\u2500\u2500 pyproject.toml\n\u2514\u2500\u2500 MANIFEST.in\n```\n\n### **Dependencies**\n- `numpy`\n- `pandas`\n\n### **Setup for Development**\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/Prince-05/TOPSIS\n   ```\n2. Navigate to the project directory:\n   ```bash\n   cd Topsis-Prince-3619\n   ```\n3. Install dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n---\n\n## **Testing**\nRun the tests to ensure the package works correctly:\n```bash\npytest\n```\n\n---\n\n## **License**\nThis project is licensed under the MIT License. See the `LICENSE` file for details.\n\n---\n\n## **Contributing**\nContributions are welcome! Please follow these steps:\n1. Fork the repository.\n2. Create a new branch for your feature or bug fix.\n3. Submit a pull request with a detailed explanation of your changes.\n\n---\n\n## **Contact**\nFor any questions or issues, please contact:\n- **Name**: Prince\n- **Email**: pprince_be22@thapar.edu\n- **GitHub**: [Prince-05](https://github.com/Prince-05)\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python package to implement the TOPSIS method for decision making.",
    "version": "1.2.0",
    "project_urls": {
        "Homepage": "https://github.com/Prince-05/TOPSIS"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b82b4ccb533b933306e43dbf2a04204e9b0b04aea71098fc023bc9977c17334c",
                "md5": "c0aced348f732ca9e87cf79d9d0dbf04",
                "sha256": "e403b3cf2187fb13bbe5bbd07ed44a12a5efb29f6c6b47f7cf1acd5d873d21c6"
            },
            "downloads": -1,
            "filename": "topsis_Prince_3619-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c0aced348f732ca9e87cf79d9d0dbf04",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 5677,
            "upload_time": "2025-01-17T20:39:18",
            "upload_time_iso_8601": "2025-01-17T20:39:18.109100Z",
            "url": "https://files.pythonhosted.org/packages/b8/2b/4ccb533b933306e43dbf2a04204e9b0b04aea71098fc023bc9977c17334c/topsis_Prince_3619-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "86824da4694ead6a3a45c937b6e4128af9e07f80a7649a77d163eaccc5ff3b91",
                "md5": "1ed8f5ccb8e700656bead39207798aa2",
                "sha256": "cea981376ea78a79c31673faefa3074c03ffa36f1d37bb1f295ad970647e149d"
            },
            "downloads": -1,
            "filename": "topsis_prince_3619-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1ed8f5ccb8e700656bead39207798aa2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 5280,
            "upload_time": "2025-01-17T20:39:20",
            "upload_time_iso_8601": "2025-01-17T20:39:20.638082Z",
            "url": "https://files.pythonhosted.org/packages/86/82/4da4694ead6a3a45c937b6e4128af9e07f80a7649a77d163eaccc5ff3b91/topsis_prince_3619-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-17 20:39:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Prince-05",
    "github_project": "TOPSIS",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.18.0"
                ]
            ]
        }
    ],
    "lcname": "topsis-prince-3619"
}
        
Elapsed time: 0.72014s