24
MSD 2011 Midterm Karl Lieberherr 3/28/2011 1 MSD midterm

MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

Embed Size (px)

Citation preview

Page 1: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

MSD 2011 Midterm

Karl Lieberherr

3/28/2011 1MSD midterm

Page 2: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

1. Strengthening

1. add to oppose actions in scg.cd:1. OpposeRequest = Agree| Strengthen | Refute.

2. In scg.beh: AvatarI: strengthen public OpposeResponse strengthen(OpposeRequest request)?

3. Define how to use refutation protocol to deal with strengthening: Alice, proposes, Bob strengthens, Bob must defend strengthened claim against Alice.

3/28/2011 2MSD midterm

Page 3: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

2. Confidence• Add to claim definition in scg.cd• update valid function for Claim: confidence must

be in [0..1]. Make sure we have a valid function for Claim.

• Avatar propose needs to be updated: create claims with confidence. Random [0,1] for baby avatar.

• Influences playground level and SCG level.• Reputation update: make a proposal: multiply old

result with confidence.

3/28/2011 3MSD midterm

Page 4: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

Game Design

1. The cd2. valid3. quality4. Refutation protocol: ExistsForAll: “instance

from Alice” + “Solution of 0 from Bob”5. getResult: check if Bob’s solution has quality

1

3/28/2011 4MSD midterm

Page 5: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

Interfaces, Knowledge and Skillsof Playground Designer

1. SCG rules: how to play the game.2. Domain Knowledge, e.g., CSP.3. Define context-free grammars in EBNF style syntax4. Write programs in data-binding technology (common

in XML technology) (for baby avatar, etc.)5. The more domains, protocols, we have the more the

playground designer does configuration.6. Finding InstanceSets that lead to interesting games.

What are the niches for specialized, more efficient algorithms?

7. Request and Response object format for baby avatar.

3/28/2011 5MSD midterm

Page 6: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

PG Designers about scg.cd

• Claim fields must be in a certain order.• Styles of games• Protocol language

3/28/2011 6MSD midterm

Page 7: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

PG Designer about Protocols• List of available protocols• Should know basic predicate calculus (from logic) and

the connection between games and predicate logic. Prenex normal form?: all quantifiers at beginning.

• Difference between mathematical claims (for which a winning strategy corresponds to a proof) and other claims that must be settled using the game.

• Need for a new protocol? Provide a valid protocol definition

• Protocol negation: same domain: roles of Alice and Bob are reversed and a defense is changed into a refutation.

3/28/2011 7MSD midterm

Page 8: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

Not asked: Domain Designer

• Knows domain and standard solution approches. Knows about subdomains that have faster/customized solutions and offers those through instance sets.

3/28/2011 8MSD midterm

Page 9: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

Protocol Negation

!C=ExistsForAll !p• instance from Alice• solution sB of 0 from Bob• check: sB has quality <= t• Alice wins, Bob loses

C=ForAllExists p• instance from Bob• solution sA from Alice• check: sA has quality <=t• Alice loses, Bob wins

3/28/2011 9MSD midterm

Page 10: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

Protocol Negation 2

C = EA p(0,1)• Alice claims• Bob refutes• instance from Alice• solution of 0 from Bob• Alice defends iff p(0,1)

!C = AE !p(0,1)• Alice claims• Bob refutes• instance from Bob• solution of 0 from Alice• Alice is refuted iff p(0,1)

3/28/2011 MSD midterm 10

Alice <-> Bob, refute <-> defense

Page 11: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

Modules

• SCG Court– defines SCG rules and what must be provided by

playground designer (structures, languages and interface implementations)

• Domain– defines languages and contracts of functions

• Protocol– scientific discourse and contract for outcome

• Playground: a configuration of a domain and claims in domain using protocol.

3/28/2011 11MSD midterm

Page 12: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

Hiding Complexity

• It is important to hide complexity from playground designers and avatar designers.

• A playground designer needs an abstract view of scg.cd and scg.beh. She needs only the signatures and contracts of methods, not their implementation, and she needs the languages defined in scg.cd.

