Using a Map public void example(Map map) { map.put(“A”, 1); map.put(“B”, 2); map.put(“C”, 3); Integer x = map.get(“C”); Integer y = map.get(“A”); Integer z = map.get(new Integer(3)); int size = map.size(); } // How to print the values in the map? // How to print the keys in the map?
View full slide show




public class HashSet extends AbstractSet implements Set { private static final Object PRESENT = new Object(); private HashMap map; public HashSet() { map = new HashMap<>(); } public HashSet(Collection c) { map = new HashMap<>(Math.max((int) (c.size()/.75f) + 1, 16)); addAll(c); } public int size() { return map.size(); } public boolean isEmpty() { return map.isEmpty(); public boolean contains(Object o) { } return map.containsKey(o); } public boolean add(E e) { return map.put(e, PRESENT)==null; } public boolean remove(Object o) { return map.remove(o)==PRESENT; public void clear() { } map.clear(); public Iterator iterator() { } } return map.keySet().iterator(); }
View full slide show




So…Where Have You Been? In this assignment, I would like you to help me compile a composite profile of Thinking Geographically students’ geographic experience. Attached are three blank maps: one of Virginia’s localities; one of the United States; and one of the world (with enlarged insets for Europe and the Middle East). On each, shade in all of the localities, states, and countries you have traveled through or visited. You must have been on the ground in each locality, state, or country; airport layovers or airport hotel stays and travel through by train do not count!. Use whatever kind of marker you like (I prefer the medium highlighters with sharp and wide surfaces, but marking pens that won’t bleed through, colored pencils, and even crayons will do), as long as it’s easily seen on the maps. Virginia map – (1) color-in the localities you have been in and/or through. You may need to consult a Virginia highway map to figure out which Commonwealth localities you’ve experienced. For example, if you’ve been from Fairfax County to Longwood via US 15, from north to south, you’ve been through Fairfax, Prince William, Fauquier, Culpeper, Madison, Orange, Louisa, Fluvanna, Buckingham, and Prince Edward Counties. From the City of Richmond to Virginia Beach via I-64, I-664, and I-264/Virginia Beach Expressway, you would have been in Richmond City, Henrico, New Kent, James City, and York Counties, and Newport News, Hampton, Norfolk, and Virginia Beach Cities. All of the places you’ve been in Virginia should be contiguous (strung together) unless you flew/parachuted in, came in by boat, or snuck in through a neighboring state. If you’ve been to all but a handful of localities, you may mark those you have not been to, as long as you make a note of that on the map. (2) count up and record the number of localities you have been to/through, divide that number by 133, multiply by 100, and record the percentage of localities you’ve been to in the space provided (all told, you’ve probably been to more of Virginia than you realize – that’s part of the point of this!); (3) write in what you consider your home locality (probably where you graduated high school) in the space provided and indicate it with a darker color or black on the map (if you’re from out-of-state, just leave it blank); (4) check the appropriate box for urban/suburban/small town/rural (be aware that just because your locality has the work “city” in its title doesn’t necessarily mean it’s urban – which means built-up); and (5) use a line pattern to indicate the locality you most want to begin your teaching career in. US map – (1) color the states you’ve been to/through (remember: airports and train travel don’t count), darken/blacken in your home state; (2) write in your birthplace state (for most of you, that probably will be Virginia) in the space provided and blacken/darken it in on the map; (3) tally and record the number of states you’ve been to/through (including the District of Columbia and your home state), divide by 51, multiply by 100, and that’s the percentage of states you’ve been to and enter that number in the space provided; (4) with a horizontal line pattern for your father and a vertical line pattern for your mother, mark your parents’ birth states on the map (if it’s the same state, you’ll have a crisscrossed pattern) World map – (1) color the countries you’ve been to other than the U.S. (even if you’ve only been to a coastal resort, you’ve been to that country, but again, airport layovers don’t count); (2) tally and record the number of countries other than the U.S. that you’ve been to, divide by 205, multiply by 100, and that’s the percentage of countries other than the US that you’ve visited. Enter that number in the space provided. I’ve provided inset maps for Europe and the Middle East that show more detail if you’ve been to a small country that’s difficult to see. If you’ve been to an island country too small to be seen, list those on the map. You do not need to mark the U.S. on this map. I will tally up the total results and produce maps showing the percentage of students across all three sections who have been to/through particular Virginia localities, U.S. states, and other countries. This will give us an idea of how well-traveled you all are. Value: up to 15 points (12 necessary items, one point each + 3 possible neatness points) Due date: Wednesday, February 10, 2016 DO NOT INCLUDE THIS COVER SHEET WHEN YOU HAND THE MAPS IN! 1
View full slide show




