# Questions tagged [modeling]

For questions related to the process of converting a real-world problem into a mathematical model. Can include questions related to linearization, logical constraints, tightness of formulations, and so on.

283 questions
Filter by
Sorted by
Tagged with
27 views

### How to exponentiate binary variables in QUBO-type problems?

Ising Model In an Ising model, the Hamiltonian of one configuration of spins $\vec{s}$ is: $$H(\vec{s}, \mathcal{J}, \mathcal{h}) = \sum_{i} h_{i} s_{i} + \sum_{i \ne j}J_{ij} s_{i}s_{j}$$ where ...
42 views

### Violation of specific constraint in Pulp

I have successfully implemented a program where I allocate N truck drivers to M gathering hubs for each one of the days of the ...
84 views

### Inverse Ising problem

Inverse Ising Problem The inverse ising problem means fitting the coupling $J_{ij}$ and field $h_{i}$ parameters given a sample of configurations of spins. Each spin $s_{i}$ is either +1 or -1. The ...
97 views

### How do I formulate constraints that check if a parameter is between certain values, using binary variables?

I have $3$ parameters $a_1,a_2,a_3$ and a variable $d$ and $3$ binary variables $b_1,b_2,b_3$ and a "result" variable $s$. How do I model constraints so that: If $d$ is between $0$ and $a_1$...
81 views

### if $x = 0$ then $y \ne b$

I'm trying to model the following: if $x=0$ then $y \ne b$ $y$ is a positive integer number( $y\le U$) and $x$ is binary and $b$ is a constant.
248 views

### How to linearize membership in a finite set

Given finite set $S$ and variable $x$, how do I linearize the set membership constraint $x\in S$?
106 views

### Gurobi: How to define constraints that can accept multiple different values？ [duplicate]

I have a question about Gurobi. How do I define a constraint that can accept multiple different values? For example, a sample constraint is shown as follows: ...
80 views

### How do I define multiple indices for the same set in python? (using CPLEX to solve a MILP)

I am using docplex in Python to solve a MILP and I am having some trouble defining the indices and sets of my model. I want to translate $w,v,a\in W$ into Python. In this case, $W$ is a set, and $w, v$...
114 views

### How to make the solution of linear programming within the specified elements [duplicate]

The constraint value of a variable must be an element of the specified list.A simple example is shown as follow,in which the value of the...
175 views

### Guides for strong MILP Formulations

When developing MILPs, often there are different alternatives possible to express a constraint. The question then arises, which of the alternatives is better, meaning, which alternative is expected to ...
15 views

### Prospective study and ascertainment of the exposure during the follow-up period [closed]

I'm reading several prospective studies published in top journals where a baseline modifiable exposure was associated with a final outcome. Just as an example might be this study. The Authors aimed to ...
468 views

### MILP - stronger models