• An avatar designer needs an abstract view of the implementation provided by the playground designer. Signatures and contracts. Playground designer must provide contracts for avatar designer.

3/28/2011 12MSD midterm

Page 13: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

Acceptance Test• Design 2 closely related new games

– MAX-SAT-ALL and MAX-SAT-SECRET• Domain: CNFs

– standard algorithm: generating a random assignment where each variable is set to true with probability p.

– InstanceSets: Length(k) = clauses are exactly of length k.

– quality(F,J) = fsat(F,J) = fraction of satisfied clauses.– valid(F,J) = all clauses in F evaluate to t or f– belongsTo(F,k) = all clauses use distinct literals and

are of length k

3/28/2011 MSD midterm 13

Page 14: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

MAX-SAT-ALL(k)

• Protocol: ForAllExists(F,J) and its negation• Claims: MAX-SAT-ALL(k,t) = in CNFs in instance

set Length(k) there exists an assignment of at least quality t.

3/28/2011 MSD midterm 14

Page 15: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

MAX-SAT-SECRET(k)

• Protocol: PositiveSecret(F,JA,JB) and its negation

• Claims: MAX-SAT-SECRET(k,t) = in CNFs in instance set Length(k) Alice’s JA approximates Bob’s secret solution JB within t.

• fsat(F,J)>=t

3/28/2011 MSD midterm 15

Page 16: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

The Actions of an Avatar

3/28/2011 MSD midterm 16

propose C1

oppose/refute C2

oppose/strengthen C3

agree C4

I=provideInstance(C5)

S=solveInstance (I)

Scholar

Page 17: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

Flow Game

• FlowClaim(c,G) = Exists flow F in G with value(F) >= c.

• Domain

3/28/2011 MSD midterm 17

Page 18: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

Design Document forSCG Court Evolution

• It is important to prepare a design document for SCG Court that can be given to future developers of SCG Court to prepare them for SCG Court maintenance and evolution tasks.

• This document should outline the architecture of the system, using pictures. It should outline the “philosophy” used by the implementation teams so that this philosophy can also be followed during system maintenance.

3/28/2011 MSD midterm 18

Page 19: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

• For example, the contract that the admin must check all incoming claim, instance and solution objects for validity (using valid(…) and belongsTo(…) must be mentioned.

• Please can the implementation teams write this document and present it at the last class.

3/28/2011 MSD midterm 19

Page 20: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

• agile• development methodologies—and especially Extreme Programming—already incorporate the• three keys to test automation: (1) testers and programmers are expected to work together as a• single team, (2) the team treats test automation as a team responsibility and (3) testers are• expected to be engaged and testing throughout, often writing tests before code’s been written.• These tests, called acceptance tests, test the system from a customer perspective. The tests• themselves are variously written by product programmers, dedicated testers, or analysts acting in• the customer role. They use the testing framework created by the product programmers to• execute the tests. This is a significant difference from the traditional arrangement that assigns the• responsibility for test automation to an independent testing team.

• from: http://www.io.com/~wazmo/papers/design_for_testability_PNSQC.pdf

3/28/2011 MSD midterm 20

Page 21: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

SCG

• train people to distinguish good claims from bad claims in a domain D where there is constructive evidence for defending good and refuting bad claims.

• good = true claim, optimal claim, recommended treatment for symptoms

• bad = false claim, non-optimal claim, non-recommended treatment for symptoms

3/28/2011 MSD midterm 21

Page 22: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

Complexity

• distinguishing good claims from bad claims is hard.

• defending a good claim is easier• refuting a bad claim is easier

3/28/2011 MSD midterm 22

Page 23: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

Claims

• and, or, not, ForAll, Exists• basic claims are decided by refutation

protocol

3/28/2011 MSD midterm 23

Page 24: MSD 2011 Midterm Karl Lieberherr 3/28/20111MSD midterm

Behaviors• good

– propose good claim and defend it.– agree with good claim and defend it and refute negation.– oppose bad claim and refute or strengthen it.

• bad– propose bad claim.– fail to

• refute bad claim• defend good claim

3/28/2011 MSD midterm 24