Map-Reduce Execution Engine (Example: Color Count) Input blocks on HDFS Produces (k, v) ( , 1) Map Shuffle & Sorting based on k Parse-hash Consumes(k, [v]) ( , [1,1,1,1,1,1..]) Produces(k’, v’) ( , 100) Reduce Map Parse-hash Reduce Map Parse-hash Reduce Map Parse-hash Task Tracker is the slave node (runs on each datanode) Receives the task from Job Tracker Runs the task until completion (either map or reduce task) Always in communication with the Job Tracker reporting progress Users only provide the “Map” and “Reduce” functions Node 1 Node 2Node 3 Properties of MapReduce Engine Job Tracker is the master node (runs with the namenode) Receives the user’s job Decides on how many tasks will run (number of mappers) Decides on where to run each mapper (concept of locality) This file has 5 Blocks  run 5 map tasks In the top example, 1 map-reduce job consists of 4 map tasks and 3 reduce tasks
View full slide show




Example 2: Color Count Input blocks on HDFS Job: Count the number of each color in a data set Produces (k, v) ( , 1) Map Shuffle & Sorting based on k Parse-hash Consumes(k, [v]) ( , [1,1,1,1,1,1..]) Reduce Map Map Map Produces(k’, v’) 100) Parse-hash ( , Part0001 Reduce Part0002 Reduce Part0003 Parse-hash Parse-hash That’s output file, it has 3 parts on probably 3 different machines Example 3: Color Filter Job: Select only the blue and the green colors Map Map Map Map Write to HDFS Write to HDFS Write to HDFS Write to HDFS Part0001 Each map task will select only the blue or green colors No need for reduce phase Part0002 Part0003 Part0004 That’s the output file, it has 4 parts on probably 4 different machines
View full slide show




EARLY CHALLENGES Map Book Generation & Map Design • DS Map Book • Designed with centroid of polygon selection • Does not work with tax maps as they were designed • Map Grid • Created from original Map Index • Scale 1” = 100’ (1200) and 1”=400’ (4800) • Map Grid design and placement based on polygon location • Rotation value used with generation • Rotation allows map to accommodate polygons more efficiently in urban areas • Labels • Clip process changes with rotation from Arc 8 to Arc 9 5/13/2013 Map Books 3
View full slide show




§189-5 Tax Map Sales - Review Product WV 189CSR5 (Base fee) Code Total §11-1C-7 (Surcharge CFI)2 Printed Copies or Print-Ready Images of Finished Tax Maps Full Map Sheet $5.00 $3.00 $8.00 1 18” x 24” or larger Small Map Sheets $3.00 $2.00 $5.00 11” x 17” or smaller Reproductions Reproductions $1.50 $1.50 $3.00 8.5” x 11” or 8.5” x 14” Digital Parcel Polygons (GIS files: Shapefiles, DWG files, etc.) Digital Parcel GIS File $5.00 $3.00 $8.00 without IAS Data per map sheet Digital Parcel GIS File with IAS Data 1 $6.00 per map sheet $3.00 $8.00 x total number of maps in County An additional processing fee may be applied for customized map services. The percentages of tax map sales revenue submitted to the Courthouse Facilities Improvement Fund range from 37.5% (full map sheet) to 50% (reproductions). 2 WV Tax Maps 29
View full slide show




Challenges in Map Representation 3 Fundamentals of Map Representation 1. Map precision must match precision of robot’s precision to achieve goals 2. Map precision and object representation must match sensor data precision 3. Map complexity has a direct impact on computational complexity Major Issues with Map Representation • Memory constraints on large and precise map representations • How do you define objects and nodes in a map? (Indoor vs. Outdoor) • What is the object? (Sensor shortcomings, vision research state of the art, etc.) • Real world is dynamic (humans, nature, transient objects, etc.) • Sensor fusion problem yet to be solved References: Siegwart, Roland. Autonomous Mobile Robots. Cambridge, Massachusetts. The MIT Press, 2011, 284-296.
View full slide show




Map Iterator Example public static void main(String[] args) { Map map = new HashMap( ); map.put( "One", 1); map.put("Two", 2); map.put( "Three",3); // get the set of keys and an iterator Set keys = map.keySet( ); Iterator iter = keys.iterator( ); // sequence through the keys and get the values while (iter.hasNext()){ String key = iter.next(); System.out.println(key + ", " + map.get(key)); } } // --- Output -Three, 3 One, 1 Two, 2
View full slide show




Chapter 6 - Datapath and Control 6-36 VHDL Specification (cont’) -- Body -- Uses components declared in package LOGIC_GATES -- in the WORK library -- import all the components in WORK.LOGIC_GATES use WORK.LOGIC_GATES.all architecture LOGIC_SPEC of MAJORITY is -- declare signals used internally in MAJORITY signal A_BAR, B_BAR, C_BAR, I1, I2, I3, I4: BIT; begin -- connect the logic gates NOT_1 : NOT1 port map (A_IN, A_BAR); NOT_2 : NOT1 port map (B_IN, B_BAR); NOT_3 : NOT1 port map (C_IN, C_BAR); AND_1 : AND3 port map (A_BAR, B_IN, C_IN, I1); AND_2 : AND3 port map (A_IN, B_BAR, C_IN, I2); AND_3 : AND3 port map (A_IN, B_IN, C_BAR, I3); AND_4 : AND3 port map (A_IN, B_IN, C_IN, I4); OR_1 : OR3 port map (I1, I2, I3, I4, F_OUT); end LOGIC_SPEC; Department of Information Technology, Radford University ITEC 352 Computer Organization
View full slide show




Chapter 8 - Input and Output 8-37 VHDL Specification (cont’) -- Body -- Uses components declared in package LOGIC_GATES -- in the WORK library -- import all the components in WORK.LOGIC_GATES use WORK.LOGIC_GATES.all architecture LOGIC_SPEC of MAJORITY is -- declare signals used internally in MAJORITY signal A_BAR, B_BAR, C_BAR, I1, I2, I3, I4: BIT; begin -- connect the logic gates NOT_1 : NOT1 port map (A_IN, A_BAR); NOT_2 : NOT1 port map (B_IN, B_BAR); NOT_3 : NOT1 port map (C_IN, C_BAR); AND_1 : AND3 port map (A_BAR, B_IN, C_IN, I1); AND_2 : AND3 port map (A_IN, B_BAR, C_IN, I2); AND_3 : AND3 port map (A_IN, B_IN, C_BAR, I3); AND_4 : AND3 port map (A_IN, B_IN, C_IN, I4); OR_1 : OR3 port map (I1, I2, I3, I4, F_OUT); end LOGIC_SPEC; Department of Information Technology, Radford University ITEC 352 Computer Organization
View full slide show




A graph is a set of vertices, V, and a set of edges, E, each connecting a pair of those vertices. An edge from vertex h to vertex k is realized as the unordered set, {h,k} (or just hk), and can be viewed as an undirected line from h to k. We can either list the edges in a two column table (the Edge Table) or we can use a 3 column table in which the first 2 columns list all possible vertex pairs (in raster order) and the third column is a bit map indicating with a 1-bit the pairs that are edges and with a 0-bit the pairs that are not edges. This second option is called the edge map or edge mask and is shown below for a small graph, G1. The edge map obviously has |V| 2 rows. If the raster ordering is always assumed, the edge map is just a single column of bits. The edge map can be compressed into a pTree (predicate Tree) by dividing the bits up into “strides” of |V| bits each (4 for G1). This forms the lowest level of the pTree (level_0) and an upper level (level_1), indicates the truth of the predicate, “Not Purely Zeros” for the respective level_0 pTrees, and can be used to avoid retrieving level_0 pTrees that are purely zeros. We use the notation Ek for the kth level_0 pTree (which bitmaps the endpoints of the edges adjacent to vertex k.) and call it the Edge pTree of k A Path is a sequence of edges connecting a sequence of vertices, distinct, except for endpts. A Simple Path (assumed throughout) disallows simple loops, (v,v) Next we build a ShortestPathtree, SPG1 for G1 M M M It starts with Level_0 of the EdgeTree.  vertex, k, this gives us a mask, Sk, of M 1 0 0 Vertex Masks Edge Map Edges V1 V2 1 2 3 4 1,1 1,2 1,3 1,4_ 2,1 2,2 2,3 2,4_ 3,1 3,2 3,3 3,4_ 4,1 4,2 4,3 4,4 2-Level Stride=4, Edge pTree E 0 0 1 1_ 0 0 0 1_ 1 0 0 1_ 1 1 1 0 1 the end pts of edges adjacent to vertex k (shortest path of Length 1 starting at k). Level1 1 1 1 1 E1 0 0 1 1 E2 0 0 0 1 E3 1 0 0 1 E4 1 1 1 0 S2 0 0 0 1 S3 1 0 0 1 S4 1 1 1 0 2 1 2 3 N11 0 1 0 0 N12 1 0 1 0 N13 0 1 0 0 N14 0 0 0 0 1 2 1 0 We can avoid these calculations by noting Ct(N14 )=0. 0 S14 =N11&E4 0 1 0 0 S24 =N12&E4 1 0 1 0 1 2 S31 =N13&E1 0 0 0 0 0 S34 =N13&E4 0 1 0 0 1 S142 =N21&E2 0 0 0 0 S241 =N22&E1 0 0 0 0 S243 =N22&E3 0 0 0 0 S312 =N23&E1 0 0 0 0 S342 =N23&E2 0 0 0 0 0 0 0 0 0 Btwn =1 Btwn =2 Btwn =1 2 1 0 0 4 3 0 0 1 0 0 0 1 The complement of Ek (with k turned off) gives us the endpoints that never need to be considered again (since all shortest paths from k to these vertices hve been found). We call these pTrees the “Not Reached Yet masks” or “N masks”. S1 0 0 1 1 S13 =N11&E3 0 0 0 0 0 0 0 S41 =N14&E1 0 0 0 0 S42 =N14&E2 0 0 0 0 S43 =N14&E3 0 0 0 0 0 0 0 We use the notation, Shk for the map of the endpts of Shortest Paths thru h then k (obviously of length=2) and NLv for the map of vertices not reached by lengthL shortest paths from vertex v N21=N11& (S13|S14)’ 0 0 0 0 N22=N12& (S24)’ 0 0 0 0 N23=N13& (S31|S34)’ 0 0 0 0 N24=N14& (S41|S42|S43)’ 0 0 0 0 0 0 0 0 This entire level is unnecessary to construct since |N2 k|=0 k. The SPTree is shown by the green links. The connectivity components can be deduced from the zero set of the final NL ks. Girvan and Newman started a flurry of research by suggesting the graph could be edge labelled by an edge_between-ness measurement (which counts the shortest path participations of the edge) and that a graph could be usefully partitioned (into strongly connected components) by the divisive hierarchical clustering of removing edges in desc order of between-ness.
View full slide show