Let $y, x_1, x_2, x_3$ be binary variables. The following holds: $y=1 \implies x_1=1, x_2=1, x_3=1$ I can model this by requiring (1) \begin{align}x_1 &\ge y\\x_2 &\ge y\\x_3 &\ge y\end{...
1k views

### How to represent an integer variable via binary variables?

Suppose we have a model with $N$ integer variables, i.e. $x \in \mathbb{Z}^{N}$ with $L \leq x \leq U$. How can we represent the integer variables via binary variables? Or in other words: how can we ...
161 views

### How to make the elements of the solution of gurobi belong to the elements of the specified list?

If I want to use the elements of the list as the range of the solution, like list1 = [10,20,50,60,30],and the elements of the solution must belong to the elements of the list The sample example as ...
67 views

### How can I set the solution of gurobi to be a multiple of 10 instead of all integers?

For example, the solution for gurobi has two solutions, as follows: [10,20,50,70] [55,79,30,80] I only want to output solutions that contain only multiples of 10. The sample example as follow: ...
101 views

### Obtaining solver timings from Pyomo

I would like to seek some advice on the following: I am currently using Pyomo to generate my MILP model in Pyomo and solve it using Gurobi, respectively. As the solution process is iterative, I would ...
110 views

### Problems modeling a constraint in network design problem

I'm working on a network design problem where the objective is to minimise the network design cost. Given a graph G = (V, E) and a set of point-to-point demands K, the task is to route the demands and ...
126 views

### How to partition a graph with optimal number of groups?

I have a graph with $N=12$ nodes. Some nodes may not have any edge between them. every edge has a weight. How to find the optimal partitioning of the graph so that total weight in the system is ...
112 views

### Best way to add dummy to transportation problem? Zero cost will be always chosen first?

I know that an unbalanced transportation problem could be made a balanced transportation problem by adding a dummy node which equals the difference between demand and supply. In literature, dummy ...
236 views

### Effect of 'unused' variables on the result and runtime of optimization algorithms

I have a general question about the effect of 'unused' variables on the result and runtime of optimization algorithms. I try to explain my question by giving an example. Let's say I have 2 type of ...
156 views

### How to model this multi-commodity flow problem with a twist?

Problem description I am working on a variation of the multicommodity flow problem on a graph $G=(V,E)$. I have requests $r_{uv}$ for pairs of nodes $(u,v), u\in V, v\in V$, which means that $r_{uv}$ ...
152 views

### Setting up Branching Priority for GUROBI in Pyomo

I am currently experimenting with GUROBI and would appreciate some kind advice on the following: In Pyomo: Setting variable branching priorities, there was a response to doing so for CPLEX, hence I ...
63 views

### Finding the minimum of a group of timings

I would like to seek some modeling advice on the following: Say for instance I have 5 nodes representing workstations of the operation of 5 jobs, and that I have less than 5 vehicles. Say I have two ...
415 views

256 views

### How to mathematically formulate the optimization problem?

I have a system with $S$ service points. There are also $U$ users in the system. We have $$U>S>G$$ One group can have maximum $M$ service points, but there is no restrictions on the number of ...
24 views

### Correct way to define constraints in Pyomo

Can I know if the constraint below can be defined as follows in Pyomo for convex optimization. W and G are arrays of dimension M x N. ...
63 views

### Can I define constraints in Pyomo as a list?

I would like to define the following constraint in Pyomo $$W^\top{\bf 1}\le\hat w=\begin{bmatrix}\hat{w}_1&\hat{w}_2&\ldots&\hat{w}_N\end{bmatrix}^\top$$ where $W$ is a $2\times4$ matrix. ...
77 views

### IP model for k-rooted spanning forest

I am looking for an IP model for finding a $k$-rooted minimum spanning forest on an undirected graph $G$. Given a set of roots $R$ and a set of nodes $N$ $(R\cap N=\emptyset)$, I would find a forest ...
383 views

### How can I express this max-min in CPLEX?

Initially, I had the below objective function $\max \sum_{u=1}^{U}\sum_{c=1}^{C}x_{u,c}d_{u,c}$ where $x_{u,c}$ are optimization variables I modelled this in CPLEX as ...
56 views

### Model definition in pyomo to solve online optimization problem

I am trying to model the attached online optmization problem in pyomo. Eventually, I am going to use the octeract solver to find the matrix soluions of W and G. I would like to ask advice about ...
74 views

### How to linearize a max min objective function?

Let us suppose that I have a $\max \min$ objective function that only depends on one set of variables: $\underset{x}\max \underset{y}\min dy$ Associated with the linear set of constraints and right ...
124 views

### MILP constrained by the minimum number of satisfied constraints

I have an MILP where we have $$t_k = \sum_i P_i\cdot C_{ik} : P_i\ \in \{0,1\}, C_{ik} \in I^+$$ and our model is constrained by the number of times $t_k$ is bigger than a certain value $T_k$.  \...
34 views

### How to use NEOS without using Pyomo

I am new to modelling language and specifically NEOS server. I aim to solve MINLP using Baron, through the NEOS server. So, far I have been able to write model file, data file and command file as ...
41 views

### How to formulate a storage component?

Let’s say I have a drink for several customers, and I know their demand. Besides, I also have a storage tank for the drink during times when demand exceeds supply. The storage tank's size is not yet ...
60 views

### How to model non-zero minimum constraint?

I found following way to model a minimum constraint but in my case I need a non-zero minimum value. So in this figure, if any value of x_i is 0 then answer is 0 (assume x_i >=0) but I need non-zero ...
64 views

### Bounding box fusion with constraints

I have N bounding boxes that I want to fuse/merge given some constraints. Each bounding box has a label. Goal: The main goal is to minimize ...
I'm dealing with a kind of assignment problem, in which I have a set of tasks $t$ to be executed by machines $w$, but these tasks depend on the variatns $v$ of components $m$ being selected, which is ...
I have a model which delivers the following results (other combinations are also possible, all Xs have 50 as an upper bound): Case I $X1 = 50.0$ $X2 = 13.750$ $X3 = 50.0$ $X4 = 50.0$ Case II (obtained ...