GithubHelp home page GithubHelp logo

gurobi / modeling-examples Goto Github PK

View Code? Open in Web Editor NEW
568.0 28.0 262.0 66.5 MB

Gurobi modeling examples

Home Page: https://gurobi.github.io/modeling-examples/

License: Apache License 2.0

Jupyter Notebook 99.94% HTML 0.01% Python 0.04% SCSS 0.01%

modeling-examples's Introduction

Gurobi

Target audience

Data scientists, engineers, computer scientists, economists, and in general, professionals with a background in mathematical modeling and a basic knowledge of Python.

Goals of modeling examples

  • Illustrate the broad applicability of mathematical optimization.
  • Show how to build mathematical optimization models.

These modeling examples are coded using the Gurobi Python API and distributed as Jupyter Notebooks.

These modeling examples illustrate important capabilities of the Gurobi Python API, including adding decision variables, building linear expressions, adding constraints, and adding an objective function. They touch on more advanced features such as generalized constraints, piecewise-linear functions, and multi-objective hierarchical optimization. They also illustrate common constraint types such as “allocation constraints”, “balance constraints”, “sequencing constraints”, “precedence constraints”, and others.

The examples are from different business purposes and reflect different levels of building mathematical optimization models.

Introductory examples

The introductory examples walk you through the process of building a mathematical optimization model. The basic requirements are that you know Python and have a background in a discipline that uses quantitative methods.

Beginner Examples

The notebooks at the beginner level assume you know Python and have some knowledge about building mathematical optimization models.

  • 3D Tic-Tac-Toe: This example will show you how a binary programming model can be used to capture simple logical constraints.
  • Cell Tower: In this example, you will learn how to define and solve a covering-type problem, namely, how to configure a network of cell towers to provide signal coverage to the largest number of people.
  • Curve Fitting: Try this Jupyter Notebook Modeling Example to learn how you can fit a function to a set of observations.
  • Facility Location: In this example, we will show you how to tackle a facility location problem that involves determining the number and location of warehouses that are needed to supply a group of supermarkets.
  • Fantasy Basketball: This example combines machine learning and optimization modeling in fantasy basketball.
  • Food Program: Transporting food in a global transportation network is a challenging undertaking. In this notebook, we will build an optimization model to set up a food supply chain based on real data from the UN World Food Program.
  • Market Sharing: In this example, we will show you how to solve a goal programming problem that involves allocating the retailers to two divisions of a company in order to optimize the trade-offs of several market-sharing goals.
  • Marketing Campaign Optimization: Companies across almost every industry are looking to optimize their marketing campaigns. In this Jupyter Notebook, we will explore a marketing campaign optimization problem that is common in the banking and financial services industry, which involves determining which products to offer to individual customers in order to maximize total expected profit while satisfying various business constraints.
  • Offshore Wind Farming: In this example, we will learn how to solve an offshore wind power generation problem. The goal of the problem is to figure out which underwater cables should be laid to connect an offshore wind farm power network at a minimum cost.
  • Supply Network Design 1: Try this Jupyter Notebook Modeling Example to learn how to solve a classic supply network design problem that involves finding the minimum cost flow through a network. We will show you how – given a set of factories, depots, and customers – you can use mathematical optimization to determine the best way to satisfy customer demand while minimizing shipping costs. In part 2, we additionally determine which depots to open or close in order to minimize overall costs.

Intermediate Examples

