Algorithm Selection using Reinforcement Learning

Size: px
Start display at page:

Download "Algorithm Selection using Reinforcement Learning"

Transcription

1 Algorithm Selectio usig Reiforcemet Learig Michail G. Lagoudakis Departmet of Computer Sciece, Duke Uiversity, Durham, NC 2778, USA Michael L. Littma Shao Laboratory, AT&T Labs Research, Florham Park, NJ 7932, USA Departmet of Computer Sciece, Duke Uiversity, Durham, NC 2778, USA Abstract May computatioal problems ca be solved by multiple algorithms, with differet algorithms fastest for differet problem sizes, iput distributios, ad hardware characteristics. We cosider the problem of algorithm selectio: dyamically choose a algorithm to attack a istace of a problem with the goal of miimizig the overall executio time. We formulate the problem as a kid of Markov decisio process (MDP), ad use ideas from reiforcemet learig to solve it. This paper itroduces a kid of MDP that models the algorithm selectio problem by allowig multiple state trasitios. The well kow Q-learig algorithm is adapted for this case i a way that combies both Mote-Carlo ad Temporal Differece methods. Also, this work uses, ad exteds i a way to cotrol problems, the Least-Squares Temporal Differece algorithm (LSTD()) of Boya. The experimetal study focuses o the classic problems of order statistic selectio ad sortig. The ecouragig results reveal the potetial of applyig learig methods to traditioal computatioal problems. 1. Itroductio Whe performig a repetitive task, people ofte fid ways of optimizig their behavior to make it faster, cheaper, safer, or more reliable. Computer systems execute tasks that are far more repetitive ad could beefit cosiderably from optimizatio. Programmers ad source-level compilers work hard to reorgaize computatios to make them more efficiet, but as computer systems become more complex ad mobile programs are expected to ru efficietly o a wide variety of hardware platforms, squeezig maximum performace out of a program requires ru-time iformatio. A challegig research goal is to desig a ru-time system that ca repeatedly execute a program, learig over time to make decisios that speed up the overall executio time. Sice the right decisios may deped o the problem size ad parameters, the machie characteristics ad load, the data distributio, ad other ucertai factors, this ca be quite challegig. As a first attempt, we attack the followig algorithm selectio problem. We require that the programmer provide (a) a set of algorithms that are equivalet i terms of the problem they solve, but ca differ i, for example, how their ruig time scales with problem size, ad (b) a set of istace features, such as problem size, that ca be used to select the most appropriate algorithm from the set for a give problem istace. We show how a reiforcemet learig approach ca be used to select the right algorithm for each istace at ru-time based o the istace features. Recall that a recursive algorithm is oe that solves a problem by doig some preprocessig to reduce the iput problem to oe or more subproblems from the same class, solves the subproblems, the performs some postprocessig to tur the solutios to the subproblems ito a solutio for the origial problem. Because each of the subproblems geerated by a recursive algorithm belogs to the same class as the origial problem, each gives rise to a ew algorithm selectio problem. Thus, whe recursive algorithms are icluded i the algorithm set, the algorithm selectio problem becomes a sequetial decisio problem. Related work (Lobjois & Lemaître, 1998; Fik, 1998) treats algorithms i a black-box maer: each time a sigle algorithm is selected ad applied to the give istace. Our focus is o algorithm selectio while the istace is beig solved. I that sese, each istace is solved by a mixture of algorithms formed dyamically at ru-time. The remaider of this sectio develops a simple example to clarify the defiitio of the algorithm selectio problem. Sectio 2 coects the problem to that of solvig a Markov decisio process ad Sectio 3 explais how a learig al-

2 gorithm ca be applied to improve performace. Sectio 4 discusses approximatio methods for the value fuctio, ad, fially, Sectio 5 provides results for two iitial studies usig the problems of order statistic selectio ad sortig. As a simple cocrete example, let s cosider creatig a system for sortig. We write two algorithms: shellsort ad bubblesort. Shellsort has a bit more overhead, ad thus ca ru a bit more slowly for small problems. However, its asymptotic ruig time for a list of items is O( 3/2 ) i cotrast to bubblesort s O( 2 ), so we d expect shellsort to be preferable for large problems. If we use oly problem size,, to decide which algorithm to ru, the algorithm selectio problem reduces to fidig a optimal cutoff such that we sort lists of fewer tha items with bubblesort ad loger lists with shellsort. Now, cosider addig mergesort to our algorithm set. Mergesort is a O( log ) recursive algorithm. It takes a list of items, separates it ito two lists of size /2 ad /2, sorts them idividually, ad fially combies the two small sorted lists ito a sigle sorted list. Sice mergesort is the most efficiet algorithm i the set for large lists, a large list will be sorted by applyig mergesort repeatedly util the resultig subproblems are sufficietly small. At this poit, either shellsort or bubblesort should be applied. 2. Algorithm Selectio as a MDP The algorithm selectio problem ca be ecoded as a kid of Markov decisio process (Puterma, 1994) (MDP) cosistig of states, actios, costs, trasitios, ad a objective fuctio. The state of the MDP is represeted by the curret istatiatio of the istace features. To fully satisfy the Markov property, some ukow factors, like data distributio ad machie characteristics, should be part of the process state. However, such iformatio is ot oly uavailable, but would also make the state space extremely large ad perhaps overly expesive to maipulate o the fly. We treat such factors as umodeled hidde state ad assume their ifluece is egligible. Actios are the differet algorithms that ca be selected. No-recursive algorithms are termial i that they are ot followed by a state trasitio ad the correspodig process termiates. I cotrast, recursive algorithms cause trasitios to other states, which correspod to the subproblems created by the recursive algorithm. These state trasitios are o-determiistic i geeral, especially whe radomizatio is used as part of the recursive algorithm. The immediate cost for choosig some algorithm (actio) o some problem (state) is precisely the real time take for that executio, excludig ay time take i recursive calls. The total (udiscouted) cost accumulated while fully solvig a problem is exactly the total time take to solve the Top Level Recursio Preprocessig Ruig Time Recursive Calls Subproblem 1 Subproblem 2 Postprocessig Figure 1. For each (sub)problem the shaded part of the ruig time idicates the immediate cost. problem (see Figure 1). The objective is to fid a policy, a mappig from values of istace features to algorithms, such that the expected total executio time is miimized. For a fixed policy, the value of a state s is the expected time to solve a problem described by state s usig the algorithms selected by the policy. Note that the cost fuctio is ukow ad o-determiistic i geeral, sice it may deped o several ucertai ad hidde factors. State trasitios are a bit more complex i the case of recursive algorithms. From the MDP poit of view, the multiple subproblems that are created ad solved by a recursive algorithm result i trasitios to multiple states this violates the stadard MDP defiitio. For example, mergesort divides the iput to be sorted ito two pieces, each correspodig to a differet state, yieldig a 1 to 2 state trasitio. However, as log as a sequetial model of computatio is used, we ca safely treat each of these trasitios to a ew state idepedetly, ad the total cost will be the sum of the idividual total costs for each subproblem. Oe ca thik of it as cloig the MDP ad geeratigoecopy for each trasitio. There is a strog relatio betwee the recurrece equatios used to aalyze the ruig time of recursive algorithms ad the Bellma equatio for the algorithm selectio problem. The stadard recurrece for mergesort is (Corme et al., 199) T () =2T(/2) + Θ(), T(1) = Θ(1), where T () represets the ruig time o a istace of size. The Bellma equatio for the state value fuctio of the Markov chai uderlyig mergesort is V (s )=2V(s /2 )+R(s,a m ), V(s 1 )=, where R(s,a m )is the cost for choosig mergesort i state s that correspods to a istace of size 1 ; the Bellma 1 Size is the most crucial istace feature for most problems. I presetig our method we assume that the state of the MDP

