WS 2.5: Profit vs Planet

No description has been provided for this image No description has been provided for this image

CEGM1000 MUDE: Week 2.5, Optimization. For: December 11, 2024

Part 1: Overview and Mathematical Formulation

A civil engineering company wants to decide on the projects that they should do. Their objective is to minimize the environmental impact of their projects while making enough profit to keep the company running.

They have a portfolio of 6 possible projects to invest in, where A, B , and C are new infrastructure projects (so-called type 1), and D, E, F are refurbishment projects (so-called type 2).

The environmental impact of each project is given by $I_i$ where $i \in [1,(...),6]$ is the index of the project. $I_i=[90,45,78,123,48,60]$

The profit of each project is given by $P_i$ where $i\in [1,(...),6]$ is the index of the project: $P_i=[120,65,99,110,33,99]$

The company is operating with the following constraints, please formulate the mathematical program that allows solving the problem:

  • The company wants to do 3 out of the 6 projects
  • the projects of type 2 must be at least as many as the ones of type 1
  • the profit of all projects together must be greater or equal than $250$ ($\beta$)

You may want to look at the linear optimisation example from the MUDE book

Task 1: Writing the mathematical formulation

Write down every formulation and constraint that is relevant to solve this optimization problem.

Your answer here.

Task 2: Setting up the software

We'll continue using Gurobi this week, which you've set up in last week's PA. We'll use some other special packages as well. Therefore, be sure to use the special conda environment created for this week.

In [ ]:
import gurobipy as gp

Task 3: Setting up the problem

Define any variables you might need to setup your model.

In [ ]:
# Project data
YOUR_CODE_HERE

# Minimum required profit
YOUR_CODE_HERE

# Number of projects and types
YOUR_CODE_HERE

Part 2: Create model with Gurobi

Remember that examples of using Gurobi to create and optimize a model are provided in the online textbook, and generally consist of the following steps (the first instantiates a class and the rest are executed as methods of the class):

  1. Define the model (instantiate the class)
  2. Define variables
  3. Define objective function
  4. Add constraints
  5. Optimize the model

Remember, you can always ask for help to understand a function of gurobi

help(gurobipy.model.addVars)

Task 4: Create the Gurobi model

Create the Gurobi model, set your decision variables, your function and your constrains. Take a look at the book for an example implementation in Python if you don't know where to start.

In [ ]:
YOUR_CODE_HERE

Task 5: Display your results

Display the model in a good way to interpret and print the solution of the optimization.

In [ ]:
YOUR_CODE_HERE

Task 6: Additional constraint

Solve the model with an additional constraint: if project 1 is done then the impact of all projects together should be lower than $\gamma$ with $\gamma=130$.

Paste your model previous model, and call it model2 to keep the results separated and add the new constraint. Then run your second model.

In [ ]:
YOUR_CODE_HERE

End of notebook.

© Copyright 2024 MUDE TU Delft. This work is licensed under a CC BY 4.0 License.