data structures course assignment

Upload: profvip-abotaleb

Post on 10-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Data Structures Course Assignment

    1/8

    Faculty Of Engineering

    Department of Electronics & Electrical Communications

    Data Structure Course Contest One

    Time: Two Days

    M obil e T echnol ogy S chedul ing

    A l gor ithms

    In a mobile t elecommunicat ions company; it 's requ ired t o inc rease t he overall

    t hroughput [ D at a rat e] of t he wireless coverage.

    For each mobile cell t here are n slot s t hat t he n users could be assigned.

    [ A ssuming tha t the nu mber o f user s = the nu m ber o f the fr equ ency s lot s ]

    i .e. User number one could be operated on slot one or two or three or any

    combinations of them

    If w e assume that the user one could be operated in both slots one , two

    and three then the user one data rate = the summation of the data rate in

    each slot.

    There's a metri c coefficient to indicate the datarate corresponds to a specific

    user assuming certain operating frequency slot.

    I f user number one operat es on t he f requency slot number one t hen t he

    dat arat e =10 M bps and i f t he same user operat es on t he f requency slot

  • 8/8/2019 Data Structures Course Assignment

    2/8

    number t wo t hen the dat a rat e =15 M bps and if t he same user operat es on t he

    f requency slot number t hree t he dat arat e cou ld be =12M bps

    But why f or t he same user if he operat es on dif f erent slot t he dat arat e is

    di f ferent?

    The answer is relat ed t o t he communicat ions t heory; t here are many f act ors

    relat es t he user locat ion (distance bet ween t he user and t he cell base st at ion)

    , t he t ransmit t ing power of t he mobile , t he f requency t hat t he mobile

    operat ing in [ The f requency slot select ed when init iat ing t he communicat ion

    process] ,...et c

    These f act ors are analyzed in a st ochast ic f ashion [ Probabilist ic model] t o

    calculat e t he data rat e of each user if s/he operat es on a cert ain f requency

    slot .

    We cou ld develop a mat rix called t he met ric mat rix it s rows represent t he

    user number and it s columns represent t he f requency slot number.

    You are requ ired t o develop a c++ program t hat makes a channel assignment .

    so t hat we could decide which channel t he user number j should use t o get

    t he maximum overall syst em t hroughput .

    This problem is known in t he algor it hms wor ld as a sched u ling pr oblem .

    Given the required algorithms to be implemented by your program; and the

    algorithm exp lanation

  • 8/8/2019 Data Structures Course Assignment

    3/8

    A lso t he scheduling shou ld be implement ed under some assumpt ions

    1-Each user must operat es only [ at most and at least ] on a single

    channel(f requency slot ).

    [ To make t he f airness as t he number of channels = t he number of users; if a

    user operat es on more t han a single channel t hen t here's anot her u ser t hat

    wouldn't f ind any channel t o operat e on and it 's not f air]

    2-Each channel couldn't be assigned t o more t han a single user.

    (A nd i t s realist ic t he user sends t he dat a as an analog signal

    [ D igit al inside t he mobile or t he comput er] and af t er t he t ransmit t er + t he

    ant enna; it 's convert ed t o analog signal.

    The analog signal is a sinusoidal signal of a cert ain f requency band.

    (A f t er a proc ess known as t he modulat ion process)

    The f inal deduc t ion:

    Each user shou ld operat es on only one channel

    Each channel must only assigned t o a single user.

    M ore pract ical:

    The user could operat e on more t han a channel.

    [ But st ill each channel couldn't be assigned t o more t han a single user at t he

    same t ime] .

  • 8/8/2019 Data Structures Course Assignment

    4/8

    A ssuming t hat t he met ric mat rix as t he f ollowing

    We will give each met r ic mat rix element a symbol as which means t he

    met r ic of t he user number i if s/he uses t he channel (f requency slot ) number c

    So is t he met r ic (dat a rat e) of t he f irst user if s/he uses t he f irst channel

    (f requency slot ) which is equal 380 M bps in our example.

    A nd is t he met ric (dat a rat e) of t he second user if s/he uses t he t hird

    channel (f requency slot ) which is equal 1390 M bps in ou r example.

    The algor it hm procedure:

    Init ially we pick t he largest dat a rat e f rom t he mat rix (1530) t hen delet e all t he

    dat a on t he same row (f irst row) of t he picked dat a rat e

    (As the sam e row means th e same user a nd as the u ser i s ass igned to the

    chan ne l then th e r es t chann e ls cou ldn 't be ass igned to th e user )

    and also delet e all t he dat a on t he same column(t hird column) of t he picked dat a rat e

  • 8/8/2019 Data Structures Course Assignment

    5/8

    ( as th e same colum n m eans the sam e chann e l and a s the chan ne l is ass igned

    to the u ser t hen i t couldn ' t be ass igned to an y other user s)

    So the resultant matrix is as the following:

    S t ep 1

    From t he result ant dat a pick t he largest dat a rat e (810) and repeat t he process

    unt il t he mat r ix is empt y and all t he users are assigned t o t he required

    channel.

    S tep 2

    S tep 3 Each t ime t he maximum select ed element is t he t arget dat a rat e.

    Which is meaning t hat we f inally choose the f lowing dat a rat es:

    1530,810 and 300

  • 8/8/2019 Data Structures Course Assignment

    6/8

    Or which is meaning t hat t he user one will use t he

    channel number t hree and t he user t wo will use t he channel number t wo and

    t he user t wo will choose channel number one

    The t ot al syst em thr oughput =1530+810+300=2640 M bps

  • 8/8/2019 Data Structures Course Assignment

    7/8

    0- Init ialize t he t ot al t hroughput t o zero and a count er t o zero.1- St ore all of t he mat r ix dat a int o an in-order linked list2- Inc rement t he count er3- Get t he f irst element of t he in-order linked list and st ore it in a variable

    (SD R[ count er] an acr onym f or Select ed_dat a_rat e)

    =>specif y it s row number and column number

    =>Get all t he dat a on t he same row (same user) and t he same column

    (same channel ) and delet e t hem f rom t he in-order linked list .

    4- A dd t he SD R[ i] t o t he t ot al t hroughput and st ore t he result in t he t ot althroughput.

    5- I f t he result ed linked list is not empt y go t o st ep 2 and r epeat6- A f t er t he linked list becomes empt y t hen t he number in t he t ot al

    t hroughput is t he result ed Overall syst em t hroughput .

    7- The numbers on t he arr ay SD R represent s t he select ed dat a rat es t o beassigned .

    8- Out put whic h channel is assigned t o eachuser .

    [ Repeat t he previous 8 st eps but using a linear in-order list ] compare bet ween

    t he memory ut ilizat ion f or bot h implement at ions and f or a given number of

    users.

    N ot es:

    1-N umber of user [ =number of channels] cou ld be bet ween 2 and t ill t o 1000

  • 8/8/2019 Data Structures Course Assignment

    8/8

    2-The cu rr ent algorit hm is not t he opt imized one as f or t he given met ric

    mat rix

    I f we choose t he f ollowing met r ics: 1530, 730 and 650

    We sat isf ied t he condit ions t hat each user t akes only one channel and in t he

    same t ime maximizing t he t ot al t hr oughpu t 1530+730+650=2910M bps

    We will learn in t he next sessions more opt imized methods but need a new

    dat a st ruct ures t o be implement ed like t he binary t ree, Quad-t ree..et c.

    For a bet t er memory ut ilizat ion st ore t he mat rix int o a dynamically t wo

    dimensional ar ray [ D ouble Point er] .

    In t he beginning of t he program ask t he program user f or t he number of t he

    users and t he number of t he f requency slot s. [They must be t he same]. and

    t hen allocat e t he cor responding memory blocks

    I f you use a st at ic t wo d imensional array 1000*10000 t hen in t he worst case

    You will lose 1000*1000 -2*2 memory loc at ions [ You now are not a programmer]

    The same concept s are applied when using t he in-order linear linked list rat her

    t han t he in-order linear st at ic list .

    G ood L uck"A bdelrhman M ohamed A bot aleb" 30 August 2010