3 equatio captures the uderlyig structure of the recursive algorithm. I the most geeral case, the average ruig time T () of a recursive algorithm that creates k subproblems of sizes 1, 2,..., k, is described by the recurrece k T () =E T ( j )+t(), j=1 where t() is the preprocessig ad postprocessig time. O the other had, the value of a state s uder a fixed determiistic policy would be expressed as follows: k a V (s )=E V (s j )+R(s,a), j=1 where a is the algorithm chose by the policy for state s, s j are the states describig the resultig subproblems, ad R(s,a) is the cost for choosig a i state s. Although T () correspods to V (s ), it is expected that V (s ) < T (), that is, the expected time for the combied algorithm is less tha the time for the recursive algorithm aloe. I geeral, there is o model of the MDP available ad thus, i order to act optimally, either a model must be leared by experiece, or a model-free approach must be used. We choose the secod track ad focus o learig the state actio value fuctio Q(s, a). I this case, the Bellma optimality equatio becomes Q(s,a)=E k a j=1 3. Learig Mechaism mi{q(s j,a )}+R(s,a). a Our learig mechaism is a variatio of the well kow Q-learig algorithm (Watkis & Daya, 1992), adapted to accout for multiple state trasitios. The geeral (udiscouted) update equatio of Q-learig is: Q (t+1) (s t,a t )= (1 α)q (t) (s t,a t )+α [ { R t+1 +mi a Q (t) (s t+1,a) }], where s t is the state at time t, a t is the actio take at time t, R t+1 is the oe-step cost for that decisio, ad α is the learig rate. If a t is a o-recursive algorithm, the resultig state is termial ad has a cost of, so the update rule, reduces to Q (t+1) (s t,a t )=(1 α)q (t) (s t,a t )+αr(s t,a t ). cosists of solely the istace size, but, i geeral, several other features may be used. For recursive algorithms the learig rule is a little more ivolved. For the sake of simplicity, let s cosider a recursive algorithm that geerates oly two subproblems (geeralizatio to more subproblems is easy). I this case, the Q-learig rule is Q (t+1) [ (s t,a t )=(1 α)q { (t) (s t },a t )+ { }] α R(s t,a t )+mi Q (t) (s 1,a) +mi Q (t) (s 2,a), a a where s 1 ad s 2 are the states (at time t +1) correspodig to the two subproblems. Notice that the target value depeds o two estimates, which ca itroduce sigificat bias depedig o the accuracy of the value fuctio. I additio, multiple bootstrappig ca easily cause divergece of the value fuctio to wrog estimates if a fuctio approximator is used (Boya & Moore, 1995). The two resultig states must be visited idividually i tur, as both subproblems must be solved. That meas that it is ecessary to store state iformatio for all the pedig states alog the curret path i the recursio tree. The update rule above makes use of previous estimates i updatig the value of the curret state actio pair i the spirit of Temporal Differece (TD) algorithms (Sutto & Barto, 1998). Alteratively, oe could ufold (solve completely) each of the two subproblems, addig the idividual costs at each step. This is the Mote-Carlo retur, R π (s) = t R(s t,a t ), ad expresses the sum of all idividual costs whe startig with a subproblem correspodig to state s ad followig the policy π util the subproblem has bee fully solved. To get good estimates, the policy π should ot take ay exploratory actios. Typically, π is the greedy policy with respect to the curret value fuctio. Although R π (s) is a ubiased estimate of the target value of Q(s, a), it has high variace as it depeds o several returs ad is ot available before the ed of the episode. Ufoldig both subproblems would result i a pure Mote-Carlo (MC) algorithm with the followig update rule ad the shortcomigs just metioed: Q (t+1) (s t,a t )=(1 α)q (t) (s t,a t )+ α [R(s t,a t )+R π (s 1 )+R π (s 2 )]. Our learig rule combies the TD ad MC rules above, by takig the MC approach o oe subproblem ad the TD approach o the other. I other words, oe subproblem (say, the smallest oe) is ufolded ad its Mote-Carlo retur is added to the curret oe step retur, before bootstrappig ad recursig o the other. This is a viable alterative i this problem because of the oe to may state trasitios. The update rule takes the form: Q (t+1) (s t,a t )=(1 α)q (t) (s t,a t )+ { } α R(s t,a t )+R π (s 1 ) +mi Q (t) (s 2,a), }{{} a R t+1

4 where s 2 is the state correspodig to the subproblem we recurse o. By choosig s 2 to be the largest oe (or the hardest to solve, i geeral), we achieve several thigs: (1) more opportuities for later exploratio, (2) less variace i R t+1, ad (3) small recursio stack (for ufoldig the small subproblem). I additio, our problem becomes a ordiary MDP with sigle state trasitios, with the extra trasitio effectively pushed ito the cost fuctio. Also, ulike the pure TD approach, there is o eed for extra state iformatio storage. Figure 2 clarifies all these issues. This learig rule is used i all our experimets. A issue related to our learig rule cocers the availability of R(s, a) durig learig. If the last step of the recursive algorithm is oe or more recursive calls, the R(s, a) is immediately available before ay attempt to solve the subproblems is made. Thus, the system ca lear about the curret state by immediately applyig the learig rule ad the cotiuig idepedetly with the subproblems discardig the curret state iformatio. This is similar to the use of tail recursio to improve the efficiecy of recursive calls. However, if the algorithm requires some amout of postprocessig work after oe or more subproblems are solved, the retur R(s, a) is delayed util these subproblems have bee captured. Clearly, learig is delayed i this case ad state iformatio storage is ecessary. I our experimets i Sectio 5, we take advatage of the tail recursio as this is allowed by the algorithms we explored. 4. Geeralizatio ad Approximatio I this iitial study, we have used both table-based ad approximatio methods to represet the value fuctio ad cope with the size of the state space. I particular, we make use of state aggregatio ad liear architectures. State aggregatio is primarily used to compress specific istace features, like problem size. The ratioale is that although the ruig time of a algorithm might be sigificatly differet for small feature values, this relative differece fades out as values become large. For example, sortig 2 elemets is relatively more expesive tha sortig 1 elemets, but there is almost o relative differece betwee sortig 52 ad 51 elemets. So, i order to avoid a explosio of the state space, i our experimets we use logarithmic compressio that allows for high resolutio at small feature values ad progressively lower resolutio as values grow. I particular, the value v of a istace feature is mapped to v, accordig to v = log 1.1 (v +1). This formula 2 maps 1, 1, ad 1 to 49, 73, ad 97 respectively. 2 The base 1.1 of the logarithm is a empirically-derived value that simply provides the desired resolutio. The uit icremet is used to overcome states values of. Time Step t Iclude i R t+1 Recursio t+1 t+2 Mote-Carlo (MC) Temporal Differece (TD) No Exploratio (NE) < Temporal Differece (TD) Exploratio (EX) Exploratio (EX) MC NE TD NE TD EX MC NE < < Iclude i R t+2 Figure 2. The learig mechaism. The Mote-Carlo retur from the smaller subproblem is icluded i the cost of its paret, followed by a trasitio to the bigger subproblem. The same patter applies recursively at all levels/time steps. Notice that oce exploratio is preveted at some ode, it is preveted i the whole subtree uder the ode. The bold arrows show the trajectory of the stadard MDP. Liear architectures are used to approximate the value fuctio. Recall that such a approximator approximates Q(s, a) as a liear combiatio φ(s, a) w of k basis fuctios φ(s, a) with coefficiets (or weights) w. The k weights w are estimated i a way that miimizes discrepacy with the observed data i the least-squares sese. The observed data take the form {s t,a t,q (t+1) (s t,a t )} for t =1,2,..., whereq (t+1) (s t,a t ) is the ew (updated) value give by our learig rule i Sectio 3. Ideally, we would like φ(s t,a t ) w = Q (t+1) (s t,a t )to be true for all data. Usig Φ to deote the matrix with rows φ(s t,a t ) ad q to deote the vector with compoets Q (t+1) (s t,a t ), the least-squares solutio for w is give by solvig the k k liear system (Φ Φ)w = Φ q = w =(Φ Φ) 1 Φ q. The matrix Φ ad the vector q ca become extremely big as data accumulate. Fortuately, we eed oly maitai the k k matrix A = Φ Φ ad the k-dimesioal vector b = Φ q, which ca be icremetally updated with ew data as follows: A (t+1) = ( Φ φ(s t+1,a t+1 ) ) ( ) Φ φ(s t+1,a t+1 ) = Φ Φ + φ(s t+1,a t+1 )φ(s t+1,a t+1 ) = A (t) + φ(s t+1,a t+1 )φ(s t+1,a t+1 ), b (t+1) = ( Φ φ(s t+1,a t+1 ) ) ( ) q Q (t+2) (s t+1,a t+1 ) = Φ q + φ(s t+1,a t+1 )Q (t+2) (s t+1,a t+1 ) = b (t) + φ(s t+1,a t+1 )Q (t+2) (s t+1,a t+1 ).

5 The weights ca be updated by w (t) = ( A (t)) 1 b (t) wheever eeded. I this work, we use a separate liear architecture for each algorithm a, each oe havig its ow set of weights, that is w = w(a). This least-squares approach is similar to the oe described by Boya (1999), ad actually exteds the LSTD(λ) algorithm to geeral MDPs for λ =. 5. Results We have applied the ideas above o two fudametal computatioal problems: order statistic selectio ad sortig. These early experimetal results 3 reveal that there is potetial for gettig the most out of well-kow algorithms by combiig them as suggested i the previous sectios. 5.1 Order Statistic Selectio For the order statistic selectio problem, wearegivea array of (uordered) umbers ad some iteger idex i, 1 i. We would like to select the umber that would rak i-th i the array if the umbers were sorted i ascedig order. There are several algorithms for order statistic selectio. We picked two of them such that either is best i all cases, otherwise learig would ot really help 4. DETERMINISTIC SELECT (Corme et al., 199) is a recursive worst case liear time algorithm. It fids a good partitioig elemet by makig a recursive call to fid the media of a subset of the iput. That subset cosists of the medias of every five elemets of the iput, ad therefore its size is a fifth of the origial size. The, the origial iput is partitioed ad a recursive call is made to the appropriate (left or right) subproblem. The size of this subproblem varies, but it is o less tha 3/1 6 ad o more tha 7/1+6,ifistheorigial size. Hece, two subproblems are solved at each recursive call. The recursio cotiues util the desired elemet is restricted i a subset of size less tha or equal to 5 from where it ca be easily isolated. The performace of the algorithm is almost ivariat with respect to the value of the idex (assumig fixed array size). HEAP SELECT is a (o-recursive) algorithm with O( log ) worst case ruig time. The basic step of this algorithm is the costructio of a biary heap betwee the positio i ad the closest ed of the array. Without loss of geerality, assume that i is closer to the left ed, i.e., i /2 (the other case is symmetric). All the elemets betwee positios 1 ad i are orgaized ito a heap, whose 3 All experimets were performed o a Su Ultra 5 machie usig MATLAB code. All ruig time plots represet averages of 1 rus per data poit. Learig was tured off durig performace testig. 4 We excluded RANDOMIZED SELECT because it was cosistetly best i our iitial studies. root is located at positio i ad holds the maximum elemet. The, the algorithm iterates through the remaiig elemets; if a elemet is smaller tha the root elemet of the heap, the two elemets are exchaged ad the ew root is pushed ito the heap to maitai the heap property. At the ed, the desired elemet is located at the root of the heap. To see this, otice that all elemets i the heap are smaller tha or equal to the elemets outside the heap. Obviously, the closer the idex to the left ed, the smaller the heap ad the faster the algorithm, sice T (, i) =Θ(i)+O(( i)logi)for i /2. Figure 3 (i additio to other iformatio) shows the average ruig time of the two algorithms for radomly geerated istaces of fixed size (1) ad varyig idex (1 1). As expected, HEAP SELECT performs much better tha DETERMINISTIC SELECT for idices close to the eds. However, for idices close to the middle (e.g. medias) DETERMINISTIC SELECT outperforms HEAP SE- LECT. A similar picture holds for other array sizes as well. Thus, there is potetial for a better average ruig time if the two algorithms are combied. As a first attempt to lear how to combie the two algorithms, we used a tabular approach. The state of the process, i this case, cosists of two istace features, amely the size of the iput ad the distace d of the idex from the closest ed of the array (d =mi{i, i +1}). We assume that the problem is symmetric with respect to the middle of the array to reduce the rage of d: selectig, say, the 1th elemet is equivalet to selectig the 91st oe out of 1 elemets. Also, the differece betwee selectig the 4th elemet amog 1 elemets ad the 41th elemet i 9995 elemets is so small that discrimiatig betwee these two cases is ot of much help. So, i order to avoid a explosio of the state space, we logarithmically compress the two features as described i Sectio 4. Give that, half a table of size 9 83 is sufficiet to represet the value fuctio. We traied the system o thousads of radomly geerated istaces ( 1, ) offixedsize(1) advaryig idex (1 1). To facilitate traiig, we first traied o several istaces of smaller size. A 1 ɛ policy with high degreeof exploratio (ɛ =.6) was used durig traiig. Two decreasig learig rates were used, oe for DE- TERMINISTIC SELECT (α 1 =.4 iitially) ad oe for HEAP SELECT (α 2 =.7iitially). DETERMINISTIC SE- LECT has varyig cost for a give state because of the o determiistic trasitios, whereas HEAP SELECT is quite ivariat. This differece is reflected i the two learig rates. The results are show i Figure 3. The cut-off poit algorithm selects HEAP SELECT whe the idex is withi the first 13% or the last 7% of the iput, ad DETERMINISTIC SELECT otherwise. The two cut-off

6 6 6 5 Heap Select 5 Heap Select 4 Determiistic Select 4 Determiistic Select Time (sec) 3 Time (sec) Cut off Poit Algorithm Leared Algorithm 1 Cut off Poit Algorithm Leared Algorithm Idex Idex Figure 3. Results for order statistic selectio (tabular case). Figure 4. Order statistic selectio (liear architecture). poits were determied directly from the crossover poits i Figure 3. Thus, it implemets a empirically derived policy, typical of those foud i optimized software implemetatios. The leared algorithm, however, performs better, because the ideal cut-off poits differ by problem size. The exceptio close to idex value 1 is due to the lack of the assumed perfect symmetry. The system is forced to arrive at a compromise usig symmetric cut-off poits. Although the tabular approach reveals a performace gai, it comes with several disadvatages: it uses a huge amout of storage, it imposes upper limits to istace features (e.g. size), ad it takes a log time to trai (several days for the case above). This is mostly due to the lack of good geeralizatio. The key observatio here is that the ruig time of a algorithm typically varies smoothly as some istace feature chages smoothly. That makes geeralizatio much easier compared to other domais. Our secod approach to learig makes use of liear architectures to represet the value fuctio. The state s = (, d) i this case cosists of the problem size ad the siged distace d of the idex i from the midpoit of the array (d = i /2 ). Usig our kowledge about the shape of the value fuctio, ad after may trials, we foud that the value fuctio Q(, d, a) ca be approximated by the followig two parametric fuctios (oe for each actio/algorithm): ( ) 2 ( ) Q(, d, a D )=w d 1D 1 +w 2D d2, ( ) 2 Q(, d, a H )=w 2d 1H 1 +w 2H where a D,a H ( ) 4 d2, are the actios of selectig DETERMIN- ISTIC SELECT ad HEAP SELECT respectively, ad w 1D,w 2D,w 1H,w 2H are the parameters (weights). Briefly, these fuctios represet a liear combiatio of a semiellipse ad a parabola (for costat ). The amout of storage required i this case (see Sectio 4) is a 2 2 matrix (A (t) )adtwo2 1arrays (q (t) ad w (t) ) for each equatio. That gives a total of 16 real umbers which compares favorably with the 3735 umbers of the tabular case. We traied the system o 2,4 radomly geerated istaces of differet sizes distributed uiformly i the rage [2, 1] with a schedule that starts with smaller sizes ad moves toward larger sizes. The idex was also varied uiformly withi the available rage for each size. We set the learig rate α to 1. for both actios to prevet use of wrog estimates ad divergece of the value fuctio. With α =1., oly estimates of smaller sizes are used, sice the resultig subproblems ca oly be smaller. As log as the traiig schedule is from smaller to larger sizes, it is guarateed that these estimates will be fairly accurate, because traiig has bee completed for smaller sizes. This idea is similar to the Grow-Support algorithm of Boya ad Moore (Boya & Moore, 1995). Exploratio was set to maximum (ɛ =1) so that both actios get approximately the same amout ad distributio of data poits. We used the leastsquares approach, described i Sectio 4, to estimate the weights at each step durig traiig. The mai advatage of the liear architecture is that the value fuctio is defied for ay state, eve for states the system has ot bee traied o. Also, the learig time was less tha a hour i this case. Overall, this secod approach overcomes all the difficulties of the tabular approach with oly a small degrade i performace (the best cut-offs caot be estimated precisely due to the restricted form of approximatio). Figure 4 shows performace results for fixed size ( = 1) ad Figure 5 results for

7 3 25 Heap Select Determiistic Select Cut Off Poit Leared Algorithm Usig our kowledge of the asymptotic ruig times, we approximate the value fuctio (that is, the expected ruig time) by the followig parametric fuctios (oe for each algorithm): Time (sec) Size x 1 4 Figure 5. Order statistic selectio (media, liear architecture). fixed idex (d =, the media) ad size up to 1. Note that the system was traied oly o istaces of size up to 1. These iitial results revealed that our approach to the algorithm selectio problem is feasible ad ecouraged experimetatio with other problems. 5.2 Sortig The sortig problem is to rearrage a array of (uordered) umbers i ascedig order. This is probably the best kow computatioal problem ad there exist umerous sortig algorithms. QUICKSORT (Corme et al., 199) is a recursive radomized sortig algorithm with O( 2 ) worst case ruig time ad O( log ) expected ruig time. It picks a partitioig elemet from the array at radom ad partitios the iput i two parts such that all elemets i the first part are less tha or equal to the elemets i the secod part. The, the two parts are sorted recursively. QUICKSORT is extremely efficiet for large arrays. INSERTIONSORT (Corme et al., 199) is a o recursive algorithm with O( 2 ) worst case ruig time. It starts with the first elemet as the iitial sorted list ad iteratively iserts the other elemets oe by oe at their correct positio by shiftig elemets that are greater to the right. IN- SERTIONSORT is very efficiet for small arrays ad for iputs that are almost sorted. A commo approach is to ru QUICKSORT for large sizes ad switch to INSERTIONSORT whe the size falls below some cut-off poit. However, the optimal cut-off poit may deped o several ucertai factors ad it is ulikely fixed. Usig our approach, however, it is possible to figure out the best cut-off poit o the fly. The state of the process cosists of the size of the iput. Q(, a) =w (a) 1 2 +w (a) 2 log 2 + w (a) 3, where a is either a Q or a I. The costat term is omitted, because Q(,a)=by defiitio. The weights for these liear architectures are estimated by the least-squares approach of Sectio 4. We traied the system o 4 radomly geerated istaces oly, 2 with size i [1, 1], ad 2 i [1, 1], startig from smaller ad movig toward larger sizes. We focus o this small rage because the cut-off poit lies somewhere i that rage. The learig rate was set to 1. for reasos metioed i the order statistic selectio case. The leared weights were w (Q) =(.6,.85, 5.969) 1 4 ad w (I) =(.142,.54, 3.539) 1 4. Figure 6 shows the leared value fuctio alog with actual ruig times for the idividual algorithms. As expected, the value fuctio for QUICKSORT is less tha the actual ruig time of pure QUICKSORT, because of the ability to ivoke IN- SERTIONSORT as eeded. Notice that the cut-off poit suggested by the learig algorithm is much lower tha the poit where the ruig time curves cross each other. This leads to a iterestig isight: oce a cut-off poit is employed (say, the poit where the ruig times cross), QUICKSORT becomes better overall, but INSERTIONSORT does ot chage. Thus, QUICKSORT ca ow be faster for istaces right below the chose cut-off poit, where it was ot faster before. That gives a ew cut-off poit ad the same reasoig applies agai ad agai, ad the cut-off poit moves lower ad lower util it evetually coverges. This is captured by the learig algorithm, but is difficult to work it out empirically offlie. Performace results are show i Figure 7 for sizes up to 1. The cut-off poit algorithm is the oe that uses the crossover poit (size=47) of the ruig time curves. The leared algorithm, whose policy sets the cut-off poit to size=35, performs aroud 15% better. The leared policy was precomputed beforehad to elimiate the overhead of evaluatig the value fuctio at each step. 6. Future Work ad Coclusios I this paper, we have igored the distributio of the iput data; all data come from the same uiform radom distributio. Ideally, a learig system should be able to adapt rapidly to chages i the uderlyig distributio. To this ed, it is required that (1) learig is cotiuously o, (2) some exploratio is allowed, ad (3) most recet data overshadow old data. We are curretly experimetig with expoetial widowig i our least-squares approach to ex-

8 Time (sec) Actual Ruig Time of IsertioSort Value Fuctio for IsertioSort Actual Ruig Time of QuickSort Value Fuctio for QuickSort Cut Off Poit from Ruig Times = 47 Cut Off Poit from Value Fuctio = Size Figure 6. Value fuctio, actual ruig time, ad cut-off poits. Time (sec) IsertioSort QuickSort Cut Off Poit Algorithm Leared Algorithm Size Figure 7. Ruig times for sortig. poetially discout old data. Allowig cotiuous exploratio might lead to a cost pealty or to the discovery of a chage. We have o clear solutio to that problem, but i order to avoid uecessary time pealties, we eed more cotrol over the algorithms. For example, we could termiate a selected (termial) algorithm if its curret ruig time exceeds sigificatly the estimate of the value fuctio, ad select aother algorithm. We curretly ivestigate these ideas o sortig. We pla to add more algorithms to the algorithm set ad target for rapid olie adaptatio. We also pla to apply the proposed ideas to other problems, like covex hull ad graph problems, where algorithm selectio may iduce sigificat savigs. The log-term goal ad potetial cotributio of the work preseted i this paper is twofold. First, from a computer sciece poit of view, we evisio a era where a computatioal problem is solved ot by a isolated algorithm selected o the basis of its theoretical properties, but by a adaptive system that ecapsulates the available repertoire of algorithms for that problem ad selects them based mostly o their practical performace. We believe that such systems will be more efficiet i applicatios that ivolve a wide ad diverse rage of problem istaces. Secod, from a machie learig poit of view, the real-time costrait (learig is part of solvig the problem) calls for learig algorithms that geeralize ad adapt rapidly while cosumig miimum computatioal resources (especially time). The challege for real-time learig becomes more ad more importat for the success of learig systems i real-world applicatios. The results preseted here are the first steps alog these directios ad toward these goals. Ackowledgmets The first author would like to thak the Lilia-Boudouri Foudatio i Greece for fiacial support. The secod author is supported i part by NSF-IRI CAREER. Refereces Boya, J. A. (1999). Least-squares temporal differece learig. Machie Learig: Proceedigs of the Sixteeth Iteratioal Coferece (pp ). Morga Kaufma, Sa Fracisco, CA. Boya, J. A., & Moore, A. W. (1995). Geeralizatio i reiforcemet learig: Safely approximatig the value fuctio. Advaces i Neural Iformatio Processig Systems 7 (pp ). Cambridge, MA: The MIT Press. Corme, T. H., Leiserso, C. E., & Rivest, R. L. (199). Itroductio to algorithms. Cambridge, MA: The MIT Press. Fik, E. (1998). How to solve it automatically: Selectio amog problem-solvig methods. Proceedigs of the Fourth Iteratioal Coferece o Artificial Itelligece Plaig Systems (pp ). AAAI Press. Lobjois, L., & Lemaître, M. (1998). Brach ad boud algorithm selectio by performace predictio. Proceedigs of the Fifteeth Natioal Coferece o Artificial Itelligece (pp ). Melo Park: AAAI Press. Puterma, M. L. (1994). Markov decisio processes discrete stochastic dyamic programmig. New York, NY: Joh Wiley & Sos, Ic. Sutto, R. S., & Barto, A. G. (1998). Reiforcemet learig: A itroductio. The MIT Press. Watkis, C. J. C. H., & Daya, P. (1992). Q-learig. Machie Learig, 8,

Lecture 5. Counting Sort / Radix Sort

Lecture 5. Counting Sort / Radix Sort Lecture 5. Coutig Sort / Radix Sort T. H. Corme, C. E. Leiserso ad R. L. Rivest Itroductio to Algorithms, 3rd Editio, MIT Press, 2009 Sugkyukwa Uiversity Hyuseug Choo choo@skku.edu Copyright 2000-2018

More information

Algorithm Selection using Reinforcement Learning

Algorithm Selection using Reinforcement Learning Algorithm Selection using Reinforcement Learning Michail G. Lagoudakis Department of Computer Science, Duke University, Durham, NC 2778, USA Michael L. Littman Shannon Laboratory, AT&T Labs Research, Florham

More information

Lecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming

Lecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming Lecture Notes 6 Itroductio to algorithm aalysis CSS 501 Data Structures ad Object-Orieted Programmig Readig for this lecture: Carrao, Chapter 10 To be covered i this lecture: Itroductio to algorithm aalysis

More information

6.854J / J Advanced Algorithms Fall 2008

6.854J / J Advanced Algorithms Fall 2008 MIT OpeCourseWare http://ocw.mit.edu 6.854J / 18.415J Advaced Algorithms Fall 2008 For iformatio about citig these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 18.415/6.854 Advaced Algorithms

More information

Lower Bounds for Sorting

Lower Bounds for Sorting Liear Sortig Topics Covered: Lower Bouds for Sortig Coutig Sort Radix Sort Bucket Sort Lower Bouds for Sortig Compariso vs. o-compariso sortig Decisio tree model Worst case lower boud Compariso Sortig

More information

Ones Assignment Method for Solving Traveling Salesman Problem

Ones Assignment Method for Solving Traveling Salesman Problem Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:

More information

How do we evaluate algorithms?

How do we evaluate algorithms? F2 Readig referece: chapter 2 + slides Algorithm complexity Big O ad big Ω To calculate ruig time Aalysis of recursive Algorithms Next time: Litterature: slides mostly The first Algorithm desig methods:

More information

Lecture 1: Introduction and Strassen s Algorithm

Lecture 1: Introduction and Strassen s Algorithm 5-750: Graduate Algorithms Jauary 7, 08 Lecture : Itroductio ad Strasse s Algorithm Lecturer: Gary Miller Scribe: Robert Parker Itroductio Machie models I this class, we will primarily use the Radom Access

More information

Pseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance

Pseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Pseudocode ( 1.1) High-level descriptio of a algorithm More structured

More information

CIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8)

CIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8) CIS 11 Data Structures ad Algorithms with Java Fall 017 Big-Oh Notatio Tuesday, September 5 (Make-up Friday, September 8) Learig Goals Review Big-Oh ad lear big/small omega/theta otatios Practice solvig

More information

Running Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments

Running Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The

More information

Data Structures and Algorithms. Analysis of Algorithms

Data Structures and Algorithms. Analysis of Algorithms Data Structures ad Algorithms Aalysis of Algorithms Outlie Ruig time Pseudo-code Big-oh otatio Big-theta otatio Big-omega otatio Asymptotic algorithm aalysis Aalysis of Algorithms Iput Algorithm Output

More information

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.

More information

Analysis of Algorithms

Analysis of Algorithms Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The

More information

Data Structures Week #9. Sorting

Data Structures Week #9. Sorting Data Structures Week #9 Sortig Outlie Motivatio Types of Sortig Elemetary (O( 2 )) Sortig Techiques Other (O(*log())) Sortig Techiques 21.Aralık.2010 Boraha Tümer, Ph.D. 2 Sortig 21.Aralık.2010 Boraha

More information

CSE 417: Algorithms and Computational Complexity

CSE 417: Algorithms and Computational Complexity Time CSE 47: Algorithms ad Computatioal Readig assigmet Read Chapter of The ALGORITHM Desig Maual Aalysis & Sortig Autum 00 Paul Beame aalysis Problem size Worst-case complexity: max # steps algorithm

