# Questions tagged [python]

For questions about solving Operations Research problems using the Python programming language.

116 questions
Filter by
Sorted by
Tagged with
26 views

### Python, Google OR-Tools, OnlyEnforceIf() method

I am trying to solve a basic puzzle by using Google OR-Tools, this is my first try with OR-Tools and I am trying to learn. I completed almost everything and was ready to conclude the program until I ...
35 views

### Modeling the multiplication of two binary decision variables in undirected graph in python

In an undirected graph, I'm trying to model a constraint that forcing the optimizer to set an edge $(u,v)$ between two nodes to only exist (= $1$) if the two nodes have been selected to be $1$. The ...
14 views

### Implement geometric constraint using DOCplex

currently I'm working on a wind farm layout optimization problem. I found an appropriate model in literature (Fischetti et al.) and now I'm trying to reproduce it using the Python API of cplex with ...
21 views

### MILP formualtion for Two-level minimum dominating set (MDS) problem?

I'm working on an optimization problem which is kind of finding the minimum dominating set (MDS) or the minimum vertex set (MVS) in an undirected graph. given the MILP formulation for both problems, I ...
57 views

### Maximum bipartite matching with breakpoints in edge weight function

I am looking for an analogy to the problem I am facing or better yet a paper or even code. I have: Nodes from set A and B. Edges are from a single A to many B. I am framing a max bipartite matching ...
70 views

### Is the order of edges in graph is changing the optimization result?

I am solving an optimization problem using Pulp and NetworkX. The problem is similar to the Minimum Vertex Set (MVS) problem. I have noticed that the optimizer is Scanning the edges according to their ...
66 views

### Sum of links neighbors in a graph

I'm trying to model this constraint in an optimization problem using Pulp and NetworkX. Here is a piece of code I'm using. ...
109 views

116 views

### Representing Date Variables in Pulp

I am working on an optimisation problem that involves minimising shipping demurrage. I am struggling to model how to represent the difference, (x-y) between dates where the ship is ready to be loaded ...
69 views

### Pyomo: Struggling to get a constraint to work

I am trying to model an Electric Vehicle scheduling to minimise the electricity bill. Of course, the EV will only be able to charge every time that is plugged into a charging station (i.e. it cannot ...
591 views

### Fast algorithm for Transportation Problem in Python?

Transportation Problem can be solved with simplex algorithm, but it's time demanding. I'm wondering if there exist a specific Python-implemented algorithm with low complexity. Thanks
735 views

I have just installed Anaconda and am intending to use Spyder as it is able to display variable, parameter values for debugging. After which, I am planning to use Pyomo to code my MIP model and invoke ...
123 views

### Pulp Python: How to formulate a time-based variable for shipping demurrage

I am working on a shipping optimisation problem that aims to minimise demurrage charges as a result of low/insufficient inventory. I have daily vessel requirement (sales) data in the format ...
137 views

### Priority List Constraint

I used the Vehicle Routing Problem example that has the objective of minimizing total distance traveled for each vehicle. Suppose that each order to pick up for each vehicle at each node has a ...
91 views

### Gurobi is unable to give an optimal solution even when it exists

I am trying to solve Logarithmic Fuzzy Preference Programming (LFPP) for criteria weight evaluation, based on fuzzy comparisons between criteria, and I am solving it with Gurobi in Python 2.7. It is a ...
168 views

### Pulp: slack variable to identify & measure extent infeasible in supply problem

I am currently modelling a supply problem that attempts to optimise a rail schedule which moves products from a production plant, to a warehouse to satisfy sales. The model is working fine (thanks in ...
563 views

### Branch and bound algorithm programming code

I want to solve an integer programming problem using the branch and bound method, but I'm having trouble finding the programming code. From what I saw, almost all algorithms use it for traveling ...
10k views

### MATLAB vs. Python in industry

I am a beginning PhD student in math, and I would like to focus on optimization. I am learning programming for the first time, and I have written out some rudimentary optimization algorithms in both ...
62 views

### Efficient way to do user rescaling of variable in Gurobi

Is there a better way than the code below to the rescaling of variable in a model after the model has been build with Gurobi? Like some build in function or a direct manipulation of the column object? ...
83 views

### Adding a hard and soft upper bound constraint of number of locations to visit (VRP)

I went through the Vehicle Routing Problem example and was able to replicate it. On the example, there is a constraint added for vehicle maximum distance as shown below: ...
355 views

### How to solve knapsack problem with simulated annealing?

I was going through the course contents of Optimization with Metaheuristics in Python in udemy , where they have solved a quadratic assignment problem using Simulated annealing in python , i was ...