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

463 questions
124
votes
9 answers

Convert light frequency to RGB?

Does anyone know of any formula for converting a light frequency to an RGB value?
Shaul Behr
  • 33,989
  • 61
  • 233
  • 360
26
votes
4 answers

Round Up a double to int

I have a number ("double") from int/int (such as 10/3). What's the best way to Approximation by Excess and convert it to int on C#?
markzzz
  • 44,504
  • 107
  • 265
  • 458
22
votes
4 answers

Unable to approximate the sine function using a neural network

I am trying to approximate the sine() function using a neural network I wrote myself. I have tested my neural network on a simple OCR problem already and it worked, but I am having trouble applying it to approximate sine(). My problem is that during…
MahlerFive
  • 4,689
  • 4
  • 28
  • 40
21
votes
7 answers

How to compare that sequence of doubles are all "approximately equal" in Java?

I have a method in java that returns a double number and I want to compare every double number that is returned every time I call the method(say 5 times), so that I can conclude that the number returned is almost the same every time. How can I do…
FranXh
  • 3,746
  • 16
  • 53
  • 75
19
votes
7 answers

Approximate, incremental nearest-neighbour algorithm for moving bodies

Bounty This question raises several issues. The bounty will go to an answer which addresses them holistically. Here's a problem I've been playing with. NOTE I'm especially interested in solutions that are not based in Euclidian space. There is a…
spraff
  • 29,265
  • 19
  • 105
  • 197
19
votes
4 answers

Approximation of a solid by a union of spheres

I've got a 3D solid, represented as the union of a set of polyhedral convex hulls. (Or a single convex, if that makes things easier.) I'd like to approximate that solid as the union of a set of spheres, in a way which minimizes both the number of…
17
votes
5 answers

Fastest hypotenuse in javascript?

I've seen a number of questions about simulations and animations in javascript, which often involve calculating the hypotenuse: hypot = Math.sqrt(x*x + y*y); Since cartesian coordinates are the weapon of choice in most of these engines, these…
Phil H
  • 18,593
  • 6
  • 62
  • 99
14
votes
5 answers

Calculate (x exponent 0.19029) with low memory using lookup table?

I'm writing a C program for a PIC micro-controller which needs to do a very specific exponential function. I need to calculate the following: A = k . (1 - (p/p0)^0.19029) k and p0 are constant, so it's all pretty simple apart from finding x^0.19029…
Jeremy
  • 869
  • 1
  • 11
  • 22
13
votes
1 answer

C++ library for integer trigonometry, speed optimized with optional approximations?

I've reached the point in a project where it makes more sense to start building some support classes for vectors and misc trigonometry than keep using ad-hoc functions. I expect there to be many C++ libraries for this, but I don't want to sacrifice…
porgarmingduod
  • 7,070
  • 7
  • 41
  • 76
13
votes
3 answers

Difference among approximatelyEqual and essentiallyEqual in The art of computer programming

I get this code snippet from some where else. According to the webmaster, the code is picked from The art of computer programming by Knuth Since I do not have a copy of that book, may I know what is the difference among the two functions? bool…
Cheok Yan Cheng
  • 49,649
  • 117
  • 410
  • 768
12
votes
3 answers

Unit Testing Approximation Algorithms

I'm working on an open-source approximation algorithms library for graphs and networks using some popular python packages as a base. The main goal is to encompass up-to-date approximation algorithms for NP-Complete problems over graphs and networks.…
Nicholas Mancuso
  • 11,065
  • 6
  • 42
  • 46
12
votes
8 answers

Choosing random numbers efficiently

I have a method, which uses random samples to approximate a calculation. This method is called millions of times, so its very important that the process of choosing the random numbers is efficient. I'm not sure how fast javas Random().nextInt…
Frederik Wordenskjold
  • 9,246
  • 6
  • 35
  • 55
11
votes
8 answers

Fast hyperbolic tangent approximation in Javascript

I'm doing some digital signal processing calculations in javascript, and I found that calculating the hyperbolic tangent (tanh) is a bit too expensive. This is how I currently approximate tanh: function tanh (arg) { // sinh(number)/cosh(number) …
janesconference
  • 6,045
  • 7
  • 52
  • 71
11
votes
3 answers

approximating log10[x^k0 + k1]

Greetings. I'm trying to approximate the function Log10[x^k0 + k1], where .21 < k0 < 21, 0 < k1 < ~2000, and x is integer < 2^14. k0 & k1 are constant. For practical purposes, you can assume k0 = 2.12, k1 = 2660. The desired accuracy is 5*10^-4…
Yale Zhang
  • 1,239
  • 11
  • 26
11
votes
3 answers

Approximating data with a multi segment cubic bezier curve and a distance as well as a curvature contraint

I have some geo data (the image below shows the path of a river as red dots) which I want to approximate using a multi segment cubic bezier curve. Through other questions on stackoverflow here and here I found the algorithm by Philip J. Schneider…
josch
  • 5,737
  • 2
  • 33
  • 38
1
2 3
30 31