More information

Analysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis

Analysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis Itro to Algorithm Aalysis Aalysis Metrics Slides. Table of Cotets. Aalysis Metrics 3. Exact Aalysis Rules 4. Simple Summatio 5. Summatio Formulas 6. Order of Magitude 7. Big-O otatio 8. Big-O Theorems

More information

Pattern Recognition Systems Lab 1 Least Mean Squares

Pattern Recognition Systems Lab 1 Least Mean Squares Patter Recogitio Systems Lab 1 Least Mea Squares 1. Objectives This laboratory work itroduces the OpeCV-based framework used throughout the course. I this assigmet a lie is fitted to a set of poits usig

More information

CIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19

CIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19 CIS Data Structures ad Algorithms with Java Sprig 09 Stacks, Queues, ad Heaps Moday, February 8 / Tuesday, February 9 Stacks ad Queues Recall the stack ad queue ADTs (abstract data types from lecture.

More information

. Written in factored form it is easy to see that the roots are 2, 2, i,

. Written in factored form it is easy to see that the roots are 2, 2, i, CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or

More information

CIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13

CIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13 CIS Data Structures ad Algorithms with Java Sprig 08 Stacks ad Queues Moday, February / Tuesday, February Learig Goals Durig this lab, you will: Review stacks ad queues. Lear amortized ruig time aalysis

More information

Homework 1 Solutions MA 522 Fall 2017

Homework 1 Solutions MA 522 Fall 2017 Homework 1 Solutios MA 5 Fall 017 1. Cosider the searchig problem: Iput A sequece of umbers A = [a 1,..., a ] ad a value v. Output A idex i such that v = A[i] or the special value NIL if v does ot appear

More information

Exact Minimum Lower Bound Algorithm for Traveling Salesman Problem

Exact Minimum Lower Bound Algorithm for Traveling Salesman Problem Exact Miimum Lower Boud Algorithm for Travelig Salesma Problem Mohamed Eleiche GeoTiba Systems mohamed.eleiche@gmail.com Abstract The miimum-travel-cost algorithm is a dyamic programmig algorithm to compute

More information

condition w i B i S maximum u i

condition w i B i S maximum u i ecture 10 Dyamic Programmig 10.1 Kapsack Problem November 1, 2004 ecturer: Kamal Jai Notes: Tobias Holgers We are give a set of items U = {a 1, a 2,..., a }. Each item has a weight w i Z + ad a utility

More information

Lecture 6. Lecturer: Ronitt Rubinfeld Scribes: Chen Ziv, Eliav Buchnik, Ophir Arie, Jonathan Gradstein

Lecture 6. Lecturer: Ronitt Rubinfeld Scribes: Chen Ziv, Eliav Buchnik, Ophir Arie, Jonathan Gradstein 068.670 Subliear Time Algorithms November, 0 Lecture 6 Lecturer: Roitt Rubifeld Scribes: Che Ziv, Eliav Buchik, Ophir Arie, Joatha Gradstei Lesso overview. Usig the oracle reductio framework for approximatig

More information

Administrative UNSUPERVISED LEARNING. Unsupervised learning. Supervised learning 11/25/13. Final project. No office hours today

Administrative UNSUPERVISED LEARNING. Unsupervised learning. Supervised learning 11/25/13. Final project. No office hours today Admiistrative Fial project No office hours today UNSUPERVISED LEARNING David Kauchak CS 451 Fall 2013 Supervised learig Usupervised learig label label 1 label 3 model/ predictor label 4 label 5 Supervised

More information

An Improved Shuffled Frog-Leaping Algorithm for Knapsack Problem

An Improved Shuffled Frog-Leaping Algorithm for Knapsack Problem A Improved Shuffled Frog-Leapig Algorithm for Kapsack Problem Zhoufag Li, Ya Zhou, ad Peg Cheg School of Iformatio Sciece ad Egieerig Hea Uiversity of Techology ZhegZhou, Chia lzhf1978@126.com Abstract.

More information

arxiv: v2 [cs.ds] 24 Mar 2018

arxiv: v2 [cs.ds] 24 Mar 2018 Similar Elemets ad Metric Labelig o Complete Graphs arxiv:1803.08037v [cs.ds] 4 Mar 018 Pedro F. Felzeszwalb Brow Uiversity Providece, RI, USA pff@brow.edu March 8, 018 We cosider a problem that ivolves

More information

A New Morphological 3D Shape Decomposition: Grayscale Interframe Interpolation Method

A New Morphological 3D Shape Decomposition: Grayscale Interframe Interpolation Method A ew Morphological 3D Shape Decompositio: Grayscale Iterframe Iterpolatio Method D.. Vizireau Politehica Uiversity Bucharest, Romaia ae@comm.pub.ro R. M. Udrea Politehica Uiversity Bucharest, Romaia mihea@comm.pub.ro

More information

Morgan Kaufmann Publishers 26 February, COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 5

Morgan Kaufmann Publishers 26 February, COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 5 Morga Kaufma Publishers 26 February, 28 COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Chapter 5 Set-Associative Cache Architecture Performace Summary Whe CPU performace icreases:

More information

CS 683: Advanced Design and Analysis of Algorithms

CS 683: Advanced Design and Analysis of Algorithms CS 683: Advaced Desig ad Aalysis of Algorithms Lecture 6, February 1, 2008 Lecturer: Joh Hopcroft Scribes: Shaomei Wu, Etha Feldma February 7, 2008 1 Threshold for k CNF Satisfiability I the previous lecture,

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 19 Query Optimizatio Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio Query optimizatio Coducted by a query optimizer i a DBMS Goal:

More information

Chapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms

Chapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms Chapter 4 Sortig 1 Objectives 1. o study ad aalyze time efficiecy of various sortig algorithms 4. 4.7.. o desig, implemet, ad aalyze bubble sort 4.. 3. o desig, implemet, ad aalyze merge sort 4.3. 4. o

More information

Lecture 18. Optimization in n dimensions

Lecture 18. Optimization in n dimensions Lecture 8 Optimizatio i dimesios Itroductio We ow cosider the problem of miimizig a sigle scalar fuctio of variables, f x, where x=[ x, x,, x ]T. The D case ca be visualized as fidig the lowest poit of

More information

An Efficient Algorithm for Graph Bisection of Triangularizations

An Efficient Algorithm for Graph Bisection of Triangularizations A Efficiet Algorithm for Graph Bisectio of Triagularizatios Gerold Jäger Departmet of Computer Sciece Washigto Uiversity Campus Box 1045 Oe Brookigs Drive St. Louis, Missouri 63130-4899, USA jaegerg@cse.wustl.edu

More information

Outline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis

Outline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis Outlie ad Readig Aalysis of Algorithms Iput Algorithm Output Ruig time ( 3.) Pseudo-code ( 3.2) Coutig primitive operatios ( 3.3-3.) Asymptotic otatio ( 3.6) Asymptotic aalysis ( 3.7) Case study Aalysis

More information

why study sorting? Sorting is a classic subject in computer science. There are three reasons for studying sorting algorithms.

why study sorting? Sorting is a classic subject in computer science. There are three reasons for studying sorting algorithms. Chapter 5 Sortig IST311 - CIS65/506 Clevelad State Uiversity Prof. Victor Matos Adapted from: Itroductio to Java Programmig: Comprehesive Versio, Eighth Editio by Y. Daiel Liag why study sortig? Sortig

More information

Heaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015

Heaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015 Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 201 Heaps 201 Goodrich ad Tamassia xkcd. http://xkcd.com/83/. Tree. Used with permissio uder

More information

An Efficient Algorithm for Graph Bisection of Triangularizations

An Efficient Algorithm for Graph Bisection of Triangularizations Applied Mathematical Scieces, Vol. 1, 2007, o. 25, 1203-1215 A Efficiet Algorithm for Graph Bisectio of Triagularizatios Gerold Jäger Departmet of Computer Sciece Washigto Uiversity Campus Box 1045, Oe

More information

Improving Template Based Spike Detection

Improving Template Based Spike Detection Improvig Template Based Spike Detectio Kirk Smith, Member - IEEE Portlad State Uiversity petra@ee.pdx.edu Abstract Template matchig algorithms like SSE, Covolutio ad Maximum Likelihood are well kow for

More information

Big-O Analysis. Asymptotics

Big-O Analysis. Asymptotics Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses

More information

Chapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig

More information

Sorting in Linear Time. Data Structures and Algorithms Andrei Bulatov

Sorting in Linear Time. Data Structures and Algorithms Andrei Bulatov Sortig i Liear Time Data Structures ad Algorithms Adrei Bulatov Algorithms Sortig i Liear Time 7-2 Compariso Sorts The oly test that all the algorithms we have cosidered so far is compariso The oly iformatio

More information

IMP: Superposer Integrated Morphometrics Package Superposition Tool

IMP: Superposer Integrated Morphometrics Package Superposition Tool IMP: Superposer Itegrated Morphometrics Package Superpositio Tool Programmig by: David Lieber ( 03) Caisius College 200 Mai St. Buffalo, NY 4208 Cocept by: H. David Sheets, Dept. of Physics, Caisius College

More information

Designing a learning system

Designing a learning system CS 75 Machie Learig Lecture Desigig a learig system Milos Hauskrecht milos@cs.pitt.edu 539 Seott Square, x-5 people.cs.pitt.edu/~milos/courses/cs75/ Admiistrivia No homework assigmet this week Please try

More information

A SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON

A SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON A SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON Roberto Lopez ad Eugeio Oñate Iteratioal Ceter for Numerical Methods i Egieerig (CIMNE) Edificio C1, Gra Capitá s/, 08034 Barceloa, Spai ABSTRACT I this work

More information

Graphs. Minimum Spanning Trees. Slides by Rose Hoberman (CMU)

Graphs. Minimum Spanning Trees. Slides by Rose Hoberman (CMU) Graphs Miimum Spaig Trees Slides by Rose Hoberma (CMU) Problem: Layig Telephoe Wire Cetral office 2 Wirig: Naïve Approach Cetral office Expesive! 3 Wirig: Better Approach Cetral office Miimize the total

More information

Analysis of Algorithms

Analysis of Algorithms Presetatio for use with the textbook, Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Aalysis of Algorithms Iput 2015 Goodrich ad Tamassia Algorithm Aalysis of Algorithms

More information

prerequisites: 6.046, 6.041/2, ability to do proofs Randomized algorithms: make random choices during run. Main benefits:

prerequisites: 6.046, 6.041/2, ability to do proofs Randomized algorithms: make random choices during run. Main benefits: Itro Admiistrivia. Sigup sheet. prerequisites: 6.046, 6.041/2, ability to do proofs homework weekly (first ext week) collaboratio idepedet homeworks gradig requiremet term project books. questio: scribig?

More information

Fast Fourier Transform (FFT) Algorithms

Fast Fourier Transform (FFT) Algorithms Fast Fourier Trasform FFT Algorithms Relatio to the z-trasform elsewhere, ozero, z x z X x [ ] 2 ~ elsewhere,, ~ e j x X x x π j e z z X X π 2 ~ The DFS X represets evely spaced samples of the z- trasform

More information

Our second algorithm. Comp 135 Machine Learning Computer Science Tufts University. Decision Trees. Decision Trees. Decision Trees.

Our second algorithm. Comp 135 Machine Learning Computer Science Tufts University. Decision Trees. Decision Trees. Decision Trees. Comp 135 Machie Learig Computer Sciece Tufts Uiversity Fall 2017 Roi Khardo Some of these slides were adapted from previous slides by Carla Brodley Our secod algorithm Let s look at a simple dataset for

More information

Algorithms for Disk Covering Problems with the Most Points

Algorithms for Disk Covering Problems with the Most Points Algorithms for Disk Coverig Problems with the Most Poits Bi Xiao Departmet of Computig Hog Kog Polytechic Uiversity Hug Hom, Kowloo, Hog Kog csbxiao@comp.polyu.edu.hk Qigfeg Zhuge, Yi He, Zili Shao, Edwi

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 18 Strategies for Query Processig Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio DBMS techiques to process a query Scaer idetifies

More information

A Study on the Performance of Cholesky-Factorization using MPI

A Study on the Performance of Cholesky-Factorization using MPI A Study o the Performace of Cholesky-Factorizatio usig MPI Ha S. Kim Scott B. Bade Departmet of Computer Sciece ad Egieerig Uiversity of Califoria Sa Diego {hskim, bade}@cs.ucsd.edu Abstract Cholesky-factorizatio

More information

The isoperimetric problem on the hypercube

The isoperimetric problem on the hypercube The isoperimetric problem o the hypercube Prepared by: Steve Butler November 2, 2005 1 The isoperimetric problem We will cosider the -dimesioal hypercube Q Recall that the hypercube Q is a graph whose

More information

Computers and Scientific Thinking

Computers and Scientific Thinking Computers ad Scietific Thikig David Reed, Creighto Uiversity Chapter 15 JavaScript Strigs 1 Strigs as Objects so far, your iteractive Web pages have maipulated strigs i simple ways use text box to iput

More information

Big-O Analysis. Asymptotics

Big-O Analysis. Asymptotics Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses

More information

Intro to Scientific Computing: Solutions

Intro to Scientific Computing: Solutions Itro to Scietific Computig: Solutios Dr. David M. Goulet. How may steps does it take to separate 3 objects ito groups of 4? We start with 5 objects ad apply 3 steps of the algorithm to reduce the pile

More information

Load balanced Parallel Prime Number Generator with Sieve of Eratosthenes on Cluster Computers *

Load balanced Parallel Prime Number Generator with Sieve of Eratosthenes on Cluster Computers * Load balaced Parallel Prime umber Geerator with Sieve of Eratosthees o luster omputers * Soowook Hwag*, Kyusik hug**, ad Dogseug Kim* *Departmet of Electrical Egieerig Korea Uiversity Seoul, -, Rep. of

More information

What are we going to learn? CSC Data Structures Analysis of Algorithms. Overview. Algorithm, and Inputs

What are we going to learn? CSC Data Structures Analysis of Algorithms. Overview. Algorithm, and Inputs What are we goig to lear? CSC316-003 Data Structures Aalysis of Algorithms Computer Sciece North Carolia State Uiversity Need to say that some algorithms are better tha others Criteria for evaluatio Structure

More information

ANN WHICH COVERS MLP AND RBF

ANN WHICH COVERS MLP AND RBF ANN WHICH COVERS MLP AND RBF Josef Boští, Jaromír Kual Faculty of Nuclear Scieces ad Physical Egieerig, CTU i Prague Departmet of Software Egieerig Abstract Two basic types of artificial eural etwors Multi

More information

Hash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.

Hash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015. Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Hash Tables xkcd. http://xkcd.com/221/. Radom Number. Used with permissio uder Creative

More information

Dynamic Programming and Curve Fitting Based Road Boundary Detection

Dynamic Programming and Curve Fitting Based Road Boundary Detection Dyamic Programmig ad Curve Fittig Based Road Boudary Detectio SHYAM PRASAD ADHIKARI, HYONGSUK KIM, Divisio of Electroics ad Iformatio Egieerig Chobuk Natioal Uiversity 664-4 Ga Deokji-Dog Jeoju-City Jeobuk

More information

CSE 2320 Notes 8: Sorting. (Last updated 10/3/18 7:16 PM) Idea: Take an unsorted (sub)array and partition into two subarrays such that.

CSE 2320 Notes 8: Sorting. (Last updated 10/3/18 7:16 PM) Idea: Take an unsorted (sub)array and partition into two subarrays such that. CSE Notes 8: Sortig (Last updated //8 7:6 PM) CLRS 7.-7., 9., 8.-8. 8.A. QUICKSORT Cocepts Idea: Take a usorted (sub)array ad partitio ito two subarrays such that p q r x y z x y y z Pivot Customarily,

More information

CS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1

CS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1 CS200: Hash Tables Prichard Ch. 13.2 CS200 - Hash Tables 1 Table Implemetatios: average cases Search Add Remove Sorted array-based Usorted array-based Balaced Search Trees O(log ) O() O() O() O(1) O()

More information

3D Model Retrieval Method Based on Sample Prediction

3D Model Retrieval Method Based on Sample Prediction 20 Iteratioal Coferece o Computer Commuicatio ad Maagemet Proc.of CSIT vol.5 (20) (20) IACSIT Press, Sigapore 3D Model Retrieval Method Based o Sample Predictio Qigche Zhag, Ya Tag* School of Computer

More information

CSC 220: Computer Organization Unit 11 Basic Computer Organization and Design

CSC 220: Computer Organization Unit 11 Basic Computer Organization and Design College of Computer ad Iformatio Scieces Departmet of Computer Sciece CSC 220: Computer Orgaizatio Uit 11 Basic Computer Orgaizatio ad Desig 1 For the rest of the semester, we ll focus o computer architecture:

More information

Normal Distributions

Normal Distributions Normal Distributios Stacey Hacock Look at these three differet data sets Each histogram is overlaid with a curve : A B C A) Weights (g) of ewly bor lab rat pups B) Mea aual temperatures ( F ) i A Arbor,