Examples at the intermediate level assume that you know Python and are familiar with the Gurobi Python API. In addition, you should have knowledge about building mathematical optimization models.

  • Agricultural Pricing: Try this example to learn how to use mathematical optimization to tackle a common, but critical agricultural pricing problem: Determining the prices and demand for a country’s dairy products in order to maximize total revenue derived from the sales of those products. You will learn how to model this problem as a quadratic optimization problem using the Gurobi Python API and solve it using the Gurobi Optimizer.
  • Linear Regression: In this example, you will learn how to perform linear regression with feature selection using mathematical programming. We will show you how to construct a mixed-integer quadratic programming (MIQP) model of this linear regression problem.
  • Car Rental: This notebook will teach you how you can use mathematical optimization to figure out how many cars a car rental company should own and where they should be located every day to maximize weekly profits. Part 2 considers an extension on how mathematical optimization can be used to figure out in which locations a car rental company should expand repair capacity.
  • Customer Assignment: This notebook is an intermediate version of the facility location problem. In addition, we show how machine learning can be used in the pre-processing so as to reduce the computational burden of big datasets.
  • Economic Planning: In this example, you will discover how mathematical optimization can be used to address a macroeconomic planning problem that a country may face. The goal is to determine different possible growth patterns for the economy.
  • Efficiency Analysis: How can mathematical optimization be used to measure the efficiency of an organization? Find out in this example, where you will learn how to formulate an Efficiency Analysis model as a linear programming problem.
  • Electrical Power Generation: This model is an example of an electrical power generation problem (also known as a unit commitment problem). It selects an optimal set of power stations to turn on in order to satisfy anticipated power demand over a 24-hour time horizon. In part 2, the model is extended and adds the option of using hydroelectric power plants to satisfy demand.
  • Factory Planning: In this example, we create an optimal production plan that maximizes profits. In part 2, we create an optimal production plan that will not only maximize profits but also determine the months in which to perform maintenance operations on the machines.
  • Food Manufacturing: You will learn how to create an optimal multi-period production plan for a product that requires a number of ingredients – each of which has different costs, restrictions, and features. In part 2, additional constraints are considered that change the problem type from a linear program (LP) problem to a mixed-integer program (MIP) problem, making it harder to solve.
  • Logical Design: In this example, you will learn how to solve a logical design problem, which involves constructing a circuit using the minimum number of NOR gates (devices with two inputs and one output) that will perform the logical function specified by a truth table.
  • Mining: In this example, you will learn how to model and solve a multi-period production planning problem that involves optimizing the operations of a group of mines over a five-year period.
  • Opencast Mining: This notebook shows a mathematical optimization problem to identify which excavation locations to choose in order to maximize the gross margins of extracting ore.
  • Power Generation: Assume that we know the set of all available power plants and the demand for power for each hour of a day. We want to create a schedule to decide how much power each plant should generate, and when to switch the plants “on” and “off” in order to minimize the overall costs.
  • Refinery: This model is an example of a production planning problem where decisions must be made regarding which products to produce and which resources to use.
  • Technician Routing and Scheduling: Try this modeling example to discover how mathematical optimization can help telecommunications firms automate and improve their technician assignment, scheduling, and routing decisions in order to ensure the highest levels of customer satisfaction. You will learn how to formulate a multi-depot vehicle routing problem with time windows constraints.

Advanced Examples

For modeling examples at the advanced level, we assume that you know Python and the Gurobi Python API and that you have advanced knowledge of building mathematical optimization models. Typically, the objective function and/or constraints of these examples are complex or require advanced features of the Gurobi Python API.

  • Constraint Optimization: In this example, we consider a constraint of an integer programming model where all the decision variables in the constraint are binary, the goal is to find another constraint involving the same binary variables that is logically equivalent to the original constraint, but that has the smallest possible absolute value of the right-hand side.
  • Decentralization Planning: This model is an advanced version of a facility location problem. Given a set of departments of a company and potential cities where these departments can be located, we want to determine the "best" location of each department in order to maximize gross margins.
  • Farm Planning: This is an example of an advanced production planning problem.
  • Lost Luggage Distribution: This is an example of a vehicle routing problem with time windows. It involves helping a company figure out the minimum number of vans required to deliver pieces of lost or delayed baggage to their rightful owners and determining the optimal assignment of vans to customers.
  • Manpower Planning: This notebook solves a staffing planning problem where choices must be made regarding recruitment, training, redundancy, and scheduling of staff.
  • Milk Collection: This is an example of a capacitated vehicle routing problem. With only one tanker truck with limited capacity, you will need to determine the best possible route for the tanker to take to collect milk every day from a set of farms.
  • Portfolio Selection Optimization: This model is an example of the classic Markowitz portfolio selection optimization model. We want to find the fraction of the portfolio to invest among a set of stocks that balances risk and return. It is a Quadratic Programming (QP) model with vector and matrix data for returns and risk, respectively.
  • Pooling: Companies across numerous industries – including petrochemical refining, wastewater treatment, and mining – use mathematical optimization to solve the pooling problem. This problem can be regarded as a generalization of the minimum-cost flow problem and the blending problem.
  • Protein Comparison: You will learn how to model the protein comparison problem as a quadratic assignment problem. It involves measuring the similarities of two proteins.
  • Protein Folding: The problem pertains to a protein, which consists of a chain of amino acids. The objective is to predict the optimum folding of the chain.
  • Traveling Salesman: This notebook covers one of the most famous combinatorial optimization problems in existence: the Traveling Salesman Problem (TSP). The goal of the TSP – to find the shortest possible route that visits each city once and returns to the original city – is simple, but solving the problem is a complex and challenging endeavor. This example uses the callback feature of Gurobi.
  • Workforce Scheduling: In this notebook, we demonstrate how you can use mathematical optimization to generate an optimal workforce schedule that minimizes the number of temporary workers your company needs to hire and maximizes employee fairness. The problem is formulated as a multi-objective mixed-integer-programming (MIP) model and uses the multiple objectives feature of Gurobi.
  • Yield Management: In this example, we will show you how an airline can use AI technology to devise an optimal seat pricing strategy. You will learn how to formulate this Yield Management Problem as a three-period stochastic programming problem.

