Desktop model Roger L. Costello March 24, 2018 Desktop0 Desktop1

Slides:



Advertisements
Similar presentations
Introduction to Computers Section 6A. home The Operating System (OS) The operating system (OS) is software that controls the interaction between hardware.
Advertisements

Chapter 10: Introduction to Inheritance
Vocabulary Crossword 2-1 Vocabulary Crossword Puzzle 2-1 Click mouse to advance slides. Press Esc key to close presentation.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Lecture#16 Discrete Mathematics. Recursion Now, 1 is an odd positive integer by the definition base. With k = 1, = 3, so 3 is an odd positive integer.
Ad Hoc Constraints Objectives of the Lecture : To consider Ad Hoc Constraints in principle; To consider Ad Hoc Constraints in SQL; To consider other aspects.
Object Oriented Software Development
1 Getting Started with C++. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Visual Studio 2008.
When I want to work with SQL, I start off as if I am doing a regular query.
Select (drop-down list) Inputs. Insert/Form/List Menu.
Solving Systems of Equations Algebraically Chapter 3.2.
CS190/295 Programming in Python for Life Sciences: Lecture 6 Instructor: Xiaohui Xie University of California, Irvine.
Sequences Lecture 11. L62 Sequences Sequences are a way of ordering lists of objects. Java arrays are a type of sequence of finite size. Usually, mathematical.
Alloy Analyzer 4 Tutorial Session 3: Static Modeling Greg Dennis and Rob Seater Software Design Group, MIT.
Tabu Search for Solving Personnel Scheduling Problem
Direct Proof and Counterexample IV: Division into Cases and the Quotient-Remainder Theorem For each of the following values of n and d, find integers q.
A Gentle Introduction to Software Modeling & Analysis
Abstract Factory Pattern
Using Alloy to Design a Safe Traffic Light System
Customizing the Quick Access Toolbar in Microsoft Office
Templates.
(State) Model-Based Approaches I Software Specification Lecture 35
Using Alloy to model the self-selection of a leader in a decentralized set of communicating processes I’m the leader! time … Roger L. Costello December.
Computer Skills windows.
SEAA 2014 Automatic Production of Transformation Chains Using Structural Constraints on Output Models Cuauhtémoc Castellanos Etienne Borde Thomas Vergnaud.
Multi-Step Equations How to Identify Multistep Equations |Combining Terms| How to Solve Multistep Equations | Consecutive Integers.
Exact Algorithms for Mixed-Integer Bilevel Linear Programming
Instructions To Add A Signature In Adobe Reader
EMGT 6412/MATH 6665 Mathematical Programming Spring 2016
Abstract Factory Pattern
Ordering of Hypothesis Space
Intent (Thanks to Jim Fawcett for the slides)
Hints on Delivering PowerPoint Presentations Well
Chapter 19 Generics Dr. Clincy - Lecture.
Can the constraints be satisfied?
6 Delegate and Lambda Expressions
Copyright © Cengage Learning. All rights reserved.
Using Alloy to Solve the Einstein Puzzle
CS190/295 Programming in Python for Life Sciences: Lecture 6
Model the non-negative even integers
CSE 503 – Software Engineering
Subject Name:Sysytem Software Subject Code: 10SCS52
Each hotel guest has a set of keys and no two guests have the same key
Modeling Inference Rules
Model Land and Seafloor Surfaces using Alloy (Part 2)
Use Alloy to model and find a solution to the Farmer, Goat, Cabbage, and Wolf problem Roger L. Costello July 14, 2018.
Multiple Inheritance Roger L. Costello March 24, 2018.
Java – Inheritance.
Expressing set properties in Alloy
Encapsulation in Alloy
Regression testing Tor Stållhane.
Eve knows Alice’s password
Visual Modeling Using Rational Rose
Using screens and adding two numbers - addda.cbl
Expressing set properties in Alloy
CISC101 Reminders Assignment 3 due next Friday. Winter 2019
Model Land and Seafloor Surfaces using Alloy (Part 3)
Object model versus Event model
9. Two Functions of Two Random Variables
Object model versus Event model
Chapter 1. Formulations.
Implementation of Learning Systems
How to create easy-to-read Alloy models
Three Secrets to Understanding Alloy
Chapter 6b: Database Design Using the E-R Model
Inheritance Lakshmish Ramaswamy.
Computer Skills windows.
Computer Skills windows.
Generics, Lambdas and Reflection
Presentation transcript:

Desktop model Roger L. Costello March 24, 2018 Desktop0 Desktop1 cut paste icon1 icon3 icon2 icon3 icon3 Roger L. Costello March 24, 2018

It’s time to model software In the previous examples there was just one or a small number of solutions (instances) satisfying the constraints. With software there are usually many solutions.

Model a desktop and two operations In this example we model software that allows users to add and remove icons from a desktop. A cut operation removes one icon from the desktop. A paste operation adds one icon to the desktop.

Problem Statement Model a desktop, its icons, and cut and paste operations. We will create two versions of the model: Version #1: Hardcode the icons. Version #2: Arbitrary set of icons.

Version #1: Simple Model Let’s model a desktop that has just two icons named A and B, and a cut operation that removes B. Desktop (first) Desktop (second) cut A B A

A set of Desktops, each with a set of icons sig Desktop { icons: set Icon } The set keyword means that icons maps each Desktop to a set of Icon (an Icon is either A or B). icons Desktop0 A Desktop0 is mapped to this set: {A, B} Desktop0 B Desktop1 A Desktop1 is mapped to this (singleton) set: {A}

Order the Desktops -- there is a first Desktop, a second Desktop, etc. open util/ordering[Desktop] “first” denotes the first Desktop. “first.icons” denotes the icons on the first Desktop. “prev” denotes the previous Desktop. Suppose d denotes one of the Desktops, then d.prev.icons denotes the icons on the previous Desktop. “last” denotes the last Desktop. “next” denotes the next Desktop.

There are two icons, A and B abstract sig Icon {} one sig A extends Icon {} one sig B extends Icon {} Alternatively: enum Icon { A, B }

Constrain the first desktop to contain both icons, the second desktop to contain just A fact { first.icons = A + B first.next.icons = A }

Specify in the run command that the instance is to contain 2 Desktops. run {} for 3 but 2 Desktop

open util/ordering[Desktop] sig Desktop { icons: set Icon } enum Icon { A, B } fact { first.icons = A + B first.next.icons = A } run {} for 3 but 2 Desktop

Version #2: Arbitrary icons, cut/paste operations We want the model to represent any set of icons on the first Desktop. Let d = the first Desktop and i = an icon on the first Desktop. The second Desktop = d - i, or The second Desktop = d + j (where j is an icon not on d) Let d = the second Desktop and i = an icon on the second Desktop. The third Desktop = d - i, or The third Desktop = d + j (where j is an icon not on d) And so forth.

Here is one of the instances that Alloy generated: Desktop0 Desktop1 Desktop2 cut paste icon1 icon3 icon2 icon3 icon3 paste Desktop4 Desktop3 cut icon1 icon0 icon1 icon3 icon3

Desktop signature is same as before open util/ordering[Desktop] sig Desktop { icons: set Icon }

Instead of enumerating the icons, have a set of icons: sig Icon {}

The first Desktop contains a set of icons: fact init { some i: set Icon | first.icons = i }

A Desktop cannot hold just any set of icons, a Desktop is derived from its previous Desktop: it has the icons on the previous Desktop, plus or minus one icon fact Desktops_through_cut_and_paste { all d: Desktop - first | (some i: d.prev.icons | d.icons = d.prev.icons - i) or (some i: Icon - d.prev.icons | d.icons = d.prev.icons + i) }

open util/ordering[Desktop] sig Desktop { icons: set Icon } sig Icon {} fact init { some i: set Icon | first.icons = i } fact Desktops_through_cut_and_paste { all d: Desktop - first | (some i: d.prev.icons | d.icons = d.prev.icons - i) or (some i: Icon - d.prev.icons | d.icons = d.prev.icons + i) } run {} for 5 Do Lab3