More information

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions:

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions: CS 604 Data Structures Midterm Sprig, 00 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Istructios: Prit your ame i the space provided below. This examiatio is closed book ad closed

More information

Learning to Shoot a Goal Lecture 8: Learning Models and Skills

Learning to Shoot a Goal Lecture 8: Learning Models and Skills Learig to Shoot a Goal Lecture 8: Learig Models ad Skills How do we acquire skill at shootig goals? CS 344R/393R: Robotics Bejami Kuipers Learig to Shoot a Goal The robot eeds to shoot the ball i the goal.

More information

Introduction. Nature-Inspired Computing. Terminology. Problem Types. Constraint Satisfaction Problems - CSP. Free Optimization Problem - FOP

Introduction. Nature-Inspired Computing. Terminology. Problem Types. Constraint Satisfaction Problems - CSP. Free Optimization Problem - FOP Nature-Ispired Computig Hadlig Costraits Dr. Şima Uyar September 2006 Itroductio may practical problems are costraied ot all combiatios of variable values represet valid solutios feasible solutios ifeasible

More information

Alpha Individual Solutions MAΘ National Convention 2013

Alpha Individual Solutions MAΘ National Convention 2013 Alpha Idividual Solutios MAΘ Natioal Covetio 0 Aswers:. D. A. C 4. D 5. C 6. B 7. A 8. C 9. D 0. B. B. A. D 4. C 5. A 6. C 7. B 8. A 9. A 0. C. E. B. D 4. C 5. A 6. D 7. B 8. C 9. D 0. B TB. 570 TB. 5

