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
2 votes
0 answers
32 views

Lifting a 3rd order polynomial into a higher dimensional space

An MINLP from a paper I am reading has the following expression in its constraints: Where from left to right: $p_{l,s}$: continuous variable $z_l$: binary variable $b_l$: constant $\Delta \theta_{l,s}...
user avatar
1 vote
0 answers
44 views

Minimize cost given working days/hours/required hours per job/start & end dates

I am trying to solve an optimization problem on Excel or Python. My constraints are the available number of employees (=20), the number of working days/month (=20), the number of working hours/day (=8)...
user avatar
1 vote
1 answer
81 views

PULP : Constraint violation - multiple of expected value

I am developing a linear programming model in PULP that sends material from Origin Facilities to Transfer and Final Treatment Facilities. The objective function is based on summing the transport and ...
user avatar
  • 11
1 vote
0 answers
77 views

How can I reformulate an LP whose variables are linked to other LPs?

I consider an LP ($LP^*$) having an objective function defined as follows: $$\max_{x, y} \sum_{i \in I} p_i(x_i) - \sum_{j \in J} q_j(y_j)$$ where $x_i = \sum_{k \in [m]} x_{ik}$ and $y_j = \sum_{l \...
user avatar
2 votes
0 answers
43 views

How to add a cut to avoid previously found solution? [duplicate]

I do have a MILP problem. The decision variables are Integer ones. Let's call them $x_i$ and i $\in \{0,1,2,3,...,N \}$ I do want to find all distinct solutiuons for this problem. The problem is ...
user avatar
2 votes
2 answers
89 views

Is it possible to import the pyomo model solution in another .py file in the same directory

I have a model say cost.py as follows: ...
user avatar
3 votes
1 answer
107 views

Modeling a special case of conservation of flow

At a particular mode, there are 2 inflow arcs, a and b, and two or more outflow arcs, which is kept to 3 for this example, i.e., c, d and e The first requirement is that only one of the two inflow ...
user avatar
  • 695
6 votes
2 answers
311 views

How to represent a constraint on the kth-smallest function?

How can I represent the following set of constraints in a linear program, where $c_1,\ldots, c_n$ are constants and $f_1,\ldots,f_n$ are functions of the optimization variables? The smallest of $f_1(...
user avatar
1 vote
0 answers
54 views

Simplification of nonlinear constraint for optimization

I solve a nonlinear optimization problem with constraint $$ \sum_{j=1}^S \ln \Bigg( \Big(1 -x_j c_k + y_j d_k\Big)^2 + \Big( x_j d_k + y_j c_k \Big)^2 \Bigg) \leq 0, \: k = 1, \dots , K $$ where the ...
user avatar
  • 297
2 votes
1 answer
96 views

Restriction on gurobipy problem

The main problem is the optimization of the filling of a tank, filling it in cheap periods and extracting in expensive periods to sell. I am using Python and gurobipy. I am not able to model this ...
user avatar
  • 49
4 votes
2 answers
512 views

Modeling an either-or-constraint

We would like to model a constraint for an assignment problem that dictates that either assign a specific subset of nodes $I\subset\mathcal{I}$ to a specific subset of nodes $J\subset\mathcal{J}$, or ...
user avatar
3 votes
2 answers
131 views

Impact of soft constraints in MILP

I'm wondering about the impact of soft constraints, since no one mentioned that in Soft constraints and hard constraints. My team makes all the constraints soft in MILP, so that a feasible solution ...
user avatar
  • 381
5 votes
2 answers
392 views

Quadratically constrained convex optimization

I have tried to convert the following constraint into SOCP form but can't figure it out. My issue is that whenever I create the norm, the other side has to be square rooted which invalidates the SOCP ...
user avatar
0 votes
1 answer
170 views

How to put this restriction using Gurobi in python

I am doing an optimization problem for the filling and extraction of a warehouse. One of the constraints is that the filling volume cannot exceed a given limit for one day: For example, on the 3rd of ...
user avatar
  • 49
4 votes
1 answer
156 views

How to transform a (thermal) range constraint into the objective function

I have an mixed-integer linear optimization problem that includes a energetic difference equation for the temperature of a building for the time $t$: $$T(t) = T(t-1) + \frac{E^{\rm Heating}(t)-E^{\rm ...
user avatar
  • 1,576
1 vote
2 answers
148 views

How to solve assignment problem with type constraints?

There are $n$ jobs and $m$ machines. Assigning job $i$ to machine $j$ yields a profit of $c_{ij}$. Each job has a type $t_i$. Machine $j$ can take on up to $a_j$ jobs, but the number of job types must ...
user avatar
  • 51
2 votes
1 answer
129 views

Passing exact number of allocations as constraint to pyomo in a sourcing problem

I am solving a sourcing allocation optimization problem. Here I have let's say two brands. Each brand has a raw material demand across the 3 plants (Demand in kg) Brand 1 Brand2 Plant 1 3000 2000 ...
user avatar
2 votes
1 answer
65 views

How to optimize multiple linear regressions based on cost?

I have an optimization problem where I'd like to maximize revenue and I have separate variables for cost and revenue. Building a single unit of a product takes 100 hours of labor I have a list of ...
user avatar
  • 197
1 vote
1 answer
128 views

How to get negative shadow price for minimization problem in Gurobi?

I am currently working on a scheduling problem (MIP) to minimize cost, and my idea is to first generate a set of discrete initial solutions, and build an LP model with the discrete initial solution to ...
user avatar
  • 19
2 votes
1 answer
80 views

Robust way to implement $(x=0) \Rightarrow (y=0)$, with $x$ nonnegative and $y$ binary

I am formulating a MILP in which there is a continuous variable x and a binary variable $y$. In the program formulation there are the following constraints: $Ay\leq x \leq By$ (with $0\leq A\leq B$). ...
user avatar
  • 414
4 votes
2 answers
282 views

Python Pulp - LpMinimize Not Returning Expected Output - Scheduling Problem

I'm working on my first pulp model and something isn't going quite right. It looks like it's close, but for some reason it is not respecting one of my constraints... It's a scheduling problem and I am ...
user avatar
  • 63
3 votes
1 answer
135 views

Model generation for large-sized instances

I have a scheduling model where each job $p$ requires three operations (with fixed precedence and they must happen in a row) for a fixed number of $i$ service sessions (each session on a specific day)....
user avatar
  • 343
8 votes
2 answers
1k views

Can the (famous) "Problem of Apollonius" be Considered as a "Constraint Optimization" Problem?

In the famous "Problem of Apollonius" (https://en.wikipedia.org/wiki/Problem_of_Apollonius), the goal is to draw three circles that are tangential to another circle: Algebraically, we can ...
user avatar
  • 1,839
5 votes
2 answers
267 views

Regularization in Machine Learning : Constraint Optimization in Disguise?

I have the following question on "Regularization vs. Constrained Optimization" : In the context of statistical modelling, we are often taught about "Regularization" as a method of ...
user avatar
  • 1,839
10 votes
1 answer
716 views

No "not equals" constraint in Gurobi

I'm using Gurobi and trying to set a constraint that two variables A, B are not equal ...
user avatar
  • 145
3 votes
1 answer
106 views

Constraint Optimization and Feasible Regions

Someone asked me this question the other day: If constraints reduce the feasible region of an optimization problem (e.g. linear programming), then why is constraint optimization considered more ...
user avatar
  • 1,839
3 votes
1 answer
140 views

If-then condition formulation to avoid variable multiplication

I'm trying to formulate the following logic: If $y_i =1$, then $c_i \leq x_i$ If $y_i =0$, then $c_i \leq 0$ Where $y_i$, $c_i$, and $x_i$ are decision variables. The easy way would be to write: $$c_i ...
user avatar
3 votes
1 answer
884 views

Complicated constraint with logical operators in PuLP

I have an optimization problem that I am trying to solve with PuLP. All the variables are Booleans. The variables that are "selected" will be true, all others false. Objective function is ...
user avatar
  • 33
1 vote
1 answer
164 views

Tuples OPL in VRP

I am trying to build a constraint of the form x[i j] +x[j i] <y[i][j] where x is a decision variable if arc ...
user avatar
1 vote
0 answers
60 views

Minimizing total number of banners used in the cover buildings problem modelled

I was watching a video about Google OR-Tools where they were solving this cover building problem from Codility challenges using constraint programming. In short, you have a list of building heights, e....
user avatar
  • 111
5 votes
2 answers
341 views

The importance of evaluating the number of constraints

If I introduce a problem, say as an ILP formulation, should I also discuss the number of introduced constraints? If yes, why?
user avatar
2 votes
1 answer
60 views

How to model a cumulative resource constraint with same family condition?

Assume that we have 3 tasks to schedule : $x_{a1}, x_{a2}, x_{b3}$. They all use the same cumulative resource : $r_1$. Each activity increases $r_1$ by $1$ at it starts time and decreases $r_1$ by $1$ ...
user avatar
3 votes
2 answers
134 views

Defining multiple constraints compactly where some index combinations are not defined

My question is about how usual/strange defining constraints compactly can be (in a scientific document). Formally, I define constraints $$f_{i,j,k}(x) \leq 0, \quad \forall i \in [I], \ \forall j \in [...
user avatar
2 votes
1 answer
62 views

Represent the minimum between two terms as a continuous constraint

Let's consider the following minimization problem: \begin{align} \min_{x,a,b}&\quad X\tag1\\ \text{s.t.}&\quad X = \min(A,B)\tag2\end{align} with $A,B$ functions that depend on $X$. Is there a ...
user avatar
  • 393
4 votes
1 answer
199 views

How do constraints become redundant in a Big-M conjunction?

The following Big-M conjunction appears on page 14:3 of The Path&Cycle Formulation for the Hotspot Problem in Air Traffic Management: \begin{align*} \text{(i)} \quad t_{(g, \; s)} - t_{(f, \; s+...
user avatar
4 votes
2 answers
103 views

Deriving order/rank variable from another decision variable

There is a decision variable $x_i$ which denotes the time when a person is allowed to do his work. The objective function is $\min (x_i - a_i)$ where $a_i$ is the time when the person arrives at the ...
user avatar
4 votes
1 answer
132 views

Constrain Mixed-Integer problem such that a graph is fully connected

I have a problem (see my questions about Architectural layouts which poses an interesting abstract question) where there exists an implicit (symmetric) graph whose values in the adjacency matrix are ...
user avatar
2 votes
1 answer
139 views

Can we take the constraints from one model and plug them into the other model in pyomo?

I am implementing data-driven robust optimization methodology introduced in this article in python. Somewhere of the method, I need to use pyomo for each constraint whose parameters are uncertain to ...
user avatar
  • 103
7 votes
3 answers
265 views

How to model a non-overlap constraint between 2 groups of tasks?

Let $T$ be a set of tasks. Each task $t \in T$ has a duration $d_t$. Let $T_1 \subset T$ and $T_2 \subset T$ such as $T_1 \cap T_2 = \emptyset $ How can I model the following constraint : all tasks ...
user avatar
1 vote
1 answer
169 views

Operator error in operating cost model constraint

I have built a model to minimize the operating cost and when I coded a model in CPLEX, it gave an error at Cons09: ...
user avatar
1 vote
0 answers
84 views

vehicle routing optimization, Big M method of reformulation of constraints

Please excuse me for the long question, if I dont prrovide this info. my post gets removed! The following optimization problem is called Mixed-Integer Quadratically Constrained Programming (MIQCP) ...
user avatar
4 votes
2 answers
149 views

How to model: If $X\ge\epsilon$ then $X\ge Y$

Let $0\le X\le\bar X$ and $0\le Y\le\bar Y$ be nonnegative continuous variables. Let $\epsilon$ be a small positive number. How can the constraint $X\ge\epsilon\implies X\ge Y$ be modeled?
user avatar
  • 1,946
2 votes
0 answers
107 views

How to write the constraint matrix for this blending problem?

Below is a model for maximizing a utility function, a blending of, 3 ingredients $(A, B,C)$ to obtain 3 mixes of fertilizer, with the recipe given as proportions. Ingredients cost $A=130,\ B=150,\ C=...
user avatar
  • 21
4 votes
1 answer
105 views

Lot-sizing problem variant

I have a the following optimization problem: I have mandates,(e,g. to deliver 100 tonnes of products) that I need to schedule its delivery during the month (day 2: deliver 40 Tonnes, day 15: deliver ...
user avatar
  • 119
4 votes
1 answer
573 views

Gurobi: how to add a constraint to make there be only one non-integer value

line1 line2 line3 line4 A 2.3 0 3.1 0 B 0 4 2.2 0 C 1.1 0 0 4.6 Let's say after optimization with certain constraints, my model will generate an optimal production allocation table similar to ...
user avatar
  • 41
1 vote
0 answers
205 views

Adding sequence constraints to the assignment problem- Python

This is an online assignment problem and yet can be considered as an assignment problem with a sequence. Assume that workers are coming into the system sequentially and I want to assign a task to them ...
user avatar
4 votes
1 answer
339 views

Constraintlist with two Options Pyomo

I recently started with Pyomo and I have the following Problem: I want to construct a ConstraintList with an if statement. I already learned, that it's not possible. But the problem still exists... My ...
user avatar
3 votes
1 answer
61 views

How to specify an objective function that prohibits trading in both directions linearly

I am building a small model that trades water and buys water. For simplicity reasons, I am only discussing the relevant constraints: $\sf varWaterIn_h$ is the amount in litres of water bought per hour,...
user avatar
  • 507
0 votes
0 answers
81 views

Products distribution planning model

I have a problem of planning the distribution of products for a month. I have different unique products. A Mandate is provided for each product, and the Mandated quantity for each product is to be ...
user avatar
  • 119
1 vote
1 answer
164 views

How do I write the following constraint?

I have defined the index for time to be T = [1,2,3,4,5,6]. I want that that the demand that to be addressed twice in a given a time period, when the difference between the time the demand is addressed ...
user avatar