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
4 votes
2 answers
307 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) \...
Mr. Blue's user avatar
1 vote
3 answers
132 views

Optimization solver that satisfies variable values within set membership

Is there a solver that can handle an AMPL model of this sort: ...
wanderinganon's user avatar
0 votes
1 answer
68 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$ ...
Libra's user avatar
  • 937
3 votes
2 answers
168 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 ...
Rene Pickhardt's user avatar
0 votes
1 answer
122 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 ...
Mark K's user avatar
  • 429
1 vote
1 answer
244 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, ...
ebrahimi's user avatar
  • 115
2 votes
3 answers
149 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 ...
mdslt's user avatar
  • 615
6 votes
3 answers
468 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, \...
Steven01123581321's user avatar
3 votes
3 answers
644 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 ...
mufassir's user avatar
  • 201
2 votes
2 answers
117 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 ...
ball_jan's user avatar
  • 157
3 votes
1 answer
103 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 ...
Clement's user avatar
  • 2,252
3 votes
3 answers
310 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: ...
devOn's user avatar
  • 33
1 vote
1 answer
276 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 ...
Ursxx's user avatar
  • 11
1 vote
1 answer
118 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&...
KGM's user avatar
  • 2,265
6 votes
2 answers
257 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 ...
Kuifje's user avatar
  • 13.3k
6 votes
2 answers
499 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
143 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\...
KGM's user avatar
  • 2,265
3 votes
1 answer
162 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, ...
Ryan O'Neil's user avatar
5 votes
3 answers
390 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 ...
husson's user avatar
  • 51
4 votes
1 answer
364 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$...
Alan Zhang's user avatar
1 vote
1 answer
189 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} = ...
Hernan19's user avatar
2 votes
2 answers
206 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. ...
Laura's user avatar
  • 79
5 votes
1 answer
236 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 ...
dhfg's user avatar
  • 53
2 votes
1 answer
114 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 ...
KGM's user avatar
  • 2,265
-2 votes
2 answers
69 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'} =...
Daniel Baquero's user avatar
5 votes
3 answers
292 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 ...
tonythestark's user avatar
2 votes
1 answer
474 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}$. ...
OpenAtTheClose's user avatar
2 votes
1 answer
133 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(...
Bohdana Nevierova's user avatar
2 votes
1 answer
48 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 \...
Lars Hadidi's user avatar
2 votes
3 answers
593 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 ...
Hussein Sharadga's user avatar
4 votes
3 answers
444 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 \...
Ronaldinho's user avatar
2 votes
1 answer
183 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, ...
Bohdana Nevierova's user avatar
0 votes
1 answer
84 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 ...
Bohdana Nevierova's user avatar
5 votes
2 answers
410 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, ...
Bohdana Nevierova's user avatar
4 votes
1 answer
76 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 \...
Fabius Wiesner's user avatar
5 votes
3 answers
710 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 ...
Fabius Wiesner's user avatar
2 votes
1 answer
96 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 ...
pholser's user avatar
  • 123
4 votes
1 answer
191 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];$$ $$...
Fabius Wiesner's user avatar
2 votes
2 answers
279 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: $$ \...
Laura's user avatar
  • 79
3 votes
0 answers
87 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 ...
M2FKXY's user avatar
  • 31
3 votes
3 answers
611 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.$ ...
M.Badaoui's user avatar
  • 185
1 vote
1 answer
70 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}$ ...
arvind rathore's user avatar
3 votes
1 answer
371 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 ...
tonythestark's user avatar
3 votes
1 answer
128 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{...
mdslt's user avatar
  • 615
3 votes
2 answers
290 views

Modelling a Capacitated Facility Location Problem in such a way that a few candidate locations are always selected

I am trying to model a MIP for a Capacitated Facility Location problem in a way that a number of selected candidate locations will always be there. How can I model it? My approach: Add a cost ...
Shibaprasad's user avatar
5 votes
3 answers
477 views

Maximize the minimal distance between true variables in a list

I'm using the OR-Tools CP-SAT solver on a list of $n$ boolean variables $x_i$. I'm trying to maximize the minimal distance between two true variables in this list, as illustrated by the following ...
Blackhole's user avatar
  • 235
2 votes
1 answer
184 views

How to solve infeasible cplex model in GAMS?

I am facing this kind of error "Row 'eq1(14)' infeasible, all entries at implied bounds" in a problem that a GAMS script gets data from MATLAB. I have seen some posts about conflict ...
Panos S's user avatar
  • 21
1 vote
2 answers
124 views

Gurobipy trip scheduling empty stop problem

I am trying to create an optimizing model for a roadtrip: 10 cities in 14 weeks. For each city I have: a distance matrix to every city The rain for every week of the year My goal is to minimize the ...
nimVo's user avatar
  • 11
2 votes
0 answers
61 views

Resources on the soft aspects of modelling

Usually, the modeling involves those steps : Fuzzy Description ----(1)----> Clearer Description -----(2)-----> Mathematical model. Of course, it's not linear and a lot of iteration and re-...
BloodyOrange's user avatar
3 votes
3 answers
131 views

Minimum Disjointed Path Cover ILP formulation

I cannot find references for a Minimum Disjointed Path Cover ILP formulation. Given a directed graph G=(V,A), a disjointed path cover is a path cover with no common nodes between paths. We want to ...
Enrico R.'s user avatar

1 2
3
4 5
12