Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 755

Optimization with a linear objective function, subject to linear equality and linear inequality constraints.

2 votes

Need help optimizing the loading of passengers on small airplanes

This is an optimization problem. The first step is to work out more precisely what your objective function is. In other words, given a candidate assignment of pilots, you need a well-specified way t …
D.W.'s user avatar
  • 166k
0 votes

Writing a linear program to model balanced bin packing

Define a variable $b$ that represents the imbalance between the lengths of the parking lanes. For instance, if $b=5$, that means that the lengths of every pair of parking lanes differs by at most 5. …
D.W.'s user avatar
  • 166k
1 vote
Accepted

Suppose we have two variables $x,y \in [1,n]$. How can we write $x \neq y$ in integer-linear...

With linear programming: you can't. With integer linear programming, here is one solution: introduce zero-or-one variable $t$, and the inequalities $$x \le y - 1 + (1-t)n, \qquad x \ge y+1 - tn.$$ Int …
D.W.'s user avatar
  • 166k
0 votes

Linear programming vs integer linear programming

Yuval Filmus suggests a counterexample: $x_1 + 2x_2 = 2$, $0 \le x_1 \le 1$, $0 \le x_2 \le 1$. Here there is a feasible solution to the LP instance with $x_1=1$, namely, $x_1=1$, $x_2=1/2$. However t …
D.W.'s user avatar
  • 166k
1 vote
Accepted

Infeasible linear programming reduce errors to find solution

One approach: replace each inequality $a_1 x_1 + \dots + a_n x_n \le b$ by $a_1 x_1 + \dots + a_n x_n \le b + t$, replace each inequality $a_1 x_1 + \dots + a_n x_n \ge b$ by $a_1 x_1 + \dots + a_n x_ …
D.W.'s user avatar
  • 166k
2 votes

Finding a set of maximally different solutions using linear programming or other optimizatio...

A heuristic, using linear programming One approach might be to pick a random objective function, and maximize it. Then repeat, with a different set of objective functions each time. In other words, …
D.W.'s user avatar
  • 166k
1 vote
Accepted

Help wrapping my head around a combinatorial optimization problem

I recommend you use an integer linear programming (ILP) solver to approach this. It will be relatively easy to code this up, and the resulting solution will probably out-perform any other simple sche …
D.W.'s user avatar
  • 166k
1 vote

Cast to boolean, for integer linear programming

Here's a solution that uses two temporary variables. Let $t,u$ be integer zero-or-one variables, with the intended meaning that $t=1$ if $x \ge 0$, $u=1$ if $x \le 0$, and $y=\neg(t \land u)$. These …
D.W.'s user avatar
  • 166k
3 votes
Accepted

Use max operation in a constraint in Linear Programming

Introduce variables $m_1,m_2,m_3$ to represent the three maxes. Add the linear inequality $m_1 + m_2 + m_3 \ge q$. Then, add the following extra inequalities for $m_1$: $0 \le m_1 \le 1$ $m_1 \le …
D.W.'s user avatar
  • 166k
2 votes
Accepted

Does there always exist equivalent (M)(I)LPs with and without objective functions?

Yes (assuming you truly did mean "if" rather than "if and only if"). Add any objective function you want (e.g., 1, or the sum of the variables, or anything), then feed it to a MILP solver and see whe …
D.W.'s user avatar
  • 166k
5 votes
Accepted

Converting If-else condition to Linear Programming

This can be expressed with just the equation $X=Y$. Since $X,Y$ are zero-or-one variables, the only possible assignments that are consistent with your condition are $X=Y=0$ and $X=Y=1$. See Express …
D.W.'s user avatar
  • 166k
2 votes
Accepted

Linear programming, Checking a constraint based on condition

If $X$ and $Y$ are zero-or-one (binary) integer variables, then this is encoded as $$X \ge Y.$$ Why does this work? If $Y=1$, then this enforces the constraint $X \ge Y$, as you wanted. If $Y=0$, …
D.W.'s user avatar
  • 166k
2 votes
Accepted

Express a "complex" IF-Statement to Linear Programming

You can solve this by introducing some temporary variables ($t,u,v$) and applying the big-M method. For each expression L <= b <= U, we'll introduce 0-or-1 variables $t,u,v$, with the intent that $u= …
D.W.'s user avatar
  • 166k
1 vote

Better way to formulate these constraints?

If your measure of "better" is number of variables or number of constraints, I don't believe it is possible to do better. You obviously can't use fewer variables as all of them are already defined; yo …
D.W.'s user avatar
  • 166k
2 votes
Accepted

How to efficiently specify a MILP constraint with nested AND and ORs

It can be done with two auxiliary variables, y1,y2: x1 >= y1 x1 >= y2 x1 <= y1 + y2 x2 + x3 + x4 >= 3*(y2 - y1) x2 + x3 + x4 <= 2 + y1 + y2 x5 + x6 >= 2*(y1 - y2) x5 + x6 <= 1 + y1 + y2 x7 >= y1 + …
D.W.'s user avatar
  • 166k

1
2 3 4 5 6
15 30 50 per page