Questions tagged [approximation]

Approximation algorithms are algorithms used to find approximate solutions to optimization problems.

Approximation algorithms are algorithms which generate feasible solutions to optimizazion algorithms. Although permitted to generate solution which are not optimal, there is an algorithm-dependent bound for the ratio of the objective of an optimum and the objective of the generated solution; this ratio is termed the approximation ratio.


Useful links


Related tags

523 questions
4
votes
1 answer

Power of 2 approximation in fixed point

Currently, I am using a small lookup table and linear interpolation which is quite fast and also accurate enough (max error is less than 0.001). However I was wondering if there is an approximation which is even faster. Since the integer part of the…
maniacmic
  • 414
  • 8
  • 15
4
votes
1 answer

Constrained Knapsack without weight

I just came across the following problem(it reminds me of the knapsack-problem, but there a some differences): You are given a number n of items which you have to put inside your knapsack with a maximum profit. Each item has a specific profit value…
4
votes
1 answer

Finding a long vertex-disjoint cycle in a graph

I have a directed graph with 562 vertices and 3961 edges (the edges are http://a3nm.net/share/raw_graph_284374.txt if you are curious) and I would like to find a cycle in this graph which does not go twice through the same vertex and is as long as…
a3nm
  • 8,717
  • 6
  • 31
  • 39
4
votes
2 answers

Looking for an estimation method (data analysis)

Since I have no idea about what I am doing right now, my wording may sound funny. But seriously, I need to learn. The problem I'm facing is to come up with a method (model) to estimate how a software program works: namely running time and maximal…
4
votes
3 answers

Approximation Algorithm for non-intersecting paths in a grid

I recently came across this question and thought I could share it here, since I wasn't able to get it. We are given a 5*5 grid numbered from 1-25, and a set of 5 pairs of points,that are start and end points of a path on the grid. Now we need to…
user3907480
  • 440
  • 1
  • 6
  • 10
4
votes
1 answer

Approximation of `atan` function in fixed point

I must do some calculations that need to use trigonometric functions, and especially the atan one. The code will run on an Atmega328p, and for efficiency sake, I can't use floats: I'm using fixed point numbers. Thus, I can't use the standard atan…
Spirine
  • 1,837
  • 1
  • 16
  • 28
4
votes
2 answers

Euler's method in python

I'm trying to implement euler's method to approximate the value of e in python. This is what I have so far: def Euler(f, t0, y0, h, N): t = t0 + arange(N+1)*h y = zeros(N+1) y[0] = y0 for n in range(N): y[n+1] = y[n] +…
4
votes
4 answers

Removing slow int64 division from fixed point atan2() approximation

I made a function to compute a fixed-point approximation of atan2(y, x). The problem is that of the ~83 cycles it takes to run the whole function, 70 cycles (compiling with gcc 4.9.1 mingw-w64 -O3 on an AMD FX-6100) are taken entirely by a simple…
Michel Rouzic
  • 1,013
  • 1
  • 9
  • 22
4
votes
1 answer

How to approximate LUT index?

I have an array ... //a b {860, -30}, {853, -29}, {846, -28}, {838, -27}, {830, -26}, {822, -25}, {814, -24}, ... What is the quickest way using C to find find b with given a value? I guess some approximation is required for…
Pablo
  • 28,133
  • 34
  • 125
  • 215
4
votes
4 answers

String Approximation (Fetching the nearest matched String from Dictionary)

Is there any String Matching code or Algorithm which gives us the approximately matched string from the dictionay(contains pre-defined Set of Strings)? For example: If there are 10 String in the dictionary (Set of Strings), if user input some…
Praveen Hiremath
  • 4,209
  • 2
  • 17
  • 11
4
votes
2 answers

Approximate and Interpolate GPS Trajectory

I have a sequence of gps values each containing: timestamp, latitude, longitude, n_sats, gps_speed, gps_direction, ... (some subset of NMEA data). I'm not sure of what quality the direction and speed values are. Further, I cannot expect the sequence…
moooeeeep
  • 31,622
  • 22
  • 98
  • 187
4
votes
2 answers

Matlab Code To Approximate The Exponential Function

Does anyone know how to make the following Matlab code approximate the exponential function more accurately when dealing with large and negative real numbers? For example when x = 1, the code works well, when x = -100, it returns an answer of…
4
votes
1 answer

Minimizing colors: a variation of the knapsack algorithm?

Working on a project I've met this problem, which I will reword here in terms outside of the real domain of the problem (I suppose I could talk about calibers of fireworks and shapes, but it would complicate even more the understanding). I'm looking…
RedGlow
  • 773
  • 7
  • 13
3
votes
3 answers

Rectangle approximation algorithm

I have an enumeration of just under 32 absolute rectangle sizes and I need to given dimensions and find the best approximation among my enumeration. Is there any better (ie more readable and maintainable) way than the spaghetti code I am formulating…
John
  • 6,433
  • 7
  • 47
  • 82
3
votes
1 answer

How to calculate residuals for two curves (matrixes) of different size?

I've got a theoretical curve which was calculated numerically and an experimental curve (better to say a massive of experimental points). I need to calculate the residuals between these two curves to check the accuracy of modeling with the least…
jacksonslsmg4
  • 211
  • 1
  • 5
  • 10