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
352 views

How to model logic constraint: $y=1$ if $a\le x\le b$ and $y=0$ otherwise?

I am trying to formulate indicator-type of constraints. $y$ is binary $0$ or $1$ and $x$ is a continuous variable. $$ y = \begin{cases} 1, & \text{ if } a \leq x \leq b \\ 0, & \...
GuanghuiLiu's user avatar
3 votes
1 answer
276 views

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

I'm new to Gurobi in Python and I am wondering if there is way to express/code "for some" in the following constraint: $x_i+x_j +x_k+x_l =2$ for some $i, j, k,l \in \{0,1,2,...., 10\}$, ...
M.Badaoui's user avatar
  • 185
2 votes
0 answers
223 views

OR constraint in Gurobi - Python

I'm new to Gurobi in Python and I am wondering if there is way to code the following constraints: 1- $\sum x_i =0$ for all $i\in A$ OR for all $i \in B$ where A and B are distinch sets of integers ...
M.Badaoui's user avatar
  • 185
3 votes
2 answers
438 views

Integers instead of binaries

Is there a benefit in using integer variables instead of binaries? I have modeled an optimization model declaring variables that equal sums of binaries to be treated as continuous variables (by ...
Clement's user avatar
  • 2,252
7 votes
0 answers
118 views

What distuingishes a model-and-run framework solver from a programmatic solver?

I am looking for examples to understand what kind of benefits a model-and-run framework solver offers that a more programmatic solver doesn't do or doesn't do as well. What distinguishes a model-and-...
Geoffrey De Smet's user avatar
4 votes
1 answer
186 views

Do my constraints to restrict the splitting of tasks make sense?

I have a problem where there are stations, types and tasks which has to be assigned to each other. Now for me the thing is I want the variable $x$ to be not binary like in assignment problem for ...
Harun Gül's user avatar
1 vote
1 answer
63 views

Introducing WIP storage tanks in a discrete time bucket model

I have a functioning MIP model in CPLEX/OPL for production planning that generates a weekly plan of what finished good items to produce on which production resource using bill-of-materials, set of ...
S N's user avatar
  • 11
5 votes
1 answer
146 views

Add constraint on objective of MPS file in automated way

I got an MPS file and a best know solution value for that problem. I do not know whether the MPS file contains a minimization or an maximization problem. How do i programmatically create a copy of ...
worldsmithhelper's user avatar
7 votes
2 answers
379 views

Set constraint mip

I am programming a MIP problem. There are two continuous variables but only one can have a value and the other must then be zero. How do I give this as a constraint?
kc27's user avatar
  • 73
5 votes
1 answer
200 views

Flow problem with side constraints: how to eliminate subtours?

I am working on a flow problem with side constraints. More specifically, I have a usual flow problem, with constraints that require some arcs to have exactly one unit of flow on them. This makes the ...
Kuifje's user avatar
  • 13.3k
1 vote
1 answer
96 views

Traversing a list data dynamically in Pyomo Abstract Model

In my PYOMO abstract model, I am reading my data file and storing some specific attributes in a list say demand=[]. I am reading the data file as follows: ...
Waqas Swati's user avatar
2 votes
1 answer
346 views

Pyomo Abstract model "Empty constraint block written in LP format - solver may error"

My pyomo abstract model has 2 sets with 3 parameters for each set. I am minimizing the objective function with 4 constraints as follows: ...
Waqas Swati's user avatar
6 votes
1 answer
404 views

How to solve this linear program with an exponential number of constraints?

Consider the following convex program: \begin{align*} \min g(x) && \text{such that} \\ f_i(x) &\geq b_1 && \text{ for } i \in 1,\ldots,n; \\ f_i(x)+f_j(x) &\geq b_1+b_2 &&...
Erel Segal-Halevi's user avatar
5 votes
3 answers
614 views

Model infeasible

What should you do when you face an infeasible solution? I have implemented the model with the dataset from the paper but found infeasible solution.
overboxed's user avatar
  • 593
2 votes
1 answer
69 views

Modelling not evenly distributed discrete levels of a decision variable

I have a decision variable for the power of a heating device $P$ that can have the following levels: 0, 900, 1300, 2000 (Unit is Watt [W]). Now I would like to know if and how I can model in an ...
PeterBe's user avatar
  • 1,642
2 votes
1 answer
278 views

linearize bilinear quadratic objective terms

I need to model a problem as a linear program. However my working solution contains a (bilinear) quadratic objective term: $$ \sum x_i * y_i \\ x \in \{0,1\} \\ y \in \mathbb{R}^+ $$ The value of $y$ ...
Mike's user avatar
  • 147
2 votes
0 answers
66 views

Assignment/scheduling how to formulate considering job time and job cost

I have the following problem that I do not know how to formulate. There are a fixed number of workers $w_i \in W$ for $i \in [1…N]$. Also, there are a fixed number of jobs that must be assigned to ...
Daniel Baquero's user avatar
3 votes
2 answers
87 views

Coarse modelling - is there a name for this?

I'd like to produce a model that uses very coarse inputs and produces similarly coarse outputs. For example, if I were estimating personal sources of wealth I might say that in a given year: ...
P. Hopkinson's user avatar
7 votes
2 answers
881 views

Is there a better way of defining a constraint on positive integer variables such that no two variables are the same and are uniquely assigned a value

So suppose I have integer variables $x_1,x_2,\dots,x_N$ and I enforce that the integer variables are bounded i.e $1 \leq x_i \leq N$ I was interested in posing a constraint so that in the collection $...
Vogtster's user avatar
  • 205
3 votes
0 answers
115 views

Hard time in understanding OR Research or Paper [closed]

I'm from soft-engineering background and really having a hard time when reading and understanding the formulation from a research or published paper. For example, when looking at a container loading ...
overboxed's user avatar
  • 593
3 votes
1 answer
173 views

Using Gurobipy and solve in Neos Server

I have a model run in gurobipy (python api) for Gurobi solver and I want to solve it using NEOS Server. How can I send it to NEOS? What is a good way? I want to add a parameter like timelimit so my ...
overboxed's user avatar
  • 593
2 votes
1 answer
108 views

Method to test compatibility between variable values

I have a problem with my current research that I have come across repeatedly over my research career in various different fields. It goes like this. You are trying to characterise instances of some ...
CesarGon's user avatar
  • 123
3 votes
1 answer
123 views

Modeling a special case of conservation of flow

At a particular mode, there are 2 inflow arcs, a and b, and two or more outflow arcs, which is kept to 3 for this example, i.e., c, d and e The first requirement is that only one of the two inflow ...
Mike's user avatar
  • 707
6 votes
2 answers
400 views

How to represent a constraint on the kth-smallest function?

How can I represent the following set of constraints in a linear program, where $c_1,\ldots, c_n$ are constants and $f_1,\ldots,f_n$ are functions of the optimization variables? The smallest of $f_1(...
Erel Segal-Halevi's user avatar
5 votes
1 answer
232 views

Additional resources for this type of problem formulation

I'm working on a problem with the following formulation: \begin{align} \min&\quad\sum_{i \in N} \sum_{j \in J} V_{ij}x_{ij} \\ \text{s.t.}&\quad \sum_j x_{ij} = 1 \quad \forall i \in N\\ &...
Bob Jeans's user avatar
3 votes
1 answer
200 views

Multiprocessor Scheduling Problem: How to modify some constraints after variable changing?

I am thinking about classic problems concerning partitions as the Multiprocessor Scheduling Problem (or Bin Packing or Number Partitioning): Given $n$ tasks, with times $\{t_i\}_{i\in I_n}$, and $m$ ...
Alexandre Frias's user avatar
3 votes
1 answer
159 views

Disjunctive Constraint , Using Binary Variable to Replace a If or condition

I am trying to use a binary variable based on an inequality. The value of binary variable $q $ is 1 or 0 based on the following equation. [ $q $ = \begin{cases} 0,& \text{if } b \geq \pi ,\\ 1,...
Danish Shaikh's user avatar
2 votes
2 answers
554 views

How to model Max-Cut as ILP

I want to model Max-Cut in IBM's CPLEX, but I fail at modeling the objective function. My attempt is to use is to sum the XOR of inclusion for vertices of each edge, as exactly then an edge is ...
Moritz Groß's user avatar
3 votes
0 answers
88 views

Car rental time series forecasting [closed]

I have the time series of car rentals/demand in a location. The time axis is every hour for 3 months. The y-axis is number of car rentals/demand. I want to do prediction for future hours given this ...
Jose_Peeterson's user avatar
6 votes
1 answer
384 views

How to Model Path Being Only Through Adjacent Cells

I am trying to develop a MILP for a path planning problem. I am operating on a grid of cells that represents a map. The arrangement of cells in the grid represents the placement of the cells in real ...
Raghav Thakar's user avatar
3 votes
1 answer
141 views

cpu time in docplex

mdl.print_information() sol = mdl.solve() mdl.print_solution() if sol is None: print("Infeasible") print(mdl.solve_details) At the end of ...
GTek's user avatar
  • 307
2 votes
1 answer
215 views

How to model this user packing problem?

I have a system with $N$ resources. There are $K$ users in the system demanding these resources. The demand of resources for a given user $k$, $d_k$ follows $d_k\in\{1,3,6\}$ The constraints for this ...
KGM's user avatar
  • 2,265
2 votes
1 answer
86 views

Marginal Cost of Storage vs. sum of storage cost

I'm working on a model for inventory management. I'm trying to decide for each unit if it is worth holding, or if it should be liquidated at a cost $x$. I'm wondering about the argument that marginal ...
Jan's user avatar
  • 83
4 votes
2 answers
627 views

Modeling an either-or-constraint

We would like to model a constraint for an assignment problem that dictates that either assign a specific subset of nodes $I\subset\mathcal{I}$ to a specific subset of nodes $J\subset\mathcal{J}$, or ...
user avatar
2 votes
1 answer
156 views

Coding some parameters with index zero in Julia

As part of our constraints, we have \begin{align*} &\sum_{i=1}^{I}c_ix_i\ge y, \\ &\sum_{i=1}^{I}c_{i-1}x_i\le y, \end{align*} where $y\ge0,x_i\in\{0,1\}, \forall i$. I am trying to code ...
user avatar
2 votes
3 answers
366 views

How to formulate if-then for two sums in an integer program

I have two sets of Boolean variables, $x_1, \dots, x_n$ and $y_1, \dots, y_m$ and a positive integer $b$. I would like to add the constraint: $$\text{If }\sum_i x_i = b \text{ then }\sum_i y_i > b$...
Simd's user avatar
  • 131
1 vote
1 answer
302 views

The impact of utilization rate of a queueing system on its average queue time

For an $M/M/c$ queue where arrivals follow a Poisson distribution with rate $\lambda$ and are iid, service follows a Poisson process with rate $\mu$ and there are $c$ parallel servers, we can estimate ...
user avatar
2 votes
2 answers
84 views

WIP Inventory Level Constraint?

I'm modeling a continuous-time, two-stage manufacturing process with an MIP. There are about 100 finished-goods SKUs, and each of those belongs to about 25 different semi-finished categories in a ...
Ralph Asher's user avatar
1 vote
1 answer
84 views

If $x=\min\{f(\mathbf{a}),1-\epsilon\}$, how can we model and partition $x$?

I have been dealing with a problem for sometime and although tried different things and asked some questions before, I think the problem might be somewhere that we didn't look before. Variables $0\le ...
user avatar
2 votes
1 answer
74 views

Linearizing $y=\sum_{i=1}^n(z+c)\left(\frac{r_i^2}{1-r_i}\right)\phi_i$

Variables $0\le x< 1$, $y,z\ge 0$. We have a constraint $$y=(z+c)\frac{x^2}{1-x},$$ where constant $c>0$. We partitioned $x$ into $n$ intervals of equal length and defined a new variable $\phi_i=...
user avatar
4 votes
2 answers
401 views

Trying to accelerate MILP solution

I developed a mathematical model that contains several thousand of binary variables (in addition to several thousand continuous variables). The binary variables model different things, say $X(i)$, $Y(...
Clement's user avatar
  • 2,252
2 votes
3 answers
1k views

How to use condition in cplex?

I want to use conditions to my variable. dvar boolean x[I][J][K][L] dvar in h[i] my code is ...
MIN's user avatar
  • 21
4 votes
1 answer
295 views

How to transform a (thermal) range constraint into the objective function

I have an mixed-integer linear optimization problem that includes a energetic difference equation for the temperature of a building for the time $t$: $$T(t) = T(t-1) + \frac{E^{\rm Heating}(t)-E^{\rm ...
PeterBe's user avatar
  • 1,642
2 votes
1 answer
579 views

Model the TSP as a shortest path

We have a directed graph $G=(N,A)$ where $N$ are the verticies $N=0,1,2,3,4,5,..,n$ the starting location is node 0. For each arc $a=i-j$ in A we have a distance $d_a>0$ So we want to start and ...
Fernando Martinez's user avatar
0 votes
1 answer
111 views

How to model a simple routing problem using nodes and arcs

I have the following problem. I have a route which begins at node $0$. I want to begin and end in $0$ which is a depot. Now in this route even customer will be visited in order for example customer 2 ...
Fernando Martinez's user avatar
5 votes
3 answers
824 views

how to "calm down" optimizer

I want to optimize a charging schedule for Battery Electric Vehicles (BEV) along a grid line, taking into account customer wishes (when to be done with charging with what State of Charge (SOC)) and ...
Andre's user avatar
  • 303
3 votes
0 answers
90 views

How to compute the time required to transport one unit of flow on a given path?

My question is related to freight transportation, but I am stuck on the logic. So, I am considering a path between two points $(a, b)$ where I am sending $n$ trucks where the capacity/truck is $k$. ...
Bree's user avatar
  • 115
4 votes
0 answers
81 views

Is this weighted feedback concept a known, solved, problem?

Imagine a fairly standard Thumbs Up/Down feedback system. For each piece of content they consume, every user has the ability to give a binary positive/negative feedback that piece of content. They're ...
Brondahl's user avatar
  • 171
8 votes
4 answers
778 views

Common problems/puzzles that can creatively be solved with linear programming?

I am interested in common problems/puzzles that have a clear set of rules/constraints and objective that lends itself to modeled and solved with a linear program. Especially for people new to LPs, I ...
Mason's user avatar
  • 515
1 vote
1 answer
136 views

Modeling constraints in gurobi

$$\max \lbrace 0, q_i \rbrace \le L^r_i \le \min \lbrace Q^r,Q^r+q_i \rbrace \quad \forall i\in N,r\in R$$ I am not sure if this type of question is allowed here but I am stuck at modeling this ...
mars's user avatar
  • 629

1 2 3
4
5
12