Questions tagged [constraint]
For questions related to constraints, i.e. any restriction or relation a set of decision variables has to satisfy.
92
questions
6
votes
2answers
128 views
Modeling a constraint such that a set of binary decision variables do not equate to 1 simultaneously
I would like to seek some advice on modeling the following logical condition:
I would like to ensure that a group of binary variables do not equate to 1 simultaneously, i.e., $\omega_{1}=1, \omega_{2}=...
3
votes
1answer
77 views
Linearize $\max x_i\ge1$
I'm trying to linearize this optimization problem ($S_j$ is a subset of variables): \begin{align}\min&\quad\sum_{x_i \in X} x_i\\\text{s.t.}&\quad\max_{i \in S_j}x_i\geq 1\quad\forall S_j\\&...
2
votes
0answers
47 views
Two binding constraints - Linear Programming
I'm having some troubles to continue solving my system, I'm used to solve such systems but with "one" binding constraint, if someone could give me some helpful hints so I can solve it I will ...
2
votes
1answer
233 views
If-then constraint with continuous variables
I was usually using if-then constraints with integer variables but ended up using continuous variables and got confused. I have variables $x_{ij}\in\mathbb{R}_{\geq 0}$, and would like to force the ...
1
vote
2answers
96 views
Should I process the data or add a new constraint to achieve the target?
I have an MILP as below
$\begin{equation}
\begin{array}{*{35}{l}}
\underset{d_{u,c}}{\max}\hspace{1mm}\hspace{1mm}\sum_{u=1}^{U}\sum_{c=1}^{C}d_{u,c}\omega_{u,c}\\
\text{}\text{subject to }\text{ C1:}...
2
votes
1answer
51 views
How to define constraints in Pyomo using sets and variables
I am trying to model the transportation problem of Dantzig in Pyomo (see the GAMS code here https://www.gams.com/latest/gamslib_ml/libhtml/gamslib_trnsport.html or the description here https://www....
2
votes
2answers
230 views
Hard to soft constraint
What are all necessary changes to the below model so that constraint set $(2)$ becomes soft?
Give the new full model. $\alpha_{ij}$ are parameters. Eqn. $(1)$ refers to an already existing function of ...
2
votes
0answers
69 views
How to linearize this multiplicative constraint?
I have a constraint in the form
$\sqrt{|\sum_{c\in C}{h_cw_c}|^2}\ge\sqrt{x}\zeta$
Here, $h_c$ is s row vector (know), $w_c$ is a column vector (variable).
$x$ and $\zeta$ are also optimization ...
2
votes
1answer
67 views
How to model these constraints correctly
$W$ is a vector of $N$ complex elements.
$D$ is a binary variable
The requirements are:
when $D==1$, $L_{\min}\le ||W||_2^2\le L_{\max}$
and when $D==0$, $||W||_2^2=0$
I have formulated the following ...
2
votes
2answers
95 views
Constraint to handle the machine-configuration's change between initial position and its first occurrence in the process
I am working with a kind of a reconfigurable process planning, meaning that the same machine can have different configurations and perform multiple operations. Each machine has an initial ...
1
vote
1answer
50 views
Priority Constraint
Suppose I have the following set of binary variables:
$X_i$: $I$ ranges from {1,..,4} Highest priority among the three variables $X$ , $Y$ and $Z$
$Y_j$: $J$ ranges from {1,..,3}
$Z_k$: $K$ ranges ...
2
votes
1answer
106 views
How can I perform discrete optimisation of a variable over a data set
This question relates directly to a dataset I've generated for Fantasy Premier League, but I'm also curious how I can apply this to a more general case.
Data
I have a list of premier league players, ...
1
vote
1answer
92 views
Python, Google OR-Tools, OnlyEnforceIf() method
I am trying to solve a basic puzzle by using Google OR-Tools, this is my first try with OR-Tools and I am trying to learn. I completed almost everything and was ready to conclude the program until I ...
3
votes
3answers
194 views
How to handle an equality constraint in metaheuristic algorithms (like GA, PSO)?
Metaheuristic algorithms are generally used to find the optimal solution to unconstrained optimization problems. I would like to maximize $x_1+3x_2-x_3\ge0$ while respecting the equality constraint $...
5
votes
0answers
221 views
Substituting inequality by equality constraints
Let $\mathbf{A}=\left(a_{ij}\right)$ be a $n\times J$ matrix with $a_{ij}\geq 0$, $n>J$ and such that no row or column has all its entries equal to zero. Let also $\mathbf{k}=\left(k_j\right)$ be a ...
4
votes
1answer
63 views
How do you turn an abstract set constraint into equality constraints?
I am reading from Nonlinear Programming by Bertsekas, and in the section on ADMM, he says:
Consider the problem
$$\text{min} \sum _{i=1} ^ m f_i(x)$$
$$\text{s.t. }x \in \cap _{i = 1}^m X_i,$$
where $...
5
votes
2answers
311 views
Failing to meet a constraint in a NLP problem
I have a NLP problem at hand, which I am trying to solve via Pyomo + ipopt. I try to run several different instances of the optimizer with different conditions, out ...
8
votes
1answer
415 views
Adding a constraint in constraint programming
Is it true that the more we add constraint to a constraint programming solver the more efficient it will be? How does this compare to adding constraints in integer programming solvers.
5
votes
1answer
80 views
Combined arc capacity constraints in network flows
Consider the network flow polyhedron for a directed graph $G = (N, A)$. Along with the standard flow-balance and single-arc capacity constraints, we are faced with additional constraints which enforce ...
0
votes
0answers
36 views
Linearizing max constraint Problem [duplicate]
I want to linearize a max constraint as below:
In which x_(i,t),are binary decision variables and T is a constant.
How can I linearize this constraint?
2
votes
1answer
60 views
distance specific constraint
I have some points with determined coordinates $(a_i,b_i)$. A vehicle can move between these points based on rectangular distance. In more detail, we consider that the path between points is an ...
3
votes
2answers
159 views
Model “If, then” constraint
How to model the following "If, then" type constraint?
If $\sum\limits_{i \in I}x_i = 0$ then $\sum\limits_{j \in J}x_{j} = n$
where $x$ are binary variables, $n$ is a known parameter and $...
2
votes
1answer
63 views
Quasi-convex function must be “partially monotonic”?
$f(x)$ is quasi-convex,
$$x^*\in\arg\min_{x\in C}f(x).$$
How to prove that, for any $a\in C$, $f(x) $ is weakly monotonic in the direction of $(x^*-a)$?
Is this simple result a part of an ancient ...
4
votes
2answers
148 views
Faster implementation of “or” constraints in ILP
I have implemented a set of "or" constraints in my ILP using binary decision variables (as in this method). It works fine for smaller problems, but when I try to increase the number of ...
5
votes
1answer
105 views
Minimize binary variable's distance with respect to the index values
For a given binary decision variable $x[i,j,k]$ my goal is to get as dense results in terms of k for successive values of j. Distance of k value to be kept as close as possible throughout j values:
$d ...
3
votes
3answers
172 views
Possibility of indexing decision variables with 2 indices using a set of tuples in Pyomo
I am currently attempting to solve a network problem that is not fully connected.Thus, I have attempted to do some preprocessing of data so as to form a set of tuples, e.g. $\{(a,b), (c,e),\ldots\}$, ...
3
votes
1answer
109 views
View of Constraints and Decision Variables in Pyomo
I have just attempted to construct my first Pyomo model.
However, I was unable to locate any documentation that shows how to view constraints, decision variables.
As my model is big, I need to see ...
3
votes
3answers
260 views
SLSQP Optimisation loop takes several iterations to compute error function despite jacobian
I have an error function $f : w \rightarrow f(w)$ that I want to minimize, $w$ being a vector of length 211. There are some constraints on $w$.
I managed to compute the jacobian $J$ and even with it ...
3
votes
1answer
96 views
Pyomo: Help setting up my model
I have been working with a model for the past couple of weeks, but I am not sure what am I doing wrong as every time Pyomo returns that is infeasible or ...
3
votes
0answers
123 views
SDP relaxation with greater-than and less-than inequalities at the same time
I am dealing with the following nonconvex fractional quadratic optimization problem
\begin{align}
& \min_{\boldsymbol{x}} && \max_{t \in \mathcal{T}} \frac{\boldsymbol{a}_t^T \boldsymbol{...
1
vote
1answer
79 views
Pyomo: Struggling to get a constraint to work
I am trying to model an Electric Vehicle scheduling to minimise the electricity bill. Of course, the EV will only be able to charge every time that is plugged into a charging station (i.e. it cannot ...
3
votes
1answer
115 views
Space constraint in scheduling problem
I'm studying an MIP model with a scheduling problem and I'm wondering if the space constraint is correct.
If there is space in the factory at that time, the block can be processed, where
$i$ is the ...
1
vote
0answers
80 views
Question on quadratically constrained quadratic program
If the constrained optimization problem is a quadratically constrained quadratic program of the form \begin{align}\min&\quad x^HQx-a(x+x^H)+b|z^Hx|^2\\\text{s.t.}&\quad\|x\|^2\le1\end{align} ...
1
vote
3answers
210 views
Using big M values for a constraint
I want to enforce $x_{i,j}=x_{k,j}\implies z_i \neq z_k$ where $k = i-1$ so I used \begin{align}z_k + 1 - (x_{i,j} - x_{k,j})) \leq z_i \leq z_k - 1 - (x_{i,j} - x_{k,j})\quad\text{for each $j$}\end{...
1
vote
1answer
36 views
Enforcing discontinuous range for a variable
I want to enforce the following ranges for a set of variables, where the ranges for each variable are discontinuous. For example, I have two sets of ranges for each variable,
\begin{align}\sf LB_1 &...
4
votes
1answer
120 views
Buying shares in increments
I constructed an optimisation model which objective is to find highest return on available stocks. Now want to add a constraint that allows to buy stocks only in $2000 increments, how can I do it? i.e ...
4
votes
1answer
87 views
How to convert non-normal probabilistic constraints to deterministic ones for mathematical modelling?
I am working on a chance-constrained optimisation model that takes into account uncertainty. I am aware of how to convert constraints that are of a probabilistic nature into the equivalent ...
4
votes
0answers
50 views
Confused in how to insert a slack variable in a constraint inequality
According to my understanding, we should put a slack variable to equate an inequality constraint by inserting the slack variable in the side that is less than the other side. For example, if we have $...
9
votes
3answers
460 views
Is there a better way to formulate this constraint?
Let $x_{r}^{j}=1\iff$ the machine schedules job $j$ using resource $r$. My constraint says that: a resource cannot be used twice, i.e., if $x_{r}^{j}=1$, then $x_{r}^{j'}=0$ for $j'\neq j$. I write ...
3
votes
2answers
114 views
Minimizing a variable over the intersection of simplex and linear constraints
I am solving:
\begin{align}
\begin{array}{rll}
y^* = \min & y & \\
\mathrm{s.t.} & a_i^\top x \leq y, & i=1,\ldots,m \\
& x \succeq 0,\ \mathbf{1}^\top x = 1. &
\end{array}
\...
4
votes
1answer
101 views
Constraint programming in OPL: intervals covering time slots
I am trying to model the following:
There is a shop open from xx AM to yy PM.
In each 30 min time slot, there have to be demand[timeSlot] = x employees present.
E.g. the shop is open from 08am to ...
-4
votes
2answers
100 views
How can I model this binary logic?
I am looking for a constraint to express the following:
IF W1 = 0 AND W2 = 0 THEN Y = 0
IF W1 = 0 AND W2 = 1 THEN Y = 1
IF W1 = 1 AND W2 = 0 THEN Y = 0
IF W1 = 1 AND W2 = 1 THEN Y <= 1
...
6
votes
2answers
207 views
How can this be expressed as a MILP constraint?
I am looking for a constraint to express the following:
IF W1 = 0 AND W2 = 0 THEN Y = 1
IF W1 = 0 AND W2 = 1 THEN Y = 1
IF W1 = 1 AND W2 = 0 THEN Y = 0
IF W1 = 1 AND W2 = 1 THEN Y <= 1
...
7
votes
1answer
773 views
How to find the idle intervals in integer programming?
I have a scheduling problem with one machine and one job. I defined a binary variable $z_t$ that is 1 iff the job is scheduled at time $t$ (the job can be served in multiple times that are not ...
3
votes
1answer
57 views
Iterative calculus with Excel - N° 2
In continuation with the previous post, I propose you another problem.
I have this model:
\begin{align}\min&\quad F\\\text{s.t.}&\quad
F-(1150x_{B_{1}}+1000x_{B_{2}}+1350x_{B_{3}}-S_{1})=430\...
3
votes
1answer
239 views
Iterative calculus with Excel
I have this model:
\begin{align}\max&\quad\small{(0.2(1.07)^{-1}+0.2(1.07)^{-2}+0.9(1.07)^{-3})x_A+0.4(1.07)^{-1}+0.5(1.07)^{-2}+0.3(1.07)^{-3})x_B}\\&\quad 0.2x_{A}+0.4x_{B}\geq300\,000
\\&...
7
votes
2answers
317 views
The general meaning of “constraint relaxation” in the context of the Shortest Path Problem
I've read that in the context of the Shortest Path Problem, the use of the term "relaxation" ("relaxing edges")
[...][the use of the term "relaxation"] is historical. The outcome of a relaxation ...
8
votes
3answers
622 views
Bin packing variant
I am currently struggling with a bin packing variant, where we have fuel and compartments of a tank truck. Some industry constraints apply, but the whole picture is that you must fit the total volume ...
5
votes
1answer
237 views
TSP with constraints in OR Tools
I am completely new to OR Tools, but what I have tried so far seems very powerful.
I have, however, run into a problem that I cannot seem to figure out how to solve.
I am trying to model a TSP ...
5
votes
1answer
154 views
How to model shipment size constraint?
I am working on an LP problem where I have to model a constraint as:
"The total number of units of product A and B should be shipped in multiples of $1200$"
e.g. $700\text{(product A)} + 500\text{(...