# Optimize number of integers in LP problem solution

 1 What ways are there to both maximize the objective function and maximize the number of integers in a LP problem solution? asked 16 Feb '15, 15:51 klon 21●5 accept rate: 0% 2 @klon: What do you mean by maximizing the number of integers? If you are solving a MIP, all of the variables, which are defined to be integers, are going to be integers in the optimal solution (provided that the model is solved correctly). So, I don't see any point in maximizing the number of integers. (16 Feb '15, 15:59) Ehsan ♦ 1 Good call, I should not call it MIP, it's that I want to maximize the number of integers in the solution but it does not really matter which variables are integers and which are continuous. Fixing it. (16 Feb '15, 17:06) klon 1 @klon: Thanks for the clarification. Is there any practical application for this requirement? As noted by @Marco, modeling this requirement would only increase the problem complexity. (17 Feb '15, 01:45) Ehsan ♦ There is a cost associated with every non-binary variable in the solution. So including it in the objective function is one way I guess. (18 Feb '15, 16:31) klon

 3 To maximize the integrality, you can replace each original continuous variable $$x$$ with $$y+z$$, where $$y$$ is an integer variable and $$z$$ is a nonnegative continuous variable. Then your objective is to minimize the sum of the $$z$$ variables. You can explicitly put an upper bound of 1 on $$z$$, but that will happen naturally due to the objective. Your LP now becomes a MILP with twice as many variables, but no linearization is required. answered 19 Feb '15, 14:23 Rob Pratt 1.2k●2●6 accept rate: 28% 1 This method prefers x=(0.1,0.1) over x=(0, 0.3), although the latter has more integers. (19 Feb '15, 14:33) optimizer 1 Yes, it minimizes the total fractionality. To minimize instead the number of fractional variables, you can introduce binary variable $$w$$, together with big-M constraint $$z \le w$$, and minimize the sum of the $$w$$ variables. (19 Feb '15, 14:53) Rob Pratt
 2 Now, with your comment, I better understand the question. General problem first: two objective functions, so you will typically "weigh" the two objectives and mingle them into one objective (unless you embark on multi-objective optimization and seek Pareto-optimal solutions). The objective function could be expressed using additional integer variables z_i (one for each of your original continous variables x_i) and minimize their (absolute) difference |x_i-z_i|; you may need to linearize this using additional techniques. Is this what you need? Will make your problem harder to solve, though. answered 16 Feb '15, 18:49 Marco Luebbecke ♦ 3.4k●1●6●15 accept rate: 16% Thanks. This sounds like a way forward, but may turn out to be to computationally expensive. I am looking at optimizing as many variables as possible to be binary. What constraints should I place on z_i? Can you clarify with an example? (18 Feb '15, 16:33) klon see @Rob's answer (19 Feb '15, 14:29) Marco Luebbecke ♦
 2 Users tend to like the idea of weighting objective measures into one model. It's (in theory) easy and from a computationally side it also sounds better. Merging objective measures may work fine in many applications, but I have also often seen models formulated into one, with the users not knowing it was in fact a multi objective model to begin with or at least didn't sit down and think it through. Often the different objective criteria is very different, impacts the model and solution in completely different ways. I often suggest to build a model to be solved in several steps, before starting to merge objectives. This gives the advantage of better control and provides insight into the model effects. If that's too slow or otherwise doesn't work out, then by all means go for the weighted approach. answered 19 Feb '15, 12:47 Bo Jensen ♦ 5.0k●2●10●19 accept rate: 14%
 2 Add two binary variables $$y_i$$ and $$z_i$$ to indicate if $$x_i$$ is 0 or 1, and add the constraints $$x_i \leq 1-y_i$$ and $$x_i \geq z_i$$. Maximizing $$\sum_i (y_i + z_i)$$ will maximize the number of number of binary $$x_i$$. answered 19 Feb '15, 14:51 optimizer 176●1●5 accept rate: 6% Marco Luebbecke ♦ 3.4k●1●6●15
 toggle preview community wiki

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Tags:

×231
×190