Examples via Business Needs

Automation
Customer Management
Forecasting
Inventory Optimization
Location Planning
Logistics
Marketing
Network Optimization
Operations
Portfolio Management
Production
Research
Resource
Routing
Sales Optimization
Supply Chain
Allocation/Scheduling

It is also possible to browse through the examples w.r.t. difficulty level and business needs on the Gurobi website.

Run on Google Colab

You can access all the examples in Google Colab, which is a free, online Jupyter Notebook environment that allows you to write and execute Python code through your browser. You will need to be signed into a Google account to execute the notebooks. But you do not need an account if you just want to look at the notebooks. For each example, the respective colab link is given in the readme:

  • To run the example the first time, choose “Runtime” and then click “Run all”.
  • All the cells in the Jupyter Notebook will be executed.
  • The example will install the gurobipy package. The Gurobi pip package includes a size-limited trial license equivalent to the Gurobi "online course" license. For most of the notebooks, this restricted license is sufficient to run them. For others, you will need a full license, see the license section below.
  • You can also modify and re-run individual cells.
  • For subsequent runs, choose “Runtime” and click “Restart and run all”.
  • The Gurobi Optimizer will find the optimal solution of the modeling example. Check out the Colab Getting Started Guide for full details on how to use Colab Notebooks as well as create your own.

Run locally

  • Clone the repository containing all examples or download it by clicking here
  • Start Jupyter Notebook Server
  • Open the particular notebook in Jupyter Notebook.
  • The notebook will install the gurobipy package and other dependencies. The Gurobi pip package includes a size-limited trial license equivalent to the Gurobi "online course" license. For most of the notebooks, this restricted license is sufficient. For others, you will need a full license.

Licensing

In order to run the Jupyter Notebooks you will need a Gurobi license. Most of the notebooks can be run using the "online course" license version of Gurobi. This is a limited license and restricts the number of allowed variables and constraints. This restricted license comes also with the gurobipy package when installing it via pip or conda. You can also request a full license, i.e., an evaluation license as a commercial user, or download a free license as an academic user. The latter two license types allow you to run all notebooks. All licenses can also be requested in the Gurobi User Portal after registering for a Gurobi account.

Download the repository

You can download the repository containing all examples by clicking here.

Index of modeling examples

These modeling examples are distributed under the Apache 2.0 license
© Gurobi Optimization, LLC

modeling-examples's People

Contributors

cozad-gurobi avatar erothberg avatar fnxcorp avatar gglockner avatar jaczynski avatar lindsaynmontanari avatar maliheha avatar marika-k avatar mattmilten avatar orojuan avatar panitzin avatar venaturum avatar yurchisin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

modeling-examples's Issues

Broken link in predict_bike_flow.ipynb

In modeling-examples/optimization101/bike_share/predict_bike_flow.ipynb we try to download a dataset at:

https://s3.amazonaws.com/tripdata/202207-citbike-tripdata.csv.zip

It no longer exists. I'll see if I can find it somewhere else.

music_recommendation.ipynb cannot run under python 3.12

modeling-examples/music_recommendation/music_recommendation.ipynb relies on lightfm.

The following works in an empty py311 environment:

python -m pip install --upgrade pip setuptools wheel
python -m pip install lightfm

but fails to build in an empty py312 environment. Consequently the notebook can't be used with py312.

technician_routing_scheduling: Possible typo or missing concept.

Hi there, thanks for this great example which I am following - it is really good!

In the model formulation, we have:
image

I see that we have:
d∈D={n+1,n+2,...,n+m}: Index and set of depots (service centers), where m is the number of depots.
I am confused as to how there can be n+m depots.
I am also confused as to why the set starts from n+1 instead of 1. In the example there are two depots, not 9 i.e 2+7.

I have run into something similar when studying the literature (Ramkumar et al 2012, their formulation also has confusing indices for the number of depots:
image
)
This makes me think I am missing some key concept in the formulation (as opposed to a typo).
Any enlightenment would be greatly appreciated.

Edit: Indeed, the paper referenced in the notebook also notes "(1,..,n+m) where the m depots are represented by n+1,...,n+m" but does not state their reasoning for doing so. (S. Salhi, A. Imran, N. A. Wassan. The multi-depot vehicle routing problem with heterogeneous vehicle fleet: Formulation and a variable neighborhood search implementation. Computers & Operations Research 52 (2014) 315-325.)

Edit 2: However, in the Supply Network I example, we have something that makes more sense (to me).:
image
Here there is no (n+1...n+m) indexing.

Lack of control in Google Colab environment

Some notebooks have been broken recently by changes in packages, eg

gurobipy 10 -> gurobipy 11
pandas 1 -> pandas 2
gensim not compatible with SciPy 1.13.0

We need to have tight control over the python environment that these notebooks are run under, especially on Google Colab. Unfortunately Colab does not provide a nice way of facilitating this.

I'm proposing we create a public repo modeling-examples-requirements in which we setup a codeless python package with pinned dependencies, essentially creating a lock file in package form. The sole purpose of this package is to tightly control the package versions in an any environment it is installed into. Then in notebooks we only have to have %pip install /path/to/modeling-examples-requirements.git (or something like that).

We could even be fancy and define a separate set of requirements on some different branches to cater for certain notebooks, and avoid having one huge environment. There'd probably be less than 10 different such branches needed.

[Question] Why x.sum() on constraint takes so long?

Hello there!
Using this as base example

I am probably doing something wrong here. I have a distance matrix with costs for traveling from point to point. Not using facility fixed cost, so I want to limit the number of facilities just to fulfill the total demand, such as:

open = m.addVars(list(dict_capacity.keys()), vtype=GRB.BINARY, name="open") #dict capacity has the capacities as values

open_max = m.addVar(vtype=GRB.INTEGER, name="max_open_opportunities", lb=1, ub=32)
m.addConstr(open_max == open.sum())

Assuming that 32 is the max number of facilities I want open, the model takes too long. The way I understood, open.sum() is supposed to give me the sum of the Binary variables on that solution, ie. the number of open facilities. Is it not supposed to have this quicksum quite fast?

m.addConstrs(
            (
                open.sum() * dict_capacity[capacity] <= total_demand + 100
                for capacity in list(dict_capacity.keys())
            )
        )

This is a less hardcoded version I made to test. It works (opens 31 facilities), only because all facilities have 80 units to offer. But it takes so long that I need to Control+C to get objetive value and opened facilities.

open has 628 items

Thanks for your time!

Both the training MSE and RSS decrease monotonically as more features are considered