More information

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1 COSC 1P03 Ch 7 Recursio Itroductio to Data Structures 8.1 COSC 1P03 Recursio Recursio I Mathematics factorial Fiboacci umbers defie ifiite set with fiite defiitio I Computer Sciece sytax rules fiite defiitio,

More information

The Closest Line to a Data Set in the Plane. David Gurney Southeastern Louisiana University Hammond, Louisiana

The Closest Line to a Data Set in the Plane. David Gurney Southeastern Louisiana University Hammond, Louisiana The Closest Lie to a Data Set i the Plae David Gurey Southeaster Louisiaa Uiversity Hammod, Louisiaa ABSTRACT This paper looks at three differet measures of distace betwee a lie ad a data set i the plae:

More information

A Generalized Set Theoretic Approach for Time and Space Complexity Analysis of Algorithms and Functions

A Generalized Set Theoretic Approach for Time and Space Complexity Analysis of Algorithms and Functions Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, 2006 316 A Geeralized Set Theoretic Approach for Time ad Space Complexity Aalysis of Algorithms

More information

A Parallel DFA Minimization Algorithm

A Parallel DFA Minimization Algorithm A Parallel DFA Miimizatio Algorithm Ambuj Tewari, Utkarsh Srivastava, ad P. Gupta Departmet of Computer Sciece & Egieerig Idia Istitute of Techology Kapur Kapur 208 016,INDIA pg@iitk.ac.i Abstract. I this

