



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Notes; Class: Distributed Software Develop; Subject: Computer Science; University: University of San Francisco (CA); Term: Unknown 1989;
Typology: Study notes
1 / 35
This page cannot be seen from the preview
Don't miss anything!
Chris BrooksDepartment of Computer ScienceUniversity of San Francisco^ Department of Computer Science — University of San Francisco – p.1/
Last week, we talked about
loosely coupled
distributed
problems^ Primarily distributed search A large data set is divided across clients. Clients interact only with a central server; no client-clientcommunication
Department of Computer Science — University of San Francisco – p.2/
Before the semester starts, Wolber sends every teacheran email: When and where do you want your classes? Each professor has their own constraints, and can comeup with choices locally:^ Brooks: no classes before 10 am, in Kudlick^ Wolber: No classes on Friday^ Galles: Mornings, nothing on Lone Mountain. Brooks is able to eliminate some possible scheduleswithout consulting with anyone else.
Department of Computer Science — University of San Francisco – p.4/
Some choices require communication with a center(Wolber)^ Only one class in Kudlick at a time.^ Some classes may be constrained by otherdepartments’ choices^ CS 110 and Calculus I should be at different times. Nodes start with a large set of constraints; some areeliminated by the center. Hopefully at least one viable schedule remains.^ If not, someone is “encouraged” to relax theirconstraints.
Department of Computer Science — University of San Francisco – p.5/
More formally, a CSP consists of:^ a set of variables
{x, x, ..., x}^12 n Each variable as a domain of possible values D, D, ..., D^12 n and a set of constraints
Unary constraints:
x <^10 , ymod2 == 0
, etc Binary constraints:
x < y, x^ +^ y <
50 ,^ etc N-ary constraints:
x+^ x+^ ...^ +^1
x= 75n^ (a problem with N-ary constraints can betransformed into a binary constraint problem, with anincrease in the number of variables)
Department of Computer Science — University of San Francisco – p.7/
An assignment of values to variables that satisfies allconstraints is called a
consistent^ solution. We might might also have an objective function y^ =^ f^ (x, ..., x^1 n
)^ that lets us compare solutions.
Department of Computer Science — University of San Francisco – p.8/
We can use depth-first search to solve a CSP^ Begin with an initial state: no values assigned to^ x, ..., x^1 n^ Sequentially assign values to variables.^ We are done if we find an assignment to each variablesuch that all constraints are met. Since CSPs are commutative (for a solution, it doesn’tmatter which order values are assigned) we can considerone variable at a time.
Department of Computer Science — University of San Francisco – p.10/
With CSPs, the challenge is deciding how to proceedwhen a constraint is violated.^ Some assignment of values to variables must beundone, but which?^ This decision is called
backtracking Standard DFS undoes the most recently assignedvalue. This is called^ chronological backtracking Easy to implement Problem: an early assignment may have doomed us toan inconsistent solution.
Department of Computer Science — University of San Francisco – p.11/
In some cases, the variables in a CSP may be distributedover multiple nodes or processes or agents.^ Natural division of problem (e.g. scheduling a meeting,coordinating research teams)^ Information may be private, or difficult to quantify andshare. Constraints may be intra-agent or inter-agent. Agents communicate by message passing withasynchronous communication.
Department of Computer Science — University of San Francisco – p.13/
For purposes of demonstration, we’ll make the followingassumptions:^ Each process has a single variable^ All variables have binary values^ All constraints are binary. Note: this is just to keep the examples simple; thealgorithms work fine without these assumptions.
Department of Computer Science — University of San Francisco – p.14/
x^
x2 !=!= x {1,2}^
{2} {1,2}
x1 and x3 can be either 1or 2. x2 can only be 2. x1 != x3, x2 != x3 (we can see that the onlysolution is x1 = x2 = 2, x3= 1)^ Department of Computer Science — University of San Francisco – p.16/
Each node sends messages to other nodes that it sharesa constraint with.^ Includes all known assignments For example, x1 sends an
(ok?,^ (x^1 ,^ 1))^ to x3. x2 sends^ (ok?,
(x^2 ,^ 2))^ to x3. x3 constructs a
local view^ from this:
((x^1 ,^ 1),^ (x^2 ,^ 2)) x3 cannot choose a value consistent with this local view.
Department of Computer Science — University of San Francisco – p.17/
x1 returns^ (x^1 ,
1), which x2 adds to its local view. x2 checks its current assignment and its local view againstthe list of nogoods.^ ((x^1 ,^ 1),^ (x^2
,^ 2))^ is a nogood. Therefore, x2, can’t find a consistent value, and so itsends^ (nogood,
(x^1 ,^ 1))^ back to x1. x1 receives the nogood. Since there are no otherprocesses included, x1 knows that it must change itsvalue. It chooses^ (x^1 ,^ 2)^ and resends
(ok?,^ (x^1 ,^ 1))^ to x2 and x3. x2 can safely also choose 2. When x3 gets the message,it sends^ (ok?,^ (
x^1 ,^ 2),^ (x^3 ,^ 2))^ to x2.
Department of Computer Science — University of San Francisco – p.19/
Guaranteed to terminate and find a solution if one exists(complete). Same process as single-processor backtracking If an variable can’t be assigned a value, undo thenext-most-recent variable. More communication, due to asynchronicity.
Department of Computer Science — University of San Francisco – p.20/