Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setup for the code

#############SOME EXPLANATION#############

The setup can be done as follows. Feel free to skip sections if needed.

Windows Setup

  • Python Setup

    • Python Installation To begin, you need to have Python installed on your Windows system. Follow these steps:
    1. Download Python
  • Visit the official Python website: https://www.python.org/downloads/

  • Download the latest version of Python for Windows.

2. **Install Python**
  • Run the installer and make sure to check the box "Add Python to PATH" during the installation process.
  • Complete the installation by following the on-screen instructions.
3. **Verify Python Installation**
  • Open the Command Prompt (cmd) and verify the installation by running:

    python --version
  • You should see the Python version printed in the terminal, indicating a successful installation.

  • Setting up the Python Environment

  1. Create a Virtual Environment It’s recommended to create a virtual environment to manage your project dependencies separately. Open the Command Prompt and navigate to your project folder:
    cd path\to\your\project
Run the following command to create a virtual environment:
 ```bash
 python -m venv venv
 ```
  1. Activate the Virtual Environment After creating the virtual environment, activate it by running:
venv\Scripts\activate
- Requirement.txt
```bash
pip install -r requirements.txt
```

Give the input file in following format shown in the picture below (only shown top 3 rows)

You need to give the either of two input arguement True or False to file linear_optimizer_controller.py for stablitiy default is considered to be false

K=5000
U1,224,318,162,2500
U2,224,318,162,2500
U3,244,318,244,2800
U4,244,318,244,2800
U5,244,318,285,3500
U6,244,318,285,3500
P-1,99,53,55,61,Economy,176
P-2,56,99,81,53,Priority,-
P-3,42,101,51,17,Priority,-
P-4,108,75,56,73,Economy,138
P-5,88,58,64,93,Economy,139

For Stablity=True

python3 linear_optimizer_controller.py True

For Stablity=False

python3 linear_optimizer_controller.py False

Linux Setup

  • Downloding important packages

    For Ubuntu
    sudo apt update
    sudo apt install python3 python-virtualenv
    For Fedora
     sudo dnf update
     sudo dnf install python3 python3-virtualenv
    For Arch
     sudo pacman -Syu
     sudo pacman -S python3 python3-virtualenv

    You can check if the python install properly by typing the folling command

    python3 --version
  • Setting up the Python Environment

    Locate to the folder where source folder is located

    Linux
    virtualenv venv
    source venv/bin/activate
    • Setting up the requirement

      Locate to the folder where source code is their
      pip install -r requirement.txt
  • Gurobi Setup

    NOTE :- Download the version 11.0.2 and place the file in which gurobi is installed You can also follow the youtube video by offical youtube channel of gurobi https://youtu.be/OYuOKXPJ5PI?si=hiixS1Pi_mqVBulR

    1. Register yourself at https://www.gurobi.com/ with your institute mail ID.
    2. Once logged in, click on Downloads and Licenses at the top. Under Download the Latest Version of Gurobi, click on Gurobi Optimizer.
    3. Scroll down to Current Version and download the appropriate version.
    4. In Linux, you will have downloaded a tar.gz file. Move this file to a folder where you want to install Gurobi. You can move it to /opt for a shared installation across users otherwise, your home directory should also work.
    5. Unzip the file by running the following command - tar xvfz gurobi<version>_linux64.tar.gz
    6. This will extract the contents into a new directory named by the Gurobi version, which will contain a sub-directory named linux64 (assuming you have x64 Linux). The full path to the linux64 directory is your <install-dir>.
    7. Open your .bashrc file (ls -a in your home directory, and you will find it) in any text editor and add the following lines at the end.
    export GUROBI_HOME=<install-dir>
    export PATH=$GUROBI_HOME/bin:$PATH
    export LD_LIBRARY_PATH=$"{LD_LIBRARY_PATH}:${GUROBI_HOME}/lib
    
    1. You need to restart the terminal after you make changes in the .bashrc file for the changes to take effect. Alternatively, you can run the command source ~/.bashrc to allow the changes to become active without needing to restart the terminal. (By restart, I mean, close and relaunch the terminal)
    2. The next step is to create a license. Go back to the Downloads and Licenses page. Scroll down to the Access your Licenses section and click on Your Gurobi Licenses. This will take you to a page listing all your licenses.
    3. On the left, click on Request and choose Named-User Academic or comercial liseanse and click Generate Now. This should generate the license and give you a grbgetkey command with your specific license details. Names-User Academic licenses are valid for 1 year. You can generate a new license when this one expires if you need to.
    4. Copy this command and run it in the terminal. It will ask for a location to store your license. It is recommended to accept the default location, but in case you want to store it anywhere else, you can do so and then add another line to your .bashrc file which specifies the location.
    export GRB_LICENSE_FILE=<License-File-Location>
    1. Gurobi should work now. You can test it by running the command gurobi_cl --version Some sources in case you are facing any issues
  • Code execution

Give the input file in following format shown in the picture below (only shown top 3 rows)

You need to give the either of two input arguement True or False to file linear_optimizer_controller.py for stablitiy default is considered to be false Ensure that the K is written in uppercase.

K=5000
U1,224,318,162,2500
U2,224,318,162,2500
U3,244,318,244,2800
U4,244,318,244,2800
U5,244,318,285,3500
U6,244,318,285,3500
P-1,99,53,55,61,Economy,176
P-2,56,99,81,53,Priority,-
P-3,42,101,51,17,Priority,-
P-4,108,75,56,73,Economy,138
P-5,88,58,64,93,Economy,139

For Stablity=True

python3 linear_optimizer_controller.py True

For Stablity=False

python3 linear_optimizer_controller.py False

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages