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.

Filter by
Sorted by
Tagged with
3 votes
2 answers
279 views

How to model this binary constraint?

I have an optimization problem that has a variable in the matrix form. The variable is a binary matrix. It has size $M \times N = 10 \times 50$ where $M$ is the number of machines and $N$ is the ...
2 votes
2 answers
297 views

Representing "and"/"or" relationships into constraints

How do I represent the following constraints in terms of equations? For each i, either (1) holds or (2) holds- $$ x_{1}^i \geq x_{2}^i \quad and \quad x_{3}^i \geq x_{4}^i \quad {(1)} $$ $$ x_{1}^i \...
  • 65
3 votes
3 answers
160 views

Quantifying a measure of standard deviation in MILP

I am trying to set up a MILP for production scheduling. The specific details I'm not sure are important but in general a plant has M machines running N parts, each part requiring W workers. The model ...
  • 33
1 vote
1 answer
56 views

how to minimize the distance to the final points with incomplete information?

Suppose we have a transportation problem similar to pickup and delivery problems. So, we have a set of drivers and a set of passengers. each passenger has predefined origins and destinations. I'd ...
  • 113
1 vote
1 answer
20 views

Array of string in OPL

how to make 2d array of strings in Cplex //indics {string} cluster=...; setof(string) darkstore =...; setof(string)demandpoint =...; //data cluster={chav,sree}; demandpoint=[{tsnami,adholokam,...
1 vote
0 answers
38 views

Identifying problem category of balancing resources in transport networks

I'm new to OR, and I'm in the process of categorizing a problem I'm working with. The attached picture is an example of a transport network. Note that s2, s5, and s8 are shared stops. Every stop in ...
4 votes
2 answers
272 views

The linearization of the (Iff-and-only-Iff) expression

I am trying to linearize the following expression without using the Big-M formulation, but I cannot convert it. I am willing to know if there exists an efficient way to do that? $$ Iff \quad (w=1) \...
1 vote
3 answers
111 views

Optimization solver that satisfies variable values within set membership

Is there a solver that can handle an AMPL model of this sort: ...
0 votes
1 answer
56 views

Maximization problem with preferences on variables

Consider the following trivial, theoretical model: $$ \max x+2y+3z \qquad s.t. $$ $$ x \leq b_x $$ $$ y \leq b_y $$ $$ z \leq b_z $$ $$ x+y+z = 1 $$ $$ x,y,z \in \{0, 1\} $$ and $b_x$, $b_y$ and $b_z$ ...
  • 927
3 votes
2 answers
120 views

How to find the maximizing number of expected delivered units of a probabilistic minimum cost flow problem?

I am a Bitcoin / Lightning Network open source developer and researcher and new here but very active on the sister site. In the context of my research I discovered the field of operations research ...
0 votes
1 answer
66 views

To maintain safe order level from a customer

A telecommunication company (CALLME TEL Co., Ltd) receives and processes customers’ orders. Orange Co., Ltd is an important customer, who mostly places orders every 2 months. Medium quantity of ...
  • 429
1 vote
1 answer
171 views

multi-commodity flow vs integer programming

A theater center needs to select which shows to broadcast in one of its rooms for a given day. There are three options available: short films that last about 1 hour, movies that last about 2 hours, ...
  • 123
2 votes
2 answers
79 views

Efficient formulation of flexible job-shop scheduling constraints

I am working on a flexible job-shop scheduling problem, where indices are as follows: $i$: Index of operations $j$: Index of jobs $m$: Index of machines $p$: Index of operation sequences on a machine ...
  • 485
6 votes
3 answers
430 views

How do we formulate a problem where the decision variable has an index that is also a decision variable?

I want to maximize the sum of a nonlinear function $f(.)$ w.r.t. $x$ that is convex in $x$: $$\max \sum_{i=1}^N f(x_i), $$where $x_i$ is a continuous variable and $0 \le x_i < 1$ for $i = 1, 2, \...
3 votes
3 answers
543 views

Modelling if elif else conditions as MIP

I have 4 variables. Xl6, Xs6, Pl6, Ps6. I have a constant C as well. Xl6 and Xs6 are binary whereas Pl6 and Ps6 are integers. Also, all variables can take only positive values. I have to implement ...
  • 181
2 votes
2 answers
99 views

constraint set for a scheduling problem with machine availability

I have a set of tasks $I$ with processing times $p_i, \forall i \in I$. There exists a set of machines $M$ and each machine has availability time ranges in a given time horizon. For instance, given a ...
  • 158
3 votes
1 answer
101 views

Modelling Question

Let $W^C_t$, $W_t$ be binary variables and $p$ an integer variable with $1 \leq p \leq 3$ The variables are related through the following equation: $$W^C_t = \sum_{\theta=1}^{p} W_{t-\theta}$$ I can ...
  • 2,028
3 votes
3 answers
262 views

Set null the next set of N values

I'm dealing with a problem I already modelled by using linear programming. The already existing constraints set at 1 groups of contiguous variables (for ex: ...
  • 33
1 vote
1 answer
85 views

variable use of nested blocks in pyomo

I'm using pyomo to model a system consisting of subsystems which themselves consist of subsystems. Therefore, I use nested Blocks. Every block is described in a separate file. I want to be able to ...
  • 11
1 vote
1 answer
75 views

How to model this problem with multiple objectives?

This question is related to How to deal this L0 norm of a vector of L2 or L1 norms in objective? I have an optimization variable denoted as ${\bf A\in\mathbb{C}^{100\times 5}}=\begin{bmatrix}{\bf a}_1&...
  • 2,179
6 votes
2 answers
231 views

How to partition a giant tour into feasible routes?

In vehicle routing problems, the route first cluster second approach starts by computing a "giant" TSP tour (which typically does not satisfy all constraints of the problem), and then ...
  • 11.8k
5 votes
2 answers
375 views

Is this constraint with an indicator function nonlinear?

We have two variables $x\geq0$ and $y\in\mathbb{Z}^{0+}$. We have this constraint in our model $$x = \sum_{i = 0}c_i \mathbb{1}_{\{y=i\}}$$ where $c_i$ is a parameter and $\mathbb{1}_{A} = 1$ if $A$ ...
user avatar
1 vote
1 answer
136 views

How to model this constraint? [duplicate]

I have a system with $C$ machine and $U$ users. The decision variables are $d_{u,c}$ and ${\bf f}_{u,c}$ with $c=1,2,\cdots,C$ and $u=1,2,\cdots,U$, where $$d_{u,c}\in\{0,1\}$$ $${\bf f}_{u,c}\in\...
  • 2,179
3 votes
1 answer
136 views

Optimization model testing tooling: likes, dislikes, and wishes

We’re [1] in the thick of building out a testing suite for decision models, starting with a focus on route optimization. There are several angles we care about [2] and are considering: unit testing, ...
5 votes
3 answers
382 views

Is this arc routing formulation correct?

Let $G=(V,E)$ be a graph. I would like to identify an eulerian cycle in $G$ with minimum cost, with an integer programing approach: $x_{ij}$ are integer variables that denote the number of times that ...
  • 51
4 votes
1 answer
316 views

How can I transform this logical if-then constraint? [duplicate]

I want to know how to transform this logical if-then constraint? If $B=1$,then $A \ge C$, else $A=0$, where $A$ and $B$ are decision variables and $C$ are constants. $B$ is binary variable and $A\ge 0$...
1 vote
1 answer
151 views

How to write this logical expression with Gurobi + Java, or express it as a big-m formulation

I am trying to write the following expression in Gurobi+Java or Gurobi+python, if it is more practical It could be expressed as a big-M formulation. \begin{equation} \label{const4} \text{D}_{uv} = ...
2 votes
2 answers
204 views

How to model not-met demand to next period?

I am trying to include to my model a demand shift. That is, I am having a fixed demand for each period (t), but because of capacity constraints I am not able to serve the whole demand for each period. ...
  • 79
5 votes
1 answer
198 views

Summation of Binary Variables Pushing a Binary Variable

I'm modeling a problem where I have a set of binary decision variables $x_{ij}$ that has a value of 1 if the person $i$ is allocated to day $j$ or 0 otherwise. I have another set of binary decision ...
  • 53
2 votes
1 answer
103 views

How to mathematically model this multi-objective optimization problem?

I have a system of $M$ machines and $U$ users. Each machine has a capacity in terms of number of resources. Let, machine $m$ has $\zeta_m$ resources. Each user has a service demand $d_u$ and there is ...
  • 2,179
-2 votes
2 answers
56 views

How to model the following "if, then" constraint

