Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Online algorithm
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Algorithm that begins on possibly incomplete inputs}} {{distinguish|online and offline}} In [[computer science]], an '''online algorithm'''<ref name="karp92" /> is one that can process its input piece-by-piece in a serial fashion, i.e., in the order that the input is fed to the [[algorithm]], without having the entire input available from the start. In contrast, an '''offline algorithm''' is given the whole problem data from the beginning and is required to output an answer which solves the problem at hand. In [[operations research]], the area in which online algorithms are developed is called [[online optimization]]. As an example, consider the [[sorting algorithms]] [[selection sort]] and [[insertion sort]]: selection sort repeatedly selects the minimum element from the unsorted remainder and places it at the front, which requires access to the entire input; it is thus an offline algorithm. On the other hand, insertion sort considers one input element per iteration and produces a partial solution without considering future elements. Thus insertion sort is an online algorithm. Note that the final result of an insertion sort is optimum, i.e., a correctly sorted list. For many problems, online algorithms cannot match the performance of offline algorithms. If the ratio between the performance of an online algorithm and an optimal offline algorithm is bounded, the online algorithm is called [[Competitive analysis (online algorithm)|competitive]].<ref name=karp92>{{cite journal|last1=Karp|first1=Richard M.|title=On-line algorithms versus off-line algorithms: How much is it worth to know the future?|journal=IFIP Congress (1)|date=1992|volume=12|pages=416β429|url=http://www.icsi.berkeley.edu/pubs/techreports/TR-92-044.pdf|access-date=17 August 2015}}</ref> Not every ''offline algorithm'' has an efficient ''online'' counterpart. In grammar theory they are associated with [[Straight-line grammar]]s. == Definition == Because it does not know the whole input, an online algorithm is forced to make decisions that may later turn out not to be optimal, and the study of online algorithms has focused on the quality of decision-making that is possible in this setting. [[Competitive analysis (online algorithm)|Competitive analysis]] formalizes this idea by comparing the relative performance of an online and offline algorithm for the same problem instance. Specifically, the competitive ratio of an algorithm, is defined as the worst-case ratio of its cost divided by the optimal cost, over all possible inputs. The competitive ratio of an online problem is the best competitive ratio achieved by an online algorithm. Intuitively, the competitive ratio of an algorithm gives a measure on the quality of solutions produced by this algorithm, while the competitive ratio of a problem shows the importance of knowing the future for this problem. === Other interpretations === For other points of view on ''online inputs to algorithms'', see * [[streaming algorithm]]: focusing on the amount of memory needed to accurately represent past inputs; * [[dynamic algorithm]]: focusing on the time complexity of maintaining solutions to problems with online inputs. === Examples === Some ''online algorithms'': *[[Insertion sort]] *[[Perceptron]] *[[Reservoir sampling]] <!-- check: --> * [[Greedy algorithm]] * [[Adversary (online algorithm)|Adversary model]] * [[Metrical task systems]] * [[Odds algorithm]] * [[Page replacement algorithm]] * [[Algorithms for calculating variance]] * [[Ukkonen's algorithm]] == Online problems == A problem exemplifying the concepts of online algorithms is the [[Canadian traveller problem]]. The goal of this problem is to minimize the cost of reaching a target in a weighted graph where some of the edges are unreliable and may have been removed from the graph. However, that an edge has been removed (''failed'') is only revealed to ''the traveller'' when she/he reaches one of the edge's endpoints. The worst case for this problem is simply that all of the unreliable edges fail and the problem reduces to the usual [[shortest path problem]]. An alternative analysis of the problem can be made with the help of competitive analysis. For this method of analysis, the offline algorithm knows in advance which edges will fail and the goal is to minimize the ratio between the online and offline algorithms' performance. This problem is [[PSPACE-complete]]. There are many formal problems that offer more than one ''online algorithm'' as solution: * [[K-server problem|''k''-server problem]] * [[Job shop scheduling|Job shop scheduling problem]] * [[List update problem]] * [[Bandit problem]] * [[Secretary problem]] * [[Search games]] * [[Ski rental problem]] * [[Linear search problem]] * Portfolio selection problem<ref name=doc16>{{cite book|last1=Dochow|first1=Robert|title=Online Algorithms for the Portfolio Selection Problem|date=2016|publisher=Springer Gabler|url=https://www.springer.com/de/book/9783658135270}}</ref> == See also == * [[Dynamic algorithm]] * [[Prophet inequality]] * [[Real-time computing]] * [[Streaming algorithm]] * [[Sequential algorithm]] * [[Online machine learning]]/[[Offline learning]] == References == {{Reflist}} *{{cite book | author-link = Allan Borodin | author = Borodin, A. |author2=El-Yaniv, R. | url = https://www.cs.technion.ac.il/~rani/book.html | title = Online Computation and Competitive Analysis | publisher = Cambridge University Press | year = 1998 | isbn = 0-521-56392-5}} ==External links== * [http://www.cs.ucr.edu/~marek/pubs/online.bib Bibliography of papers on online algorithms] {{Authority control}} {{Data structures and algorithms}} [[Category:Online algorithms| ]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Authority control
(
edit
)
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Data structures and algorithms
(
edit
)
Template:Distinguish
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)