\end{equation}<p>This model, by means of constraint 2, implicitly considers all ${{d-1} \choose s}$ feature subsets at once. However, we also need to find the value for $s$ that maximizes the performance of the regression on unseen observations. Notice that the training RSS decreases monotonically as more features are considered (which translates to relaxing the MIQP), so it is not advisable to use it as the performance metric. Instead, we will estimate the Mean Squared Error (MSE) via cross-validation. This metric is defined as $\text{MSE}=\frac{1}{n}\sum_{i=1}^{n}{(y_i-\hat{y}_i)^2}$, where $y_i$ and $\hat{y}_i$ are the observed and predicted values for the ith observation, respectively. Then, we will fine-tune $s$ using grid search, provided that the set of possible values is quite small.</p>

RSS vs MSE

This paragraph mentioned that it is not advisable to use RSS as the performance metric, but MSE via cross-validation.

I think the highlight on MSE over RSS is misleading. Note that, given estimate $\hat\beta$,

$$ \mathrm{RSS} = (y-X\hat\beta)^T(y-X\hat\beta) = \sum (y_i - \hat{y}_i)^2 = n \cdot \mathrm{MSE} $$

So, both the training MSE and RSS decrease monotonically as more features are considered, not only RSS.

Cross-validation

The cross-validation part should be the correct. That is, we use grid search to find best $s$.

traveling_salesman "Model Code": RuntimeError: dictionary changed size during iteration

In tsp.ipynb, when excuting the "Model Code" part, you may get a RuntimeError: dictionary changed size during iteration error on

for i, j in vars.keys():
    vars[j, i] = vars[i, j]  # edge in opposite direction

This is because in the "Data computation" part, when creating variable dist, the following code

dist = {(c1, c2): distance(c1, c2) for c1, c2 in combinations(capitals, 2)}

