Is this an integer programming problem?

In summary, the conversation discusses a problem in a piece of software where the goal is to find a value 'X' that is valid for all streams, other than the trivial 0. The solution proposed involves multiplying the value of 'a' in each stream by a sufficient integer and then multiplying all the resulting values together. However, it is noted that this method may not work for real numbers. The conversation also touches on the concept of irrational ratios and how they can impact the problem. Overall, the discussion helps to clarify the problem space and provides some potential solutions to consider.
  • #1
rumborak
706
154
At work I am writing a somewhat complex piece of software, and inside it at some point I have to solve the following problem:

I have several "streams", each of which has equally spaced points according to a proportionality factor 'a', i.e. X=a*n. Each stream has a different 'a'.
As an example:
Stream 1, a = 1.5: X = 0, 1.5, 3, 4.5 etc
Stream 2, a = 1.0, X = 0, 1, 2, 3 etc
Stream 3 ...

The question to solve: is there a value X that is a valid point for all streams, other than the trivial 0?
This problem strikes me as integer programming, but I have no good idea how to go about it, short of brute force.
 
Mathematics news on Phys.org
  • #2
To get a value of X that will be valid for all streams, you'll first need to multiply the value of 'a' in each stream by a sufficient integer such that the result is an integer if 'a' happens to not be an integer itself. Once you've done that for all streams, then multiply all the resulting values from each stream together. In your example, since a1 (a in stream 1) is 1.5, then multiplying that by 2 gives us 3, and since a2 is already an integer, we calculate that X=3*1=3 will be in both streams. Extending your example such that a3=7.25, then multiply that by 4 to give 29 and hence X=3*1*29=87 will be found in all streams.
 
  • Like
Likes rumborak
  • #3
Hmm, that's an interesting idea (and somehow it feels similar to Common Denominator calculation), but sadly my example used simple values for 'a' for illustrative purposes, not because they are actually constrained to it.
So, the 'a's should be considered real numbers, e.g. 1.7853467 etc. Maybe I'm not seeing it, but I don't think your method would work for those, as it seemed to rely on the easy "integerizability" of the a values.
 
  • #4
For more complicated decimals, to "integeralize" it, you just need to convert it into a fraction and multiply by the denominator.

[tex]1.73853467=\frac{173853467}{100000000}[/tex]

and hence

[tex]1.73853467\times 100000000=173853467[/tex]
 
  • #5
rumborak said:
So, the 'a's should be considered real numbers, e.g. 1.7853467 etc.
If any pair of a's has a ratio that is irrational then there can be no non-zero integer multiple of one that can also be an integer multiple of the other.
 
  • Like
Likes rumborak
  • #6
jbriggs444 said:
If any pair of a's has a ratio that is irrational then there can be no non-zero integer multiple of one that can also be an integer multiple of the other.
Yes, but in programming you will always have finitely many digits. Irrationals cannot occur explicitly, so they will always look like those in post #4.
 
  • #7
fresh_42 said:
Yes, but in programming you will always have finitely many digits. Irrationals cannot occur explicitly, so they will always look like those in post #4.
Agreed, but that just pushes the problem back. Any instance of the problem that can be successfully input into the computer using a's presented as finite decimal strings can be solved. But not every solvable instance of the problem can be input into the computer using finite decimal strings.
 
  • Like
Likes fresh_42
  • #8
Now you've soled the op, can I just ask a little BTW?
jbriggs444 said:
If any pair of a's has a ratio that is irrational ...
Is that the same as saying, if any a is irrational?
Or is there some other way of getting an irrational ratio?
 
  • #9
Merlin3189 said:
Is that the same as saying, if any a is irrational?
Or is there some other way of getting an irrational ratio?
##\pi, \frac{\pi}{2} and \frac{3\pi}{7}## are all in rational ratios with one another despite all being irrational.

But yes, if one were to trivially re-scale the problem so that ##a_1 = 1##, "if any pair of a's has a ratio that is irrational" would be equivalent to saying "if any [rescaled] a is irrational".
 
Last edited:
  • #10
Thanks everybody. While (as it so often is) it didn't "solve" my programming problem, it definitely made me understand the problem space much better now.
 

1. What is an integer programming problem?

An integer programming problem is a mathematical optimization problem where the decision variables must take on integer values. This is in contrast to continuous programming problems, where the decision variables can take on any real value.

2. How do you know if a problem is an integer programming problem?

To determine if a problem is an integer programming problem, you should look at the constraints and the objective function. If the constraints involve integer values and the objective function requires integer solutions, then it is likely an integer programming problem.

3. What are some applications of integer programming?

Integer programming has various real-world applications, such as scheduling and resource allocation, production planning, transportation and logistics, and portfolio optimization. It can also be used in computer science for tasks like job scheduling and network routing.

4. Can any optimization problem be formulated as an integer programming problem?

No, not all optimization problems can be formulated as integer programming problems. Some problems may have constraints or objective functions that cannot be expressed using integer variables. In these cases, other methods such as linear programming or nonlinear programming may be more suitable.

5. What are some common techniques used to solve integer programming problems?

There are several techniques that can be used to solve integer programming problems, such as branch and bound, cutting plane methods, and heuristics. Some software packages also offer specific algorithms for solving integer programming problems, such as the simplex method.

Similar threads

Replies
5
Views
2K
Replies
4
Views
210
  • General Math
Replies
3
Views
998
Replies
6
Views
822
  • General Math
Replies
2
Views
989
  • General Math
Replies
1
Views
2K
Replies
2
Views
1K
  • General Math
Replies
1
Views
1K
Replies
1
Views
25K
Back
Top