More information

ECE4050 Data Structures and Algorithms. Lecture 6: Searching

ECE4050 Data Structures and Algorithms. Lecture 6: Searching ECE4050 Data Structures ad Algorithms Lecture 6: Searchig 1 Search Give: Distict keys k 1, k 2,, k ad collectio L of records of the form (k 1, I 1 ), (k 2, I 2 ),, (k, I ) where I j is the iformatio associated

More information

Speeding-up dynamic programming in sequence alignment

Speeding-up dynamic programming in sequence alignment Departmet of Computer Sciece Aarhus Uiversity Demark Speedig-up dyamic programmig i sequece aligmet Master s Thesis Dug My Hoa - 443 December, Supervisor: Christia Nørgaard Storm Pederse Implemetatio code

More information

n n B. How many subsets of C are there of cardinality n. We are selecting elements for such a

n n B. How many subsets of C are there of cardinality n. We are selecting elements for such a 4. [10] Usig a combiatorial argumet, prove that for 1: = 0 = Let A ad B be disjoit sets of cardiality each ad C = A B. How may subsets of C are there of cardiality. We are selectig elemets for such a subset

More information

1 Graph Sparsfication

1 Graph Sparsfication CME 305: Discrete Mathematics ad Algorithms 1 Graph Sparsficatio I this sectio we discuss the approximatio of a graph G(V, E) by a sparse graph H(V, F ) o the same vertex set. I particular, we cosider

