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
4
votes
1answer
105 views

How do I formulate constraints that check if a parameter is between certain values, using binary variables?

I have $3$ parameters $a_1,a_2,a_3$ and a variable $d$ and $3$ binary variables $b_1,b_2,b_3$ and a "result" variable $s$. How do I model constraints so that: If $d$ is between $0$ and $a_1$...
1
vote
0answers
50 views

How do I write the following constraints in Pyomo?

I'm currently trying to replicate a vehicle routing problem paper, and I'm facing trouble writing the said constraints in the paper in Pyomo. I've been able to generate the data as required by the ...
2
votes
1answer
82 views

Linearly independent rows in simplex

I'm having some trouble understanding about the independent rows in a basic solution. In the book Introduction to linear optimization by B&T, the authors give the definition of a basic solution as ...
5
votes
1answer
82 views

if $x = 0$ then $y \ne b$

I'm trying to model the following: if $x=0$ then $y \ne b$ $y$ is a positive integer number( $y\le U$) and $x$ is binary and $b$ is a constant.
3
votes
2answers
214 views

How to make following constraint a convex one?

I would like to write a constraint as follows, where $x,y>0$ are optimization variables, and $a,b,c,d,A$ are positive constants. How to make it a convex constraint? \begin{equation} \frac{{ax}}{{\...
2
votes
1answer
67 views

CPLEX Indicator Constraints in Java API

I'm using the Java API of CPLEX (12.6.1 version) to solve a MILP problem. This is how I create 'normal' constraints: ...
0
votes
1answer
49 views

How to create constraint-equations in Pyomo with empty set inputs

I would like to crate an constraint-equation that depends on 4 sets. For that I use the following code: ...
6
votes
1answer
132 views

Two equivalent soft constraint implementations

Take the following optimization problem: \begin{align}\min_x&\quad f(x)\\\text{s.t.}&\quad g(x)\le0\end{align} with $f$ and $g$ nonlinear functions. Suppose I want to relax the constraint by ...
1
vote
2answers
97 views

Show the total unimodularity of constraints matrix

I have a model as below. I have constructed the matrix of its constraints as below. I need to show the total unimodularity of its constraints matrix. However, the determinant of the below submatrix (...
2
votes
3answers
78 views

Convex optimization on the unit hypercube with gradients and a bounded minimum

I'd like to find the minimum of a smooth, continuous function inside the unit hypercube (the dimensionality of which could go into the hundreds or even thousands). The function is convex (Hessian $\...
4
votes
3answers
129 views

How to couple a binary variable to a continuous variable to indicate values greater 0

I have a continuous variable $x_t$. A binary variable $b_t$ should be coupled to $x_t$ such that $b_t$ has the value $1$ if $x_t$ has a value greater than $0$ and $b_t$ has the value $0$ if $x_t$ has ...
5
votes
1answer
208 views

How to set a limit for a switch to 0 of a variable for 2 variables combined

I have a follow up question to another question of mine How to set a limit for a switch to 0 of a variable about counting the number of switches to 0 of one decision variable. Now I would like to ask ...
4
votes
1answer
311 views

Is there any automatic way to spot contradictory constraints in linear programming?

Let's have the following trivial linear program: \begin{align}\max&\quad z=20A+30B\\\text{s.t.}&\quad A\le60\\&\quad B\le50\\&\quad A+2B\ge220\\&\quad A,B\ge0\end{align} It's easy ...
2
votes
1answer
40 views

How to write the following constraint? [duplicate]

I would like to write the following constraint, where $varBuyWater$ and $varSellWater$ are decision variables on how much water to buy and to sell. However, I do not want the solver to buy and sell ...
5
votes
1answer
193 views

How to set a limit for a switch to 0 of a variable

I would like to know how to define a constraint to set a limit for switching to 0 for a decision variable? So I have a linear variable $x(t)$ which quantifies the modulation degree of a heating device....
3
votes
1answer
59 views

Constraints that set values to binary variables depending on other binaries

I am trying to write a mathematical problem that involves some conditions based on binary variables. More specifically, I have a set of three binary variables $d_1$, $d_2$, $d_3$ and depending on ...
3
votes
1answer
255 views

How to find out which constraint causes problems in Pyomo

I have a Pyomo model with many constraints and variables. When solving it with Gurobi, I get the message "Model is infeasible or unbounded". Now I would like to find out which constraints ...
0
votes
0answers
171 views

Use if-statements when defining a constraint in Pyomo

I would like to define the value of a variable model.variable_costsPerTimeSlot [t] in pyomo and I would like to use if-statements. Depending on the value of the if-...
1
vote
1answer
30 views

How to assure a range for a specific variable in Pyomo

I would like to specify a certain range for a variable for a certain timeslot in Pyomo. I have a temperature variable $T(t)$ that is defined by using the difference equation $$T(t) = T(t-1) + \cdots,\...
2
votes
1answer
33 views

Piecewise Constraint in Abstract Model

I would like to write a piecewise constraint for an Abstract Model in Pyomo. $$\operatorname{pu}_i(t_i^{'v})=\begin{align}\begin{cases}\rho_1(e_i'-t_i^{'v})+\rho_2(e_i-e_i'),\quad& t_i^{'v}\le e_i'...
0
votes
0answers
24 views

Correct way to define constraints in Pyomo

Can I know if the constraint below can be defined as follows in Pyomo for convex optimization. W and G are arrays of dimension M x N. ...
1
vote
1answer
65 views

Can I define constraints in Pyomo as a list?

I would like to define the following constraint in Pyomo $$W^\top{\bf 1}\le\hat w=\begin{bmatrix}\hat{w}_1&\hat{w}_2&\ldots&\hat{w}_N\end{bmatrix}^\top$$ where $W$ is a $2\times4$ matrix. ...
7
votes
2answers
162 views

Index of element in MILP vector decision variable that equals 1

Consider a decision variable in a MILP constrained: $$\sum_i p_i = 1$$ $$p_i\ \in \{0, 1\}$$ Obviously one element in $p$ is 1 and all others are 0. How can I set a decision variable to the index i of ...
2
votes
1answer
128 views

Matrix Singularity Constraint

I'm using CVXPY. Given a $2\times2$ matrix $A$, is it possible to add a singularity constraint? Anything equivalent to: $|A| = 0$: The determinant is $0$ $\operatorname{rank}(A) \leq 1$ Smallest ...
2
votes
1answer
124 views

MILP constrained by the minimum number of satisfied constraints

I have an MILP where we have $$ t_k = \sum_i P_i\cdot C_{ik} : P_i\ \in \{0,1\}, C_{ik} \in I^+ $$ and our model is constrained by the number of times $t_k$ is bigger than a certain value $T_k$. $$ \...
3
votes
1answer
102 views

Maximizing a piecewise-linear convex function

Note: Initially posted on MathOverflow. I am working on an optimization problem where some of the terms of the objective function to maximize are expressed as a piecewise linear function of variables:...
4
votes
2answers
429 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}=...
4
votes
1answer
92 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\\&...
3
votes
0answers
99 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 ...
3
votes
2answers
308 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 ...
2
votes
2answers
99 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
100 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....
3
votes
2answers
259 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
71 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
68 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
103 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
56 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
111 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
203 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 ...
2
votes
3answers
204 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
225 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
64 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
320 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
429 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
86 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
40 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
178 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
65 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
3answers
208 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 ...