Questions tagged [constraint]
For questions related to constraints, i.e. any restriction or relation a set of decision variables has to satisfy.
219
questions
1
vote
2
answers
51
views
How to linearize a chain of if-then constraints?
How can I express the process of converting a series of if-then constraints into a linear form?
Let's assume that we have integer variable $x_i$, non-negative variables $y_i^d$, and binary variables $\...
4
votes
2
answers
348
views
union of constraints
How to solve problems like $\min_x f(x) \\ g(x) < 0 \ or \ h(x)<0$?
I think we can solve $\min_x f(x) \\ g(x) < 0 $ and $\min_x f(x) \\ h(x) < 0 $, then we compare the solutions from these ...
1
vote
2
answers
71
views
Grouping variables to take same value
Assume we have 50 variables that we want to split into 3 groups and each group should have at least 5 variables. How to formulate that all variables in the same group take the same values? I used the ...
1
vote
2
answers
146
views
how to satisfy time constraints with meeting points?
I have a specific pickup and delivery problem to work on and am thinking how to incorporate time windows effectively. The problem has some driver with some time window [$a_d, b_d$] which is the start ...
3
votes
0
answers
54
views
constrained optimization with decreasing constraint thresholds -Literature tips
consider a constrained optimization problem (typically c=0), with f highly nonlinear:
\begin{equation}
\text{minimize}_x f(x) \\\\ s.t \ \ \ \ g(x) \leq c
\end{equation}
I experimented a bit and found ...
2
votes
1
answer
164
views
it is possible to have a constraint that does not contain any decision variables
I had formulated an optimization model, and along the way I had to change a variable into a parameter. In doing so, one of my constraints that contained the variable I changed no longer contained a ...
1
vote
1
answer
108
views
Sigmoidal programming
I plan to use sigmoidal programming from the git repo https://github.com/madeleineudell/SigmoidalProgramming.jl
There are some issues with the implementation of this repo. It requires me to pass $A, b,...
3
votes
2
answers
330
views
How to model this binary constraint?
I have an optimization problem that has a variable in the matrix form. The variable is a binary matrix. It has size $M \times N = 10 \times 50$ where $M$ is the number of machines and $N$ is the ...
2
votes
2
answers
349
views
Representing "and"/"or" relationships into constraints
How do I represent the following constraints in terms of equations?
For each i, either (1) holds or (2) holds-
$$
x_{1}^i \geq x_{2}^i \quad and \quad x_{3}^i \geq x_{4}^i \quad {(1)}
$$
$$
x_{1}^i \...
3
votes
3
answers
214
views
Equivalence between constraints in ILP
Let's have binary variables $x$ and $y$. I'd like to define a helping binary variable $z$ such that
$$ z = 1 \; \;\; \mathrm{iff} \; \; \; x + y = 2.$$
If I wanted to express the equivalence between ...
1
vote
1
answer
118
views
Linearize conditional constraint
Consider a variable c from the domain {-1,0,1}. I have the following constraint:
IF $c = 1 \Rightarrow x = 1 $ ELSE $x = 0$
How do I linearize this constraint?
1
vote
0
answers
51
views
How to speed up state of charge constraint in Pyomo model
Context: I am working on a small electricity market model in Pyomo. It optimizes the capacity of different technologies and generation in at least 43800 hours. One of the technologies is a battery. ...
2
votes
2
answers
48
views
How to restrict the amount of consecutive assignments
I'm working on a scheduling/rostering problem. In this scenario the shifts are predefined with a starting and ending date and time.
The problem basically assigns people to shifts with a binary ...
0
votes
1
answer
57
views
Maximization problem with preferences on variables
Consider the following trivial, theoretical model:
$$
\max x+2y+3z \qquad s.t.
$$
$$
x \leq b_x
$$
$$
y \leq b_y
$$
$$
z \leq b_z
$$
$$
x+y+z = 1
$$
$$
x,y,z \in \{0, 1\}
$$
and $b_x$, $b_y$ and $b_z$ ...
1
vote
1
answer
63
views
Multiplicity-Constraint in Constraint Programming Solvers
I need to solve a CSP with a constraint imposing upper bounds on the multiplicity of variables in a list.
More precisely, I need a constraint of the form
...
0
votes
1
answer
76
views
Meaning difference between SUMMATION and not in the MIP model
I'm asking you a question because I was confused about MIP while reading the paper.
This paper is about dual crane optimization.
In the MIP model of the paper, equations (7) and (8) are used to model ...
2
votes
3
answers
109
views
Efficient formulation of flexible job-shop scheduling constraints
I am working on a flexible job-shop scheduling problem, where indices are as follows:
$i$: Index of operations
$j$: Index of jobs
$m$: Index of machines
$p$: Index of operation sequences on a machine
...
4
votes
2
answers
206
views
how to ensure minimum output of a generator (else zero output) in linear programming?
I want to ensure, that a generator (in my case a heat generator, for example a boiler) first starts to output thermal energy, when a certain minimum output can be realized. Otherwise the output should ...
3
votes
3
answers
278
views
Set null the next set of N values
I'm dealing with a problem I already modelled by using linear programming. The already existing constraints set at 1 groups of contiguous variables (for ex: ...
3
votes
2
answers
450
views
Binary integer programming with dynamic costs and total resource constraint
I am trying to find a suitable paradigm under which my discrete optimisation problem falls into. This looks similar to integer programming, so the goal is to find a binary vector $\bar{x}$. However, ...
2
votes
1
answer
69
views
Prove MF-Constraint Qualification but not LICQ is satisfied
Let $g_1(x):=(x_1-1)^2+(x_2-1)^2-2\leq 0, g_2(x):=(x_1-1)^2+(x_2+1)^2-2\leq 0, g_3(x):=-x_1\leq 0$ be given constraints. Show that the Mangasarian-Fromovitz Constraint Qualification (MFCQ) is ...
2
votes
1
answer
120
views
Piecewise constraint using big-M notation
I have a piecewise constraint that I am having a hard time converting using big-M modelling. The context is a gym owner that is updating membership costs subject to churn restrictions. The owner can ...
2
votes
1
answer
86
views
Formulate revenue maximization problem and find an appropriate solver
I am trying to maximize expected revenue over a horizon.
Consider the following function:
\begin{align}
sales(budget_1, budget_2) = \sum_te^{C_1t} * budget_1t^{saturation_1t} + e^{C_2t} * budget_2t^{...
1
vote
1
answer
62
views
Problem to construct constaints in SAA method
Pop-Donuts located in Los Angeles of California makes two products, donuts and cakes. Pop-Donuts has bottlenecks in its capital used to purchase flour that is required in making both donuts and cakes, ...
-2
votes
2
answers
57
views
How to model the following "if, then" constraint
There are two matrices:
Matrix $S^{v\times v} \in \{0,1\}$ this is a know parameter.
Matrix $X^{v\times p} \in \mathbb{N}$. Elements of $X$ are the variables.
I want to model:
$$\textrm{if }s_{v v'} =...
1
vote
1
answer
64
views
Homework Problem – Help Formulating Constraints [closed]
I am working on the following assignment problem:
You may produce seven products by consuming three materials. The unit sales price and material consumption of each product are listed in Table 1. For ...
1
vote
2
answers
115
views
How to formulate this NLP problem correctly?
Current status on the problem (what I've done)
I'm working on a NLP problem and I got a formulation of the problem, together with the necessary constraints, but I think it needs some adjustments to ...
2
votes
1
answer
437
views
Optimization problem with if condition as constraint
I am trying to solve an optimization problem where the constraint contains absolute values and I am not sure how I can express this in a 'Pyomo-friendly' way.
Consider the following optimization ...
3
votes
2
answers
379
views
Constrained optimization of a sum
I have to maximize the function $f= \sum_{i=1}^na_ix_i $ subject to the constraints $g = \sum_{i=1}^n x_i = 0 $, $-1\leq x_i \leq 1$ and $a_i>0$. Lagrange multiplier method doesn't work because $\...
3
votes
1
answer
265
views
Binary variables constraint
What constraints would you write to ensure that if $x = 1$ then $y = 0$ where $x, y$ are binary variables?
Until now I only learnt how to build the constraint with 3 binary variables, therefore the ...
4
votes
1
answer
183
views
Difficult linearization of a constraint
My previous question was about this ILP with all binary variables:
$$\min \sum_{1\leq i<j\leq n-1-h} t_{i,j}$$
$$\sum_{i=1}^{n-1-h} a_{k,i} = \lfloor (n-1)/2\rfloor \qquad \text{for }k\in[h];$$
$$...
3
votes
3
answers
542
views
Gurobi - Python: is there a way to express "OR" in a constraint?
I'm new to Gurobi in Python and I am wondering if there is way to express/code "or" in the following constraint, where $x_i$ are binary variables:
$x_i-x_i*x_{i-1} =0$
OR
$x_i*x_{i+1} =1.$
...
1
vote
1
answer
68
views
Can I get value from a variable and use it on a specific index of a different variable?
This is a peculiar question but I have two variables $s_{ik}$ (integer) and $y_{it}$ (binary). What I want is the following relationship: If $s_{ik} = 8$, then $y_{i8} = 1$.
Basically, if $s_{ik}$ ...
3
votes
1
answer
122
views
Efficient modelling via Gurobi
I would like to model the following constraint set in gurobi-java.
\begin{equation}
t^n_{ij} \geq t^n_{(i-1)j}+S_{(i-1)j} - (1 - \sum_{\substack{m \in \mathcal{M} \\ G_{ijm} = 1}}\sum_{k \in \mathcal{...
3
votes
1
answer
90
views
Projection to sublevel sets of convex/strongly convex function
Given a convex compact set $K\subset\mathbb{R}^D$ and convex function $f:K\rightarrow \mathbb{R}$, the sublevel set
$$
X_\alpha = \{ x \in K : f(x) \leq \alpha \}
$$
defines a convex closed set (...
3
votes
0
answers
67
views
Projected Gradient Ascent for linear programming
I need to find a reasonable maximum for a linear programming problem, for which standard solvers for linear programming are just too slow. I was thinking of using projected gradient ascent, but do not ...
3
votes
1
answer
274
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\}$,
...
2
votes
0
answers
125
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 ...
0
votes
1
answer
133
views
How to code this constraint in CPLEX?
$$\sum_{j\in M}\sum_{k=i}^{\rm until}x_{aijk}\cdot b_{kj}=d_{ai},\quad\forall i\in N,\forall a\in B\cap A_1;{\rm until}=\min(i+v_a,n)$$ How to code this linear program in CPLEX?
2
votes
3
answers
300
views
Create constraint only for a recourse problem in stochastic linear programming
Question1: Northam Airlines is trying to decide how to partition a new plane for its Chicago–
Detroit route. The plane can seat $200$ economy class, passengers. A section can be partitioned off for ...
0
votes
0
answers
63
views
Looking for correction in pyomo constraint
I am working on two graphs having nodes and edges.
Graph1: VNF Graph with node demand and bandwidth demand.
Graph2: Server Graph with node capacity and bandwidth capacity.
The nodes and links of ...
3
votes
1
answer
66
views
How to write a constraint to define valid agglomerations of sites?
I am currently attempting to use a MIP to optimize the agglomeration of sites to fit a minimum size.
Take for example the following simplified situation of 9 sites which could be any range of sizes.
...
2
votes
1
answer
122
views
Fixing a complex linear constraint in pyomo
My directed graph f with any node u has a set of outgoing and incoming links as uv ∈ O(u) and vu ∈ I(u) respectively.
I am trying to write this constraint
here ϕ refers to a binary decision variable ...
5
votes
1
answer
177
views
Absolute value in an equality constraint
What is the best way to model or represent an equality constraint which includes an absolute term in the expression:
$$ x = |y| $$
$x \in \mathbb{R^+}$ and $y \in \mathbb{R}$
4
votes
1
answer
177
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 ...
6
votes
1
answer
1k
views
Quadratic constraints in JuMP
I am a bit new to programming and am currently working with solving optimization problems in JuMP in Julia.
I got a tip from the JuMP page that I should also use ...
1
vote
1
answer
51
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 ...
7
votes
2
answers
297
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?
5
votes
1
answer
260
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 &&...
5
votes
1
answer
177
views
Should I replace equality constraints by inequality constraints if the variables in the constraint appear in the objective?
Suppose I am minimizing a MILP and my objective is simply $\sum_i{x_i}$, where $x_i$ is binary. I also have a constraint saying that $1-\sum_j y_j = x_i$, $\forall i \in \mathcal{S}$, $\forall j \in \...