More information

Fundamentals of Media Processing. Shin'ichi Satoh Kazuya Kodama Hiroshi Mo Duy-Dinh Le

Fundamentals of Media Processing. Shin'ichi Satoh Kazuya Kodama Hiroshi Mo Duy-Dinh Le Fudametals of Media Processig Shi'ichi Satoh Kazuya Kodama Hiroshi Mo Duy-Dih Le Today's topics Noparametric Methods Parze Widow k-nearest Neighbor Estimatio Clusterig Techiques k-meas Agglomerative Hierarchical

More information

Arithmetic Sequences

Arithmetic Sequences . Arithmetic Sequeces COMMON CORE Learig Stadards HSF-IF.A. HSF-BF.A.1a HSF-BF.A. HSF-LE.A. Essetial Questio How ca you use a arithmetic sequece to describe a patter? A arithmetic sequece is a ordered

More information

9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence

9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence _9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to

More information

Basic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000.

Basic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000. 5-23 The course that gives CM its Zip Memory Maagemet II: Dyamic Storage Allocatio Mar 6, 2000 Topics Segregated lists Buddy system Garbage collectio Mark ad Sweep Copyig eferece coutig Basic allocator

More information

( n+1 2 ) , position=(7+1)/2 =4,(median is observation #4) Median=10lb

( n+1 2 ) , position=(7+1)/2 =4,(median is observation #4) Median=10lb Chapter 3 Descriptive Measures Measures of Ceter (Cetral Tedecy) These measures will tell us where is the ceter of our data or where most typical value of a data set lies Mode the value that occurs most

More information

Improvement of the Orthogonal Code Convolution Capabilities Using FPGA Implementation

Improvement of the Orthogonal Code Convolution Capabilities Using FPGA Implementation Improvemet of the Orthogoal Code Covolutio Capabilities Usig FPGA Implemetatio Naima Kaabouch, Member, IEEE, Apara Dhirde, Member, IEEE, Saleh Faruque, Member, IEEE Departmet of Electrical Egieerig, Uiversity

More information

Lecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions

Lecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions U.C. Berkeley CS170 : Algorithms Midterm 1 Solutios Lecturers: Sajam Garg ad Prasad Raghavedra Feb 1, 017 Midterm 1 Solutios 1. (4 poits) For the directed graph below, fid all the strogly coected compoets

More information

The Magma Database file formats

The Magma Database file formats The Magma Database file formats Adrew Gaylard, Bret Pikey, ad Mart-Mari Breedt Johaesburg, South Africa 15th May 2006 1 Summary Magma is a ope-source object database created by Chris Muller, of Kasas City,

More information

Data diverse software fault tolerance techniques

Data diverse software fault tolerance techniques Data diverse software fault tolerace techiques Complemets desig diversity by compesatig for desig diversity s s limitatios Ivolves obtaiig a related set of poits i the program data space, executig the

More information

Python Programming: An Introduction to Computer Science

Python Programming: An Introduction to Computer Science Pytho Programmig: A Itroductio to Computer Sciece Chapter 6 Defiig Fuctios Pytho Programmig, 2/e 1 Objectives To uderstad why programmers divide programs up ito sets of cooperatig fuctios. To be able to

More information

One advantage that SONAR has over any other music-sequencing product I ve worked

One advantage that SONAR has over any other music-sequencing product I ve worked *gajedra* D:/Thomso_Learig_Projects/Garrigus_163132/z_productio/z_3B2_3D_files/Garrigus_163132_ch17.3d, 14/11/08/16:26:39, 16:26, page: 647 17 CAL 101 Oe advatage that SONAR has over ay other music-sequecig

More information

Appendix D. Controller Implementation

Appendix D. Controller Implementation COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Appedix D Cotroller Implemetatio Cotroller Implemetatios Combiatioal logic (sigle-cycle); Fiite state machie (multi-cycle, pipelied);

More information

A graphical view of big-o notation. c*g(n) f(n) f(n) = O(g(n))

A graphical view of big-o notation. c*g(n) f(n) f(n) = O(g(n)) ca see that time required to search/sort grows with size of We How do space/time eeds of program grow with iput size? iput. time: cout umber of operatios as fuctio of iput Executio size operatio Assigmet:

More information

Numerical Methods Lecture 6 - Curve Fitting Techniques

Numerical Methods Lecture 6 - Curve Fitting Techniques Numerical Methods Lecture 6 - Curve Fittig Techiques Topics motivatio iterpolatio liear regressio higher order polyomial form expoetial form Curve fittig - motivatio For root fidig, we used a give fuctio

More information

MATHEMATICAL METHODS OF ANALYSIS AND EXPERIMENTAL DATA PROCESSING (Or Methods of Curve Fitting)

MATHEMATICAL METHODS OF ANALYSIS AND EXPERIMENTAL DATA PROCESSING (Or Methods of Curve Fitting) MATHEMATICAL METHODS OF ANALYSIS AND EXPERIMENTAL DATA PROCESSING (Or Methods of Curve Fittig) I this chapter, we will eamie some methods of aalysis ad data processig; data obtaied as a result of a give

More information

A Note on Least-norm Solution of Global WireWarping

A Note on Least-norm Solution of Global WireWarping A Note o Least-orm Solutio of Global WireWarpig Charlie C. L. Wag Departmet of Mechaical ad Automatio Egieerig The Chiese Uiversity of Hog Kog Shati, N.T., Hog Kog E-mail: cwag@mae.cuhk.edu.hk Abstract

More information

Chapter 3 Classification of FFT Processor Algorithms

Chapter 3 Classification of FFT Processor Algorithms Chapter Classificatio of FFT Processor Algorithms The computatioal complexity of the Discrete Fourier trasform (DFT) is very high. It requires () 2 complex multiplicatios ad () complex additios [5]. As

More information

Designing a learning system

Designing a learning system CS 75 Itro to Machie Learig Lecture Desigig a learig system Milos Hauskrecht milos@pitt.edu 539 Seott Square, -5 people.cs.pitt.edu/~milos/courses/cs75/ Admiistrivia No homework assigmet this week Please

More information

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3

More information

Accuracy Improvement in Camera Calibration

Accuracy Improvement in Camera Calibration Accuracy Improvemet i Camera Calibratio FaJie L Qi Zag ad Reihard Klette CITR, Computer Sciece Departmet The Uiversity of Aucklad Tamaki Campus, Aucklad, New Zealad fli006, qza001@ec.aucklad.ac.z r.klette@aucklad.ac.z

More information