creates a n(n-1)/2 length dictionary, which means variable dist only contains distance[i,j] and does not contain distance[j,i],
for example ,it only contains dist[('Montgomery', 'Phoenix')] but does not contain dist[('Phoenix',Montgomery')]
This leads to further problem when creating and initializing decision variables for gurobi model:

m = gp.Model()

# Variables: is city 'i' adjacent to city 'j' on the tour?
vars = m.addVars(dist.keys(), obj=dist, vtype=GRB.BINARY, name='x')

# Symmetric direction: Copy the object
for i, j in vars.keys():
    vars[j, i] = vars[i, j]  # edge in opposite direction

As stated above, distance[j,i] does not exist, so vars[j, i] does not exist neither. For example, decision variable vars[('Montgomery', 'Phoenix')] exist but vars[('Phoenix',Montgomery')] does not exist, which makes vars[j, i] = vars[i, j] a RuntimeError.

So to fix this , the code
dist = {(c1, c2): distance(c1, c2) for c1, c2 in combinations(capitals, 2)}
should be changed to
dist = {(c1, c2): distance(c1, c2) for c1, c2 in permutations(capitals, 2)}
And of course you need to import itertools.combinations before using it.

@yurchisin

TypeError: must be real number, not Var

My objective function is this

\mbox{Average Profit under }(s_1,s_2,...,s_5)=\max \quad & \frac{1}{5}\sum_{k=1}^5 \left(\sum_{i=1}^m\sum_{j=1}^n (12.25-c_{ij})x_{ij}^k\right)\

Here's what I wrote
model.setObjective(quicksum((r-c[i,j]) * math.pow(x[i,j,k] ,k)for i in range(n) for j in range(m) for k in range(5)), GRB.MAXIMIZE)

Errors

-TypeError: must be real number, not Var

Large dataset for power schedule example is incomplete

In this example, we state that the full dataset can simply be read by replacing small_plant_data by large_plant_data. However, in that folder plant_capacities.csv is missing and the file plant_info_update.csv does not have the same structure so can't serve as an immediate replacement either. What is needed to import the large dataset?

Multiple Lineups from Pool fantasy_basketball_1_2

Hello,
This is a really great and detailed example of how to use gurobi to solve fantasy sports problems. I actually play draftkings , and have been trying to teach myself how to optimize using gurobi opti... Anyway, I have been attempting to use PoolSolutions to return the other solutions... example:

m.setObjective(obj, sense= GRB.MAXIMIZE)
m.setParam(GRB.Param.PoolSolutions, 500) ## finds 500 best lineups
m.setParam(GRB.Param.PoolSearchMode, 2) ## makes sure these are the best solutions (2)
m.update()

m.optimize()
nSolutions = m.SolCount
print('Number of solutions found: ' + str(nSolutions))
for e in range(nSolutions):
    m.setParam(GRB.Param.SolutionNumber, e)

    for v in m.getVars():
        if v.xN ==1:   ### Help I'm stuck

..... How would I modify your colab notebook to print and save all 500 lineups. I have tried for hours, but just don't have a deep enough understanding of the syntax with gurobi and also creating the correct df calls for this. This isn't an issue, as much as a question . Thanks so much in advance, as I know there's no benefit to you helping me. Again, great work and thank you for sharing on github.

proposal to avoid nx.nx_pydot.graphviz_layout

In modeling-examples/food_program/food_supply.ipynb we draw a network with nx.nx_pydot.graphviz_layout which requires an external program called Graphviz to be installed.

We can get essentially the same plot with nx.kamada_kawai_layout which is implemented entirely within the networkx package.

image

Moving to nx.kamada_kawai_layout will make it easier for automated testing.

How Indicator constraint can be triggered with multiple variables in Gurobi?

Dear Sir/Madam,

I am trying to write the constraint related to multiple variables. However, it shows error "Indicator constraints can only be triggered by a single binary variable at a given value". Can you help me fix this error? Thank you very much!
The code is following:
mdl.addConstrs((x[i,j,k] - t[i,j,k] == 1) >> (d2[j,k] == d2[i,k] - d[i,j]) for i, j, k in arcos2 if i != 0 and j != 0)

Where:

  • x[i,j,k], t[i,j,k] are binary variables
  • d2[j,k], d2[i,k] are continuous variables
  • d[i,j] is a parameter

I have an issue using this model with different data. Can anyone help?

Hi everyone!
I'm modeling with Gurobi, and I'm trying to model an efficiency analysis using different sets of data.
I can't solve the model because it says: "ValueError: not enough values to unpack (expected 3, got 2)".
I attach my model, can anyone understand why it doesn't work?
Thank you in advance!
Matteo

` import pandas as pd
from itertools import product

import gurobipy as gp
from gurobipy import GRB

def solve_DEA(target, verbose=True):
# input-output values for the garages
inattr = ['Cash', 'LEV']
outattr = ['EPS', 'ROA']
dmus,inputs, outputs = gp.multidict({
'DMU1':[{'Cash':0.2485, 'LEV':0.4688 , 'EPS':4, 'ROA':0.2002 }], 'DMU2':[{'Cash':0.1284, 'LEV':0.6539 , 'EPS':3.70, 'ROA':0.0902 }], 'DMU3':[{'Cash':0.293, 'LEV':0.5644 , 'EPS':4.20, 'ROA':0.1627 }]

})

### Create LP model
model = gp.Model('DEA')

# Decision variables
wout = model.addVars(outattr, name="outputWeight")
win = model.addVars(inattr, name="inputWeight")


# Constraints
ratios = model.addConstrs( ( gp.quicksum(outputs[h][r]*wout[r] for r in outattr ) 
                            - gp.quicksum(inputs[h][i]*win[i] for i in inattr ) 
                            <= 0 for h in dmus ), name='ratios' )

normalization = model.addConstr((gp.quicksum(inputs[target][i]*win[i] for i in inattr ) == 1 ),
                                name='normalization')

# Objective function

model.setObjective( gp.quicksum(outputs[target][r]*wout[r] for r in outattr ), GRB.MAXIMIZE)

# Run optimization engine
if not verbose:
    model.params.OutputFlag = 0
model.optimize()

# Print results
print(f"\nThe efficiency of target DMU {target} is {round(model.objVal,3)}") 

print("__________________________________________________________________")
print(f"The weights for the inputs are:")
for i in inattr:
    print(f"For {i}: {round(win[i].x,3)} ") 
    
print("__________________________________________________________________")
print(f"The weights for the outputs are")
for r in outattr:
    print(f"For {r} is: {round(wout[r].x,3)} ") 
print("__________________________________________________________________\n\n")  

return model.objVal

dmus = ['DMU1', 'DMU2', 'DMU3']

performance = {}
for h in dmus:
performance[h] = solve_DEA(h, verbose=False)_
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.