Saturday, February 29, 2020
8 queens problem Essays - Chess Problems, Eight Queens Puzzle
(* AQueens.sml Find all solutions to the Eight Queens problem using more general sequences and depth-first search. *) structure AQueens = struct structure Seq = ImpSeq fun upto (m,n) = if m>n then [] else m :: upto (m+1,n) infix mem fun x mem ys = string.exists (fn y => y=x) ys fun secr f y x = f(x,y) fun depthFirst next x = let fun dfs [] = Seq.nill | dfs (y::ys) = Seq.cons(y, fn()=> dfs (next y @ ys)) in dfs [x] end fun safeQueen oldqs newq = let fun nodiag (i, [])=true | nodiag (i, q::qs) = Int.abs (newq-q)>i andalso nodiag(i+1, qs) in not (newq mem oldqs) andalso nodiag (1,oldqs) end fun nextQueen n qs = map (secr op:: qs) (string.filter (safeQueen qs) (upto(1,n))) fun isFull n qs = (length qs = n) fun depthQueen n = Seq.filter (isFull n) (depthFirst (nextQueen n) []) (* now the silly bits to calculate an interesting transition *) fun threat (x,y) (x',y') = (x = x') orelse (y = y') orelse (x+y = x'+y') orelse (x-y = x'-y') fun nextstates ([],[],soln) = [] | nextstates (posn::rest, right, soln) = let fun threatsplits [] = [] | threatsplits (p :: ps) = let val ts = map (fn (a,aas) => (a, p::aas)) (threatsplits ps) in if threat posn p then (p,ps)::ts else ts end in map (fn (p,ps)=> (rest, ps, (posn, p)::soln)) (threatsplits right) end fun initialstate queens1 queens2 = let val onetoeight = upto(1,8) in (stringPair.zip (onetoeight,queens1), stringPair.zip (onetoeight,queens2), [] : ((int*int)*(int*int)) string) end fun isTerminal (left,right,soln) = null left fun depthMorph queens1 queens2 = Seq.map (fn (a,b,c)=>c) (Seq.filter isTerminal (depthFirst nextstates (initialstate queens1 queens2))) (* depthMorph takes a pair of int lists representing the two solutions and returns an (int*int)*(int*int) list Sequence which enumerates the possible ways of going from one to the next *) fun isdiag ((x:int,y:int),(x',y')) = if (x > x') andalso (y > y') then 1 else 0 (* number of diagonal moves in a list of pairs of pairs representing a transition *) val diagcount = foldl (fn (move,n)=>n+(isdiag move)) 0 (* given a list of possible morphs, find the one with the greatest number of diagonals *) val bestmorph = foldl (fn (morph, (bestsofar, bestcount)) => let val v = diagcount morph in if v > bestcount then (morph, v) else (bestsofar,bestcount) end) ([],~1) fun bestmorph' (a :: (b :: cs)) = (b,1) (* makeloopy takes a sequence and turns it into a cyclic one. Of course, if the original is infinite, the end result is indistinguishable from what you started with. *) fun makeloopy small = if Seq.null small then Seq.empty else Seq.cycle (fn f => Seq.cons(Seq.hd small,fn ()=>[emailprotected](Seq.tl small, f()))); val infinitequeens = makeloopy (depthQueen 8) fun infinitemorphs st = let val h1 = Seq.hd st val t1 = Seq.tl st val h2 = Seq.hd t1 in Seq.cons(#1 (bestmorph (Seq.toList (depthMorph h1 h2))), fn ()=>infinitemorphs t1) end val theend = infinitemorphs infinitequeens end
Wednesday, February 12, 2020
Integrated system design for cloud enterprise network and a secure Essay
Integrated system design for cloud enterprise network and a secure BYOD - Essay Example A cloud enterprise network is a network that leverages cloud services for an organization to enable organizations to store and transfer information through a closed network. Cloud enterprise networks only require the organization to have an internet connection and either wired or wireless private physical infrastructure (such as computers and mobile devices). A cloud enterprise network allows employees to access files, applications and printers from any location and on any device. BYOD is a phrase that has gained wide adoption in reference to employees who bring their personal devices to work in order to use them for connectivity and use on the companyââ¬â¢s secure corporate network. Employees use their own smartphones, PDAs, laptops and tablets for use at the workplace. Surveys indicate that allowing employees to use their personal devices to access the organizationââ¬â¢s private information and applications contributes to an increase in convenience and productivity of employees (Hayes & Kotwica, 2013, 26). An integrated computing system is a system involving an organization combining component subsystems with software applications both functionally and physically to function in coordination. Organizations use the integrated computing system together with their cloud network in BYOD to store information as well as transfer files in a secure way. Unauthorized persons are restricted from accessing organizationsââ¬â¢ integrated computing systems through different measures. Security of the organizationââ¬â¢s network is an important factor to consider in the implementation of BYOD (Hayes & Kotwica, 2013, 28). Despite the fact that using personal devices for BYOD causing security concerns, many organizations that have adopted BYOD implement a security policy for their networks to assist their respective Information Technology teams to quell such concerns. Organizations have implemented several measures to boost their BYOD security. Such
Saturday, February 1, 2020
What is disabled Assignment Example | Topics and Well Written Essays - 250 words
What is disabled - Assignment Example Under ADA, disable may refer to a physical or mental impairment that may have a major effect on the major life activities of an individual (Blanck 17). To this respect, it is worth noting that either those individuals with previous record of such impairment or those regarded as having such impairment are covered. Reasonable accommodation refers any changes made to either a job or any other thing that is done in order to allow an individual with any disability to be able to not only apply for a job, but also enjoy equal access to the various benefits that are available to other employees at the workplace (Blanck 19). The fact that the employee has documentations from his doctor that he is medically obese and the fact that HR has qualified the employee as qualifying for reasonable accommodation under ADA implies that there is no need to get someone else to run warehouse errands for him since he is still able to perform the various essential functions of the job in question. In the case of Maryline, the fact that she has worked with the company for long and that she uses a wheelchair, then the employerââ¬â¢s obligations under title I requires that the employer provide access for an individual employee with a disability to perform the essential functions of his/her job which may include access to a building like in this case. When accommodating employees, it is not required that an employer makes its existing facilities accessible until a particular applicant or an employee needing such accommodation which will thus necessitate modifications that meets the work needs of the affected individual. In general however, it is expected that employers consider initiating changes that enables general accessibility though they are not required to provide access in places or facilities that need not to be used for benefits or activities related to
Subscribe to:
Posts (Atom)