# Questions tagged [constraint]

For questions related to constraints, i.e. any restriction or relation a set of decision variables has to satisfy.

81 questions
Filter by
Sorted by
Tagged with
1answer
26 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 ...
0answers
46 views

### How to treat with equality constraints in whale optimization algorithm? [duplicate]

Whale optimization is one of the metaheuristic algorithms which used to find the optimal solution to unconstrained optimization problems. I have an objective function : $x_1+2 x_2−6 x_3≥0$, subject to ...
3answers
173 views

2answers
302 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 ...
1answer
401 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.
1answer
73 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 ...
0answers
33 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?
1answer
59 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 ...
2answers
115 views

3answers
115 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\}$, ...
1answer
78 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 ...
3answers
198 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 ...
1answer
88 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 ...
0answers
117 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{...
1answer
69 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 ...
1answer
112 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 ...
0answers
75 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} ...
3answers
205 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{...
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 &...
1answer
118 views

3answers
456 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 ...
2answers
111 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} \...
1answer
100 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 ...
2answers
94 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 ...
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 ...
1answer
767 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 ...
1answer
56 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\...
1answer
237 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 \\&...
2answers
253 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 ...
3answers
621 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 ...
1answer
204 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 ...
1answer
153 views

2answers
657 views

1answer
342 views

### Linear programming with if-then-else (big-M)

I am trying to formulate the following in linear programming. \begin{cases}\text{if}\,\,a>b\,\,\text{then}\,\,c=a\\\text{else}\,\,c=b.\end{cases} I tried some things with big $M$, like a + my &...
1answer
170 views

### Example satisfying Mangasarian-Fromovitz CQ but not LICQ

On Wikipedia's page for the KKT conditions, it is stated that Mangasarian-Fromovitz constraint qualification (MFCQ) is weaker than linear independent constraint qualification (LICQ). What is a ...
1answer
187 views

### Minizinc: How to use a predicate in an assert statement?

Trying to use minizinc builtins to do some basic validation of data inputs but I get a type error ...
1answer
299 views

### Which ML algorithms work by solving constrained optimisation problems?

As far as I know, most machine learning algorithms solve unconstrained optimisation problems, i.e., if we were to unroll all the neurons into symbolic expressions we would end up with a massive ...