# Tag Info

### How do I access the value of a variable in PuLP?

To get the value of the decision variable, you need to use the varValue property of the LpVariable, so: ...
Accepted

### Complicated constraint with logical operators in PuLP

Suppose your two arrays are indexed by $I$ and $J$, and let $x_i$ be the binary variable. zero or one elements may be selected from first array: $$\sum_{i\in I} x_i \le 1 \tag1$$ zero, one, or many ...

### "Out of the box" Mixed Integer Programming Heuristics

You can solve your model via the NEOS server which provides Gurobi, Cplex, and other solvers for free if it is the matter of not having a solver. I am not familiar with PuLP but I know it is easy to ...

### Change coefficient in PuLP

If the model in PuLP is: ...
Accepted

### Read an LP/MPS file in the PuLP

According to PuLP's documentation, it seems that load_file function in PuLP's Amply class can only handle AMPL files with a ...
Accepted

### Find the list with the fewest elements whose cumulative sum reaches threshold

Your model basically reads as \begin{align*} \min \quad n \quad \text{s.t.} \quad \sum_{k = 0}^{n} l_{i,k} \geq b_i \cdot \epsilon, \quad \sum_{i \in L} b_i = 1, \end{align*} where $l_{i,k}$ is ...
Accepted

### How to call HiGHS solver from python PuLP MIP?

PuLP has an API for HiGHS but that version is not sent to pip yet. For the time being, you should pip install PuLP from Github. See the command taken from their readme below. (ps. You might need to ...
Accepted

### How to set these constraints in a linear optimization problem (PuLP)?

The rule "works on Saturday implies works on Sunday" can be expressed as $$(D_{i,6} \lor N_{i,6}) \implies (D_{i,7} \lor N_{i,7}),$$ which can be rewritten in conjunctive normal form as follows: \...
Accepted

### Scheduling optimisation constraint on consecutive shifts & consecutive night shifts (python)

There are certainly different ways of achieving what you want. Here is how I would proceed: Start by predefining the set of all possible schedules which satisfy your constraints $2,3,4,6$. Although ...
Accepted

### How to convert static variables into arrays for use with PuLP

Your code is correct, you have used pulp.LpVariable.dicts correctly. For better readability, it is often better to use dictionaries. So the idea is to convert your ...
Accepted

### How to generate multiple solutions to linear program in Python?

When I understand your question correctly you are not interested in the full solution space. In that case you can generate alternative optimal solutions by first solving your problem to optimality. ...
Accepted

### Python Pulp - LpMinimize Not Returning Expected Output - Scheduling Problem

First, it is confusing when you say The final solution does not satisfy the workforce requirements for the various time windows, it's substantially short. Only 5 shifts are filled in total. You do ...

### Designing a multi-commodity network flow optimizer

Question 1 You could simply use the priority function as the cost function on the arcs. This way, it is for example cheaper to ship a commodity to $D_1$ from $W_2$ ($1$ unit of cost per unit of flow) ...
Accepted

### Subtour elimination implementation (DFJ) using Python (PULP). While loop never exits

In constraint ...

### Any Idea why PuLP is ignoring binary variables?

You need to capitalize the first letter in the cat option: ...

### How to generate multiple solutions to linear program in Python?

Your problem does not have any objective function, so you do not have to use software to solve linear programs here. It is just a system of linear inequalities. (Of course, you still can use LP tools ...
Accepted

### Advanced Heuristics for MIP vehicle routing problem in PuLP

It is difficult to tell from this information. You need the examine the logs of the solver if your primal bound (how good are the solutions) or dual bound (how good is the relaxation) is not moving as ...