There are two matrices: Matrix $S^{v\times v} \in \{0,1\}$ this is a know parameter. Matrix $X^{v\times p} \in \mathbb{N}$. Elements of $X$ are the variables. I want to model: $$\textrm{if }s_{v v'} =...
5 votes
3 answers
183 views

MIP constraint with sum of decision variables having certain value : $\sum_{i=1}^nx_i = 2 \implies \delta = 1$

I want to formulate a MIP constraint such that : $$\sum_{i=1}^nx_i = 2 \implies \delta = 1$$ $x_i, \delta \in \{0, 1\}$. My problem is that delta should be one when this sum is exactly 2 and not ...
2 votes
1 answer
381 views

If/then constraint formulation

Let's assume we have event $i=1,2,\cdots,k$, denoted as $\text{event}_i$. We know for a fact that $\text{event}_i$ is smaller then $\text{event}_{i+1}$ i.e., $\text{event}_i \leq \text{event}_{i+1}$. ...
2 votes
1 answer
104 views

Conditional constraint for binary

Could you please check where I might be wrong? Task is: If $z=1$, then either $x=1$ or $y=1$ My approach: If $z=1$, then $x+y=1$ $\implies x+y\le1$ $\implies x+y\ge1$ If $z=0$, then $x+y\ge0 - M\cdot(...
2 votes
1 answer
44 views

Automatic Reformulation Tools For AML Programs

Are there any tools to transform programs written in an algebraic modeling language like GAMS,AMPL,... into a different formulation. E.g. there is a quadratic constraint $\sum_j b_i b_j = N, b \in \...
2 votes
3 answers
497 views

How to find the index of the item, the first time appears?

How to formulate this problem as MIP: For example, we have the following vector of binary variables: $$ x= [0, 0, 0, 1, 0, 1, 1] $$ How to find out when the first "1" is recorded? For ...
4 votes
3 answers
407 views

How to transform a logical constraint with integer variables?

Consider the binary variables $x_1, x_2 \in \{0,1\}$ and the integer variable $y \in \mathbb{Z}$ with $0 \leq y \leq 3$. I'd like to formulate the following logical constraint: $$ x_1 = 1 \wedge y \...
2 votes
1 answer
155 views

Binary variable constraint for condition

I am trying to solve the following task: If $x=1$ or $y=0$ then $z=0$ My approach: If $z=0$ then $x+y \le 2 + Mz \implies x+y \le 2+2z \quad$ where $M = 2$ If $z=1$ then $x+y=1 \\ \implies x+y \le 1, ...
0 votes
1 answer
44 views

Conditional constraint for binary variables

I would appreciate any help to solve the following task: If $y=1$ then $x_i=1$ for at least $k$ of the possible indices $i\in\{1,\cdots,n\}$ where $k$ and $n$ are parameters, $x$ is a binary variable ...
5 votes
2 answers
213 views

Binary variable constraint

The task is to ensure that if $x_i = 1$ for at least $k$ of the possible indices $i$ in $\{1,...,n\}$ then $y = 1$, where $k$ and $n$ are parameters, $x$ is a binary variable vector with $n$ elements, ...
4 votes
1 answer
68 views

Another difficult constraint for an ILP

How can I add to this ILP with all binary variables (again related to this question): $$\min \sum_{1\leq i<j\leq n-1-h} t_{i,j}$$ $$\sum_{i=1}^{n-1-h} a_{k,i} \ge \lfloor (n-1)/2\rfloor \qquad \...
  • 393
5 votes
3 answers
591 views

Constraint for two binary vectors to be different

If I have a matrix $A$ of binary variables $a_{i,j}$, $1 \le i \le n$, $1 \le j \le m$, how can I enforce in an Integer Linear Program with binary variables, the condition that every two columns must ...
  • 393
2 votes
1 answer
87 views

Modeling advice: scheduling problem with judged events and "blocks" of judging assignments

I am considering a scheduling problem in which the events are officiated, likely as a MILP problem. I'm getting hung up on how best to model a particular requirement of how the judged events are ...
  • 123
4 votes
1 answer
180 views

Difficult linearization of a constraint

My previous question was about this ILP with all binary variables: $$\min \sum_{1\leq i<j\leq n-1-h} t_{i,j}$$ $$\sum_{i=1}^{n-1-h} a_{k,i} = \lfloor (n-1)/2\rfloor \qquad \text{for }k\in[h];$$ $$...
  • 393
2 votes
2 answers
114 views

How can I include a penalty to my (linear) model?

Is it possible in a linear model to include a penalty if both variables $x$ and $y$ are greater than zero? I would like to have no penalty, if $x$ OR $y$ is zero. For example, I have a model: $$ \...
  • 79
3 votes
0 answers
85 views

Minimize total cost to buy unique products over timespan

I am looking for some guidance on how to better state my problem formally and practically (e.g., relevant Python libraries). Let's assume I have a set of $X$ unique products to buy. I have $Y$ days in ...
  • 31
3 votes
3 answers
517 views

Gurobi - Python: is there a way to express "OR" in a constraint?

I'm new to Gurobi in Python and I am wondering if there is way to express/code "or" in the following constraint, where $x_i$ are binary variables: $x_i-x_i*x_{i-1} =0$ OR $x_i*x_{i+1} =1.$ ...
  • 185
1 vote
1 answer
68 views

Can I get value from a variable and use it on a specific index of a different variable?

This is a peculiar question but I have two variables $s_{ik}$ (integer) and $y_{it}$ (binary). What I want is the following relationship: If $s_{ik} = 8$, then $y_{i8} = 1$. Basically, if $s_{ik}$ ...
3 votes
1 answer
74 views

Jump, Julia : How to add constraints with different indexes a.c.a $x_i \leq z_j, \; \forall i, j$

I am having a constraint in the form : $$ x_i \leq z_j, \quad \forall i, j \in \{1, 2, .., n\}$$ I know that if the right part of the equation was a constant so something like $x_i \leq c[i]$ I could ...
3 votes
1 answer
120 views

Efficient modelling via Gurobi

I would like to model the following constraint set in gurobi-java. \begin{equation} t^n_{ij} \geq t^n_{(i-1)j}+S_{(i-1)j} - (1 - \sum_{\substack{m \in \mathcal{M} \\ G_{ijm} = 1}}\sum_{k \in \mathcal{...
  • 485

1
2 3 4 5
10