Questions tagged [constraint]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
30 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 $...
1
vote
0answers
26 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 ...
3
votes
2answers
79 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
69 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
64 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
55 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
129 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
83 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
114 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
64 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
107 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
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} ...
1
vote
3answers
199 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
33 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
116 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
76 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
46 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
449 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
109 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
93 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
86 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
197 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
762 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
54 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
230 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
152 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
617 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
176 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
148 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{(...
5
votes
1answer
376 views

Single KKT solution for a simple problem: proof of being minimizer

I have a very simple problem: $$ \begin{align*} \begin{array}{ll} \min\limits_{x_1,x_2} & -x_1x_2 \\ \text{s.t.} & x_1 + x_2 - 2 = 0. \end{array} \end{align*} $$ The KKT system gives me $x_1^*...
5
votes
2answers
536 views

Integer programming problem

I have the following exercise: Stockco is considering four investments. Investment 1 will yield a net present value (NPV) of \$16,000; investment 2, an NPV of \$22,000; investment 3, an NPV of \$12,...
7
votes
2answers
212 views

shadow prices associated with nonnegativity constraints

Why are shadow prices associated with nonnegativity constraints also called as reduced costs, even if they have the same interpretation as shadow prices associated with an optimal solution? Why the ...
12
votes
3answers
805 views

Does it make sense to use strict equality constraint in optimization?

Once I learned from some post that the strict equality constraint in optimization problem does not make much sense. We should always use $\le$ constraint. How far this is true. If I must have a ...
5
votes
1answer
113 views

Precedence constraints using binary variables - DOCPLEX

I would like to establish a precedence constraint to ensure the precedence relation of tasks. I have a set of tasks available, but required tasks are not always the same. It means, the tasks executed ...
7
votes
2answers
133 views

Linear constraint formulation (OR-statement)

I have the decision variable $X_{iz}$ And I have two parameters $T_i\in\{0,1\}$ and $IT_z\in\{0,1,2\}$. I can only assign $i$ to $z$ if the following holds: for $T_i=0$, $IT_z$ needs to be $0$ or $2$...
10
votes
2answers
154 views

Linearization $\max(c_1 x_2, c_2 x_2, \ldots, c_nx_n) \geq q$ constraint

I have a MIP minimization problem where I have a maximization in the constraints: $$\max(c_1x_2,\, c_2x_2,\, \ldots,\, c_nx_n) \geq q$$ Where: $c_n$ constants $x_n$ binary variables $q$ constant $...
10
votes
1answer
283 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 &...
11
votes
1answer
138 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 ...
8
votes
1answer
145 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 ...
12
votes
1answer
224 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 ...
12
votes
1answer
476 views

If-then constraints in MIP programming

For continuous variables $x$ and $y$, the constraints are: ...
13
votes
2answers
930 views

Is This Constraint Convex?

I have a constraint that I believe to be convex and not affine which I think means that I can implement a relaxation. I will first define the full constraint, and then build up my (informal) reasoning ...
6
votes
1answer
57 views

Optimal resource allocation - 3 step process

I have a 3 step process. Step A takes 20 min, Step B : 60 min, Step C : 20 min Steps in production of output "news nuggets" is as below: Step A : Do Secondary Research Step B : Analyse the data, ...
6
votes
1answer
154 views

How To Linearize $X = \max\{x_1,x_2\}$

I am new to thinking about math programming and I have a particular constraint I am hoping to reformulate, I just don't know the proper mathematical translation for what I am hoping to do. Enforcing ...
9
votes
1answer
99 views

Constraint to state the relation between 2 binary variables

I'm trying to deal with a process planning and machine layout allocation simultaneously. I have the following variables: $X_p{_w}_{cj}=1$ if an operation $p$ is done by a machine $w$ with a ...
8
votes
2answers
745 views

How to linearize a constraint with max

I would like to linearize a constraint with max. I have the following constraint: $$\max_{pcj}X_{pwcj}\leqslant L_{wk}.$$ With this constraint, I would like to ensure that for $\forall w \in W$, no ...
8
votes
3answers
147 views

Difference between “Optimization” and “Constrained Optimization”?

(Another OR noob question) As I'm trying to learn about OR and Optimization methods for work, I'm having a hard time understanding the difference between "Optimization" and "Constrained Optimization"...
9
votes
2answers
156 views

Common structures in Gurobi - Python

I'm new to Gurobi in Python and I was wondering if someone knows how to code some common structures of linear constraints. I'm trying to understand how you'll code something like the following ...
9
votes
2answers
380 views

What is the standard practice in Constraint Programming modeling?

I know some general concepts regarding Constraint Programming (e.g., the ones explained in this answer). I am interested in learning how to formulate a combinatorial optimisation problem as a ...
9
votes
1answer
92 views

How to model 24 hours demand into a daily shift schedule?

I am working on a weekly staff scheduling optimization problem with 24/7 demand. The binary decision variable is: $X_{\text{staff},\,\text{day},\,\text{shift}}$ whether to assign the staff $s$ to day ...