This document discusses algorithms and data structures. It begins by defining an algorithm as a set of instructions to accomplish a task and lists criteria such as being unambiguous and terminating. Data types and abstract data types are introduced. Methods for analyzing programs are covered, including time and space complexity using asymptotic notation. Examples are provided to illustrate iterative and recursive algorithms for summing lists as well as matrix operations.
1) The document describes a digital signal processing lab report that analyzes Gibbs phenomenon using different sinc functions to design filters.
2) The lab uses sinc functions with varying indices to design low-pass, high-pass, band-pass and band-stop filters. The effect of the sinc function length on frequency response and Gibbs phenomenon is observed.
3) Gibbs phenomenon occurs near discontinuities, where the Fourier series approximation will always have an error in the form of an overshoot near the discontinuity, about 9% of the size of the jump, no matter how many terms are used.
Minimum phase, All pass and Magnitude Squared FunctionCOMSATS Abbottabad
This document summarizes a lab experiment on minimum phase, all pass, and magnitude squared functions. The objective was to design MATLAB functions to decompose a transfer function into its minimum phase and all pass components, and to calculate the magnitude squared function. The functions take numerator and denominator polynomials as input and output the minimum phase, all pass, and magnitude squared responses. Examples are provided to test the functions on different transfer functions. Plots are generated to compare the pole-zero diagrams and magnitude and phase responses of the original, minimum phase, and all pass systems.
This document summarizes the results of a lab experiment to analyze the phase response of pole-zero models using MATLAB. The lab analyzed all-zero, all-pole, and ARMA models with varying pole and zero locations and magnitudes. Key findings include that all-pole and all-zero models exhibit linear phase response, while ARMA models exhibit non-linear phase response due to pole-zero cancellation effects. The phase response was also found to flip with changing pole/zero angle and become sharper or flatter with decreasing or increasing pole/zero magnitude respectively.
This document describes algorithms for iso-surface and full volume rendering. It discusses computing gradients at sample points using central differencing, shading using a standard illumination model, and implementing transfer functions for color (RGB) and opacity (alpha). Pseudocode is provided for the main algorithms, gradient computation, transfer functions, and scaling/rotation implementations. Key aspects covered include ray casting, sampling, interpolation, thresholding, and compositing color and opacity along rays.
An efficient algorithm for the computation of Bernoulli numbersXequeMateShannon
This document describes an efficient algorithm for computing large Bernoulli numbers. The algorithm is based on the asymptotic formula for Bernoulli numbers and uses the Euler product formula with primes. The algorithm allows individual Bernoulli numbers to be computed much faster than recurrence formulas. Using this algorithm, the authors computed B(750,000) in a few hours and set a record by computing B(5,000,000), which has over 27 million decimal digits. The algorithm involves computing the principal term, a few terms of the Euler product, and the fractional part using the Von Staudt-Clausen formula.
Python Lab manual program for BE First semester (all departmentNazeer Wahab
The document contains Python programs and outputs for various algorithms and programs including: calculating greatest common divisor, Newton's square root method, exponentiation, linear search, binary search, selection sort, insertion sort, merge sort, prime number checking, matrix multiplication, word count from file, line and paragraph count from file, drawing an elliptical orbit using Pygame, and a bouncing ball simulation.
This document discusses algorithms and data structures. It begins by defining an algorithm as a set of instructions to accomplish a task and lists criteria such as being unambiguous and terminating. Data types and abstract data types are introduced. Methods for analyzing programs are covered, including time and space complexity using asymptotic notation. Examples are provided to illustrate iterative and recursive algorithms for summing lists as well as matrix operations.
1) The document describes a digital signal processing lab report that analyzes Gibbs phenomenon using different sinc functions to design filters.
2) The lab uses sinc functions with varying indices to design low-pass, high-pass, band-pass and band-stop filters. The effect of the sinc function length on frequency response and Gibbs phenomenon is observed.
3) Gibbs phenomenon occurs near discontinuities, where the Fourier series approximation will always have an error in the form of an overshoot near the discontinuity, about 9% of the size of the jump, no matter how many terms are used.
Minimum phase, All pass and Magnitude Squared FunctionCOMSATS Abbottabad
This document summarizes a lab experiment on minimum phase, all pass, and magnitude squared functions. The objective was to design MATLAB functions to decompose a transfer function into its minimum phase and all pass components, and to calculate the magnitude squared function. The functions take numerator and denominator polynomials as input and output the minimum phase, all pass, and magnitude squared responses. Examples are provided to test the functions on different transfer functions. Plots are generated to compare the pole-zero diagrams and magnitude and phase responses of the original, minimum phase, and all pass systems.
This document summarizes the results of a lab experiment to analyze the phase response of pole-zero models using MATLAB. The lab analyzed all-zero, all-pole, and ARMA models with varying pole and zero locations and magnitudes. Key findings include that all-pole and all-zero models exhibit linear phase response, while ARMA models exhibit non-linear phase response due to pole-zero cancellation effects. The phase response was also found to flip with changing pole/zero angle and become sharper or flatter with decreasing or increasing pole/zero magnitude respectively.
This document describes algorithms for iso-surface and full volume rendering. It discusses computing gradients at sample points using central differencing, shading using a standard illumination model, and implementing transfer functions for color (RGB) and opacity (alpha). Pseudocode is provided for the main algorithms, gradient computation, transfer functions, and scaling/rotation implementations. Key aspects covered include ray casting, sampling, interpolation, thresholding, and compositing color and opacity along rays.
An efficient algorithm for the computation of Bernoulli numbersXequeMateShannon
This document describes an efficient algorithm for computing large Bernoulli numbers. The algorithm is based on the asymptotic formula for Bernoulli numbers and uses the Euler product formula with primes. The algorithm allows individual Bernoulli numbers to be computed much faster than recurrence formulas. Using this algorithm, the authors computed B(750,000) in a few hours and set a record by computing B(5,000,000), which has over 27 million decimal digits. The algorithm involves computing the principal term, a few terms of the Euler product, and the fractional part using the Von Staudt-Clausen formula.
Python Lab manual program for BE First semester (all departmentNazeer Wahab
The document contains Python programs and outputs for various algorithms and programs including: calculating greatest common divisor, Newton's square root method, exponentiation, linear search, binary search, selection sort, insertion sort, merge sort, prime number checking, matrix multiplication, word count from file, line and paragraph count from file, drawing an elliptical orbit using Pygame, and a bouncing ball simulation.
Python programs - first semester computer lab manual (polytechnics)SHAMJITH KM
The document contains Python algorithms and programs for various mathematical and logical operations like addition, subtraction, average, largest number, factorial, etc. Each section includes the algorithm, flowchart and Python code with sample output for each operation.
This document discusses register allocation in compiler construction. It begins with an example of constructing an interference graph from a code snippet during liveness analysis. It then covers the main steps of register allocation: constructing interference graphs from liveness analysis, graph coloring to assign registers while minimizing spills, and handling move instructions through coalescing. It provides examples demonstrating graph coloring on interference graphs with different numbers of available registers.
This chapter discusses algorithm analysis and asymptotic analysis of functions. It introduces the Big-O, Theta, little-o, and little-omega notations for classifying algorithms by their growth rates. Functions can have the same rate of growth (Theta), a slower rate (little-o), or a faster rate (little-omega). Rules are provided for manipulating Big-O expressions, and typical time complexities like constant, logarithmic, linear, quadratic, and exponential functions are covered.
This document introduces asymptotic notations that are used to describe the time complexity of algorithms. It defines big O, big Omega, and big Theta notations, which describe the limiting behavior of functions. Big O notation provides an asymptotic upper bound, big Omega provides a lower bound, and big Theta provides a tight bound. Examples are given of different asymptotic efficiency classes like constant, logarithmic, linear, quadratic, and exponential time. Properties of asymptotic notations like transitivity, reflexivity, symmetry, and transpose symmetry are also covered.
This document discusses time complexity analysis of algorithms using asymptotic notations. It defines key notations like O(g(n)) which represents an upper bound, Ω(g(n)) for a lower bound, and Θ(g(n)) for a tight bound. Examples are provided to demonstrate proving classifications like n^2 ∈ O(n^3) and 5n^2 ∈ Ω(n). Limitations of the notations are also noted, such as not capturing variable behavior between even and odd inputs. The notations provide a way to categorize algorithms and compare their growth rates to determine asymptotic efficiency.
This document provides an introduction to asymptotic notation, which is used to classify algorithms according to their running time or space requirements. It defines common asymptotic notations like Big-O, Big-Omega, and Big-Theta and provides examples of algorithms that run in constant time (O(1)), linear time (O(n)), logarithmic time (O(log n)), quadratic time (O(n^2)), and other runtimes. The document also compares common growth rates like constant, linear, logarithmic, n log n, quadratic, polynomial, and exponential functions. Overall, it establishes the foundation for discussing the asymptotic efficiency of algorithms.
Lec 5 asymptotic notations and recurrencesAnkita Karia
This document introduces asymptotic notation and methods for analyzing algorithm runtimes. It discusses Big-O, Big-Omega, and Big-Theta notations for describing upper bounds, lower bounds, and tight bounds of a function. It also covers solving recurrence relations using substitution, recursion trees, and the master method. The master method provides a way to solve recurrences of the form T(n) = aT(n/b) + f(n) based on comparing f(n) to nlogba.
The document discusses asymptotic notations used to estimate the growth rate of functions. It defines asymptotic notations like Big-O, Big-Omega, and Theta that provide upper, lower, and tight bounds. Examples show how to determine if a function f(n) is O(g(n)), Ω(g(n)), or Θ(g(n)) based on constants. Little-o and little-omega notations describe bounds that are not asymptotically tight. Asymptotic notations are useful for analyzing time complexities of algorithms.
Python programs - PPT file (Polytechnics)SHAMJITH KM
The document discusses various Python programming concepts like addition, subtraction, average, volume calculations, conversions between Celsius and Fahrenheit, finding the largest of three numbers, determining if a number is odd or even, printing natural numbers up to a limit, and calculating the factorial of a number. Algorithms, flowcharts and Python code are provided for each concept as examples.
Lisp in Small Parts
Introduction
Debugging in LispWorks
Getting Started
Lists
Expressions
Defining Procedures
Variables
Manipulating Lists
Strings
Printing
Testing a Result
Creating Dialogue Boxes
Writing Programs
Processing Items in a List
Repeating Operations
More about Recursion
Generalising Procedures
Projects
Animals
Anagrams
Recipes
Map
Turtle Graphics
Logic Mazes
Number Countdown
Answers to Exercises
Index of Procedures
Suggested sites
Answers to Exercises
Not all the exercises have answers yet.
Lists
1.
(list 1 (list 2 (list 3 4)))
Expressions
Defining Procedures
1. Square a number
(defun square (number)
(* number number))
2. Find the nth triangular number
(defun triangular (n)
(/ (* n (+ n 1)) 2))
3. Find the result of throwing two dice
(defun two-dice ()
(+ (+ 1 (random 6)) (+ 1 (random 6))))
Variables
1. Convert between km and miles
(defparameter kilometresinmiles 0.621371192)
(defun convert-km (km)
(* km kilometresinmiles))
(defun convert-miles (miles)
(/ miles kilometresinmiles))
2. Find the average of three numbers
(defun average3 (number1 number2 number3)
(/ (+ number1 number2 number3) 3))
3. Cube the sum of two numbers
(defun cubesum (a b)
(let* ((total (+ a b))
(answer (* total total total)))
answer))
4. Substitute values into a quadratic equation
(defun pseudo-primes (x)
(+ (- (* x x) x) 41))
Manipulating Lists
1. Swap the first two items in a list
(defun swap (lst)
(cons (second lst) (cons (first lst) (rest (rest lst)))))
2. Duplicate the first item in a list
(defun dup (lst)
(cons (first lst) lst))
3. Return a random item from a list
(defun random-elt (lst)
(nth (random (length lst)) lst))
4. Return the last item in a list
(defun last-elt (lst)
(nth (- (length lst) 1) lst))
Strings
This document discusses asymptotic notations that are used to characterize an algorithm's efficiency. It introduces Big-Oh, Big-Omega, and Theta notations. Big-Oh gives an upper bound on running time. Big-Omega gives a lower bound. Theta gives both upper and lower bounds, representing an algorithm's exact running time. Examples are provided for each notation. Time complexity is also introduced, which describes how the time to solve a problem changes with problem size. Worst-case time analysis provides an upper bound on runtime.
Asymptotic notations such as O, Ω, θ, o, and ω are used to represent the complexity of algorithms. O notation provides an asymptotic upper bound, Ω provides a lower bound, and θ provides a tight bound. Apriori analysis determines complexity by analyzing the algorithm itself rather than running it, using asymptotic notations which remain the same even if actual times change on different systems.
The document discusses various methods for analyzing algorithms, including analyzing running time complexity and rate of growth. It covers asymptotic notations like Big O, Big Omega, and Big Theta notation for describing upper bounds, lower bounds, and tight bounds of an algorithm's running time. Various time complexities like constant, logarithmic, linear, quadratic, and exponential are provided with examples. The analysis of different algorithm control structures like loops, nested loops, if-else statements, and switches are also discussed.
The document discusses recursion and provides examples of recursive algorithms like factorial, Fibonacci series, and Towers of Hanoi. It explains recursion using these examples and discusses the disadvantages of recursion. It also covers divide and conquer algorithms like quicksort and binary search. Finally, it discusses backtracking and provides the example of the eight queens problem to illustrate recursive backtracking.
This document discusses different types of functions including linear, quadratic, cubic, and reciprocal functions. It also mentions inverse functions where f-1(x) = x and discusses approaches to prove that a function is one-to-one including showing that f(x1) = f(x2) or using the horizontal line test.
Here is a MATLAB script to solve the quadratic equation with variable coefficients:
% Script to solve the quadratic equation ax^2 + bx + c = 0
clear
disp('Enter coefficients a, b, c: ')
a = input('a = ');
b = input('b = ');
c = input('c = ');
x = sym('x');
sol = solve(a*x^2 + b*x + c == 0, x);
disp('The solutions are:')
disp(sol)
This script first clears any existing variables, then prompts the user to input the coefficients a, b, and c. It then defines x as a symbolic variable
The document discusses the dynamic programming approach to solving the Fibonacci numbers problem and the rod cutting problem. It explains that dynamic programming formulations first express the problem recursively but then optimize it by storing results of subproblems to avoid recomputing them. This is done either through a top-down recursive approach with memoization or a bottom-up approach by filling a table with solutions to subproblems of increasing size. The document also introduces the matrix chain multiplication problem and how it can be optimized through dynamic programming by considering overlapping subproblems.
I am Tim D. I am a Computer Network Assignments Expert at computernetworkassignmenthelp.com. I hold a Master's in Computer Science from, West Virginia University, USA. I have been helping students with their assignments for the past 15 years. I solve assignments related to the Computer Network.
Visit computernetworkassignmenthelp.com or email support@computernetworkassignmenthelp.com.
You can also call on +1 678 648 4277 for any assistance with the Computer Network Assignments.
This document discusses integration in MATLAB. It describes how MATLAB can be used to find both indefinite integrals (anti-derivatives) and definite integrals. The int command is used to find indefinite integrals by calculating the primitive function of an expression. Definite integrals, which calculate the area under a curve between bounds, can also be found using int by specifying the limits of integration. Examples are provided to demonstrate calculating indefinite and definite integrals of common functions in MATLAB.
The document discusses the technique of dynamic programming. It begins with an example of using dynamic programming to compute the Fibonacci numbers more efficiently than a naive recursive solution. This involves storing previously computed values in a table to avoid recomputing them. The document then presents the problem of finding the longest increasing subsequence in an array. It defines the problem and subproblems, derives a recurrence relation, and provides both recursive and iterative memoized algorithms to solve it in quadratic time using dynamic programming.
Python programs - first semester computer lab manual (polytechnics)SHAMJITH KM
The document contains Python algorithms and programs for various mathematical and logical operations like addition, subtraction, average, largest number, factorial, etc. Each section includes the algorithm, flowchart and Python code with sample output for each operation.
This document discusses register allocation in compiler construction. It begins with an example of constructing an interference graph from a code snippet during liveness analysis. It then covers the main steps of register allocation: constructing interference graphs from liveness analysis, graph coloring to assign registers while minimizing spills, and handling move instructions through coalescing. It provides examples demonstrating graph coloring on interference graphs with different numbers of available registers.
This chapter discusses algorithm analysis and asymptotic analysis of functions. It introduces the Big-O, Theta, little-o, and little-omega notations for classifying algorithms by their growth rates. Functions can have the same rate of growth (Theta), a slower rate (little-o), or a faster rate (little-omega). Rules are provided for manipulating Big-O expressions, and typical time complexities like constant, logarithmic, linear, quadratic, and exponential functions are covered.
This document introduces asymptotic notations that are used to describe the time complexity of algorithms. It defines big O, big Omega, and big Theta notations, which describe the limiting behavior of functions. Big O notation provides an asymptotic upper bound, big Omega provides a lower bound, and big Theta provides a tight bound. Examples are given of different asymptotic efficiency classes like constant, logarithmic, linear, quadratic, and exponential time. Properties of asymptotic notations like transitivity, reflexivity, symmetry, and transpose symmetry are also covered.
This document discusses time complexity analysis of algorithms using asymptotic notations. It defines key notations like O(g(n)) which represents an upper bound, Ω(g(n)) for a lower bound, and Θ(g(n)) for a tight bound. Examples are provided to demonstrate proving classifications like n^2 ∈ O(n^3) and 5n^2 ∈ Ω(n). Limitations of the notations are also noted, such as not capturing variable behavior between even and odd inputs. The notations provide a way to categorize algorithms and compare their growth rates to determine asymptotic efficiency.
This document provides an introduction to asymptotic notation, which is used to classify algorithms according to their running time or space requirements. It defines common asymptotic notations like Big-O, Big-Omega, and Big-Theta and provides examples of algorithms that run in constant time (O(1)), linear time (O(n)), logarithmic time (O(log n)), quadratic time (O(n^2)), and other runtimes. The document also compares common growth rates like constant, linear, logarithmic, n log n, quadratic, polynomial, and exponential functions. Overall, it establishes the foundation for discussing the asymptotic efficiency of algorithms.
Lec 5 asymptotic notations and recurrencesAnkita Karia
This document introduces asymptotic notation and methods for analyzing algorithm runtimes. It discusses Big-O, Big-Omega, and Big-Theta notations for describing upper bounds, lower bounds, and tight bounds of a function. It also covers solving recurrence relations using substitution, recursion trees, and the master method. The master method provides a way to solve recurrences of the form T(n) = aT(n/b) + f(n) based on comparing f(n) to nlogba.
The document discusses asymptotic notations used to estimate the growth rate of functions. It defines asymptotic notations like Big-O, Big-Omega, and Theta that provide upper, lower, and tight bounds. Examples show how to determine if a function f(n) is O(g(n)), Ω(g(n)), or Θ(g(n)) based on constants. Little-o and little-omega notations describe bounds that are not asymptotically tight. Asymptotic notations are useful for analyzing time complexities of algorithms.
Python programs - PPT file (Polytechnics)SHAMJITH KM
The document discusses various Python programming concepts like addition, subtraction, average, volume calculations, conversions between Celsius and Fahrenheit, finding the largest of three numbers, determining if a number is odd or even, printing natural numbers up to a limit, and calculating the factorial of a number. Algorithms, flowcharts and Python code are provided for each concept as examples.
Lisp in Small Parts
Introduction
Debugging in LispWorks
Getting Started
Lists
Expressions
Defining Procedures
Variables
Manipulating Lists
Strings
Printing
Testing a Result
Creating Dialogue Boxes
Writing Programs
Processing Items in a List
Repeating Operations
More about Recursion
Generalising Procedures
Projects
Animals
Anagrams
Recipes
Map
Turtle Graphics
Logic Mazes
Number Countdown
Answers to Exercises
Index of Procedures
Suggested sites
Answers to Exercises
Not all the exercises have answers yet.
Lists
1.
(list 1 (list 2 (list 3 4)))
Expressions
Defining Procedures
1. Square a number
(defun square (number)
(* number number))
2. Find the nth triangular number
(defun triangular (n)
(/ (* n (+ n 1)) 2))
3. Find the result of throwing two dice
(defun two-dice ()
(+ (+ 1 (random 6)) (+ 1 (random 6))))
Variables
1. Convert between km and miles
(defparameter kilometresinmiles 0.621371192)
(defun convert-km (km)
(* km kilometresinmiles))
(defun convert-miles (miles)
(/ miles kilometresinmiles))
2. Find the average of three numbers
(defun average3 (number1 number2 number3)
(/ (+ number1 number2 number3) 3))
3. Cube the sum of two numbers
(defun cubesum (a b)
(let* ((total (+ a b))
(answer (* total total total)))
answer))
4. Substitute values into a quadratic equation
(defun pseudo-primes (x)
(+ (- (* x x) x) 41))
Manipulating Lists
1. Swap the first two items in a list
(defun swap (lst)
(cons (second lst) (cons (first lst) (rest (rest lst)))))
2. Duplicate the first item in a list
(defun dup (lst)
(cons (first lst) lst))
3. Return a random item from a list
(defun random-elt (lst)
(nth (random (length lst)) lst))
4. Return the last item in a list
(defun last-elt (lst)
(nth (- (length lst) 1) lst))
Strings
This document discusses asymptotic notations that are used to characterize an algorithm's efficiency. It introduces Big-Oh, Big-Omega, and Theta notations. Big-Oh gives an upper bound on running time. Big-Omega gives a lower bound. Theta gives both upper and lower bounds, representing an algorithm's exact running time. Examples are provided for each notation. Time complexity is also introduced, which describes how the time to solve a problem changes with problem size. Worst-case time analysis provides an upper bound on runtime.
Asymptotic notations such as O, Ω, θ, o, and ω are used to represent the complexity of algorithms. O notation provides an asymptotic upper bound, Ω provides a lower bound, and θ provides a tight bound. Apriori analysis determines complexity by analyzing the algorithm itself rather than running it, using asymptotic notations which remain the same even if actual times change on different systems.
The document discusses various methods for analyzing algorithms, including analyzing running time complexity and rate of growth. It covers asymptotic notations like Big O, Big Omega, and Big Theta notation for describing upper bounds, lower bounds, and tight bounds of an algorithm's running time. Various time complexities like constant, logarithmic, linear, quadratic, and exponential are provided with examples. The analysis of different algorithm control structures like loops, nested loops, if-else statements, and switches are also discussed.
The document discusses recursion and provides examples of recursive algorithms like factorial, Fibonacci series, and Towers of Hanoi. It explains recursion using these examples and discusses the disadvantages of recursion. It also covers divide and conquer algorithms like quicksort and binary search. Finally, it discusses backtracking and provides the example of the eight queens problem to illustrate recursive backtracking.
This document discusses different types of functions including linear, quadratic, cubic, and reciprocal functions. It also mentions inverse functions where f-1(x) = x and discusses approaches to prove that a function is one-to-one including showing that f(x1) = f(x2) or using the horizontal line test.
Here is a MATLAB script to solve the quadratic equation with variable coefficients:
% Script to solve the quadratic equation ax^2 + bx + c = 0
clear
disp('Enter coefficients a, b, c: ')
a = input('a = ');
b = input('b = ');
c = input('c = ');
x = sym('x');
sol = solve(a*x^2 + b*x + c == 0, x);
disp('The solutions are:')
disp(sol)
This script first clears any existing variables, then prompts the user to input the coefficients a, b, and c. It then defines x as a symbolic variable
The document discusses the dynamic programming approach to solving the Fibonacci numbers problem and the rod cutting problem. It explains that dynamic programming formulations first express the problem recursively but then optimize it by storing results of subproblems to avoid recomputing them. This is done either through a top-down recursive approach with memoization or a bottom-up approach by filling a table with solutions to subproblems of increasing size. The document also introduces the matrix chain multiplication problem and how it can be optimized through dynamic programming by considering overlapping subproblems.
I am Tim D. I am a Computer Network Assignments Expert at computernetworkassignmenthelp.com. I hold a Master's in Computer Science from, West Virginia University, USA. I have been helping students with their assignments for the past 15 years. I solve assignments related to the Computer Network.
Visit computernetworkassignmenthelp.com or email support@computernetworkassignmenthelp.com.
You can also call on +1 678 648 4277 for any assistance with the Computer Network Assignments.
This document discusses integration in MATLAB. It describes how MATLAB can be used to find both indefinite integrals (anti-derivatives) and definite integrals. The int command is used to find indefinite integrals by calculating the primitive function of an expression. Definite integrals, which calculate the area under a curve between bounds, can also be found using int by specifying the limits of integration. Examples are provided to demonstrate calculating indefinite and definite integrals of common functions in MATLAB.
The document discusses the technique of dynamic programming. It begins with an example of using dynamic programming to compute the Fibonacci numbers more efficiently than a naive recursive solution. This involves storing previously computed values in a table to avoid recomputing them. The document then presents the problem of finding the longest increasing subsequence in an array. It defines the problem and subproblems, derives a recurrence relation, and provides both recursive and iterative memoized algorithms to solve it in quadratic time using dynamic programming.
A study of the worst case ratio of a simple algorithm for simple assembly lin...narmo
This document summarizes a study on a simple heuristic for solving the Simple Assembly Line Balancing Problem (SALBP). It presents two greedy heuristics - Next-Fit and First-Fit - for solving the SALBP. The Next-Fit heuristic achieves a worst-case ratio of 2, which is proven to be tight. An example is provided to show that the First-Fit heuristic also has a worst-case ratio of 2. Sorting tasks by Ranked Positional Weight before applying First-Fit can find the optimal solution for some instances but the worst-case ratio remains 2 when using Next-Fit.
The document provides an overview and outline of the course "Optimization for Machine Learning". Key points:
- The course covers topics like convexity, gradient methods, constrained optimization, proximal algorithms, stochastic gradient descent, and more.
- Mathematical modeling and computational optimization for machine learning are discussed. Optimization algorithms like gradient descent and stochastic gradient descent are important for learning model parameters.
- Convex optimization problems have desirable properties like every local minimum being a global minimum. Gradient descent and related algorithms are guaranteed to converge for convex problems.
- Convex sets and functions are introduced, including characterizations using epigraphs and subgradients. Convex functions have useful properties like continuity and satisfying Jensen's inequality.
This document provides a 3-sentence summary of the given document:
The document is a tutorial introduction to high-performance Haskell that covers topics like lazy evaluation, reasoning about space usage, benchmarking, profiling, and making Haskell code run faster. It explains concepts like laziness, thunks, and strictness and shows how to define tail-recursive functions, use foldl' for a strict left fold, and force evaluation of data constructor arguments to avoid space leaks. The goal is to help programmers optimize Haskell code and make efficient use of multiple processor cores.
Symbolic Execution as DPLL Modulo TheoriesQuoc-Sang Phan
The document discusses symbolic execution, which is a program analysis technique that executes programs with symbolic inputs instead of concrete inputs. It describes symbolic execution as an approach for solving satisfiability modulo theories (SMT) problems, by viewing symbolic execution as an SMT solver. It presents an implementation of symbolic execution based on a Boolean executor that performs a depth-first search, combined with an SMT solver to check satisfiability of path conditions.
I am Gozan. M. I am a Programming Exam Helper at liveexamhelper.com. I hold a master' Degree in Programming from the University of Denver, USA. I have been helping students with their exams for the past 9 years. You can hire me to take your exam in Programming. Visit liveexamhelper.com or email info@liveexamhelper.com. You can also call on +1 678 648 4277 for any assistance with the Programming Exam.
Need for Controllers having Integer Coefficients in Homomorphically Encrypted D...CDSL_at_SNU
The document discusses the problem of finite operation times for controllers with non-integer coefficients in homomorphically encrypted dynamic systems. It proposes converting non-integer coefficient controllers to integer coefficient controllers through optimization to avoid issues from repeated operations on ciphertexts. Simulation results show the encrypted controller with integer coefficients can operate for an infinite time horizon, unlike previous non-integer approaches.
The document discusses analyzing the running time of algorithms using Big-O notation. It begins by introducing Big-O notation and how it is used to generalize the running time of algorithms as input size grows. It then provides examples of calculating the Big-O running time of simple programs and algorithms with loops but no subprogram calls or recursion. Key concepts covered include analyzing worst-case and average-case running times, and rules for analyzing the running time of programs with basic operations and loops.
This document provides an introduction to using MATLAB. It begins with instructions on starting and exiting MATLAB. It then discusses MATLAB's basic functionality for matrix calculations and operations. Subsequent sections cover topics like repeating commands, subscripting matrices, the edit-test-edit cycle for developing code, writing functions and scripts, and input/output in MATLAB including loading/saving data and printing output. Exercises are provided throughout to help readers practice key concepts.
The document provides information about algorithms exam help from programmingexamhelp.com. It includes their contact information and discusses asymptotic analysis of functions and implementing operations on a doubly linked list in constant time. Specifically, it provides sample solutions for ordering functions by asymptotic growth, implementing reverse, move and read operations on a sequence data structure, maintaining a binder of pages with bookmarks, and describing insert and delete operations on a doubly linked list.
This document discusses dynamic programming techniques. It covers matrix chain multiplication and all pairs shortest paths problems. Dynamic programming involves breaking down problems into overlapping subproblems and storing the results of already solved subproblems to avoid recomputing them. It has four main steps - defining a mathematical notation for subproblems, proving optimal substructure, deriving a recurrence relation, and developing an algorithm using the relation.
The document discusses continuity of functions. A function is continuous at a point c if the limit of the function as x approaches c exists and equals the value of the function at c. Polynomial and rational functions are continuous everywhere in their domains. A function can have discontinuities where it is not defined or where the limit does not equal the function value. Discontinuities are either removable, where redefining the function can make it continuous, or non-removable, where an asymptote prevents continuity. A function is continuous on a closed interval if it is continuous on the interior and the one-sided limits equal the function values at the endpoints.
dynamic programming complete by Mumtaz Ali (03154103173)Mumtaz Ali
The document discusses dynamic programming, including its meaning, definition, uses, techniques, and examples. Dynamic programming refers to breaking large problems down into smaller subproblems, solving each subproblem only once, and storing the results for future use. This avoids recomputing the same subproblems repeatedly. Examples covered include matrix chain multiplication, the Fibonacci sequence, and optimal substructure. The document provides details on formulating and solving dynamic programming problems through recursive definitions and storing results in tables.
how to calclute time complexity of algortihmSajid Marwat
This document discusses algorithm analysis and complexity. It defines key terms like asymptotic complexity, Big-O notation, and time complexity. It provides examples of analyzing simple algorithms like a sum function to determine their time complexity. Common analyses include looking at loops, nested loops, and sequences of statements. The goal is to classify algorithms according to their complexity, which is important for large inputs and machine-independent. Algorithms are classified based on worst, average, and best case analyses.
I am Anne L. I am an Algorithms Design Homework Expert at programminghomeworkhelp.com. I hold a Ph.D. in Programming, Auburn University, USA. I have been helping students with their homework for the past 8 years. I solve homework related to Algorithms Design.
Visit programminghomeworkhelp.com or email support@programminghomeworkhelp.com. You can also call on +1 678 648 4277 for any assistance with the Algorithm Design Homework.
Similar to 2015 01 09 - Rende - Unical - Martin Gebser: Clingo = Answer Set Programming + Control (20)
The document describes Angryhex, an agent for playing Angry Birds games using Answer Set Programming (ASP) and HEX-programs. Angryhex uses HEX-programs to reason about optimal shots in tactics mode, taking into account game physics. It uses an ASP program to decide which level to play next in strategy mode based on previous play history and scores. The agent integrates with a provided vision module and represents both tactics and strategy declaratively using logic programming for improved performance over the previous Angryhex agent.
attestati di partecipazione al minicorso "intelligenza artificiale: facciamo ragionare i computer", tenutosi in aprile-maggio 2016 presso il dipartimento di matematica e informatica dell'università della calabria
Seminario tenuti all'interno del programma gratuito di divulgazione da parte del Corso di Laurea in Informatica dell'Università della Calabria (Dipartimento di Matematica e Informatica) presso gli istituti di istruzione superiore - https://www.mat.unical.it/informatica/CatalogoSeminariMinicorsi
Nuvola Rosa on tour: scienza e tecnologia per ragazze che vogliono fare strada
Dopo le edizioni di Firenze, Roma e Milano, Nuvola Rosa inizia un tour in tre grandi città italiane che coinvolgerà 1.500 ragazze italiane e straniere e donne di grande successo provenienti da Paesi diversi. Idee e talenti a confronto per immaginare un futuro diverso, aprire nuove possibilità di carriera e trasformare gli ostacoli in opportunità.
Flier cuda - Dipartimento di matematica e informatica - Università della Cala...kaliaragorn
Giorno 9,10,11 Giugno (Aula MT11) il Prof. Manuel Ujaldon (CUDA Research Fellow, http://cms.ac.uma.es/ujaldon/index.php/es/) dell' Universidad de Málaga sarà all'UNICAL, presso il Dipartimento di Matematica e Informatica per tenere un corso intensivo di tre giorni su come programmare le GPU utilizzando CUDA. I prerequisiti sono competenze basilari di C/C++ e un'idea intuitiva di parallel programming.
EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...Sérgio Sacani
Context. With a mass exceeding several 104 M⊙ and a rich and dense population of massive stars, supermassive young star clusters
represent the most massive star-forming environment that is dominated by the feedback from massive stars and gravitational interactions
among stars.
Aims. In this paper we present the Extended Westerlund 1 and 2 Open Clusters Survey (EWOCS) project, which aims to investigate
the influence of the starburst environment on the formation of stars and planets, and on the evolution of both low and high mass stars.
The primary targets of this project are Westerlund 1 and 2, the closest supermassive star clusters to the Sun.
Methods. The project is based primarily on recent observations conducted with the Chandra and JWST observatories. Specifically,
the Chandra survey of Westerlund 1 consists of 36 new ACIS-I observations, nearly co-pointed, for a total exposure time of 1 Msec.
Additionally, we included 8 archival Chandra/ACIS-S observations. This paper presents the resulting catalog of X-ray sources within
and around Westerlund 1. Sources were detected by combining various existing methods, and photon extraction and source validation
were carried out using the ACIS-Extract software.
Results. The EWOCS X-ray catalog comprises 5963 validated sources out of the 9420 initially provided to ACIS-Extract, reaching a
photon flux threshold of approximately 2 × 10−8 photons cm−2
s
−1
. The X-ray sources exhibit a highly concentrated spatial distribution,
with 1075 sources located within the central 1 arcmin. We have successfully detected X-ray emissions from 126 out of the 166 known
massive stars of the cluster, and we have collected over 71 000 photons from the magnetar CXO J164710.20-455217.
Current Ms word generated power point presentation covers major details about the micronuclei test. It's significance and assays to conduct it. It is used to detect the micronuclei formation inside the cells of nearly every multicellular organism. It's formation takes place during chromosomal sepration at metaphase.
The debris of the ‘last major merger’ is dynamically youngSérgio Sacani
The Milky Way’s (MW) inner stellar halo contains an [Fe/H]-rich component with highly eccentric orbits, often referred to as the
‘last major merger.’ Hypotheses for the origin of this component include Gaia-Sausage/Enceladus (GSE), where the progenitor
collided with the MW proto-disc 8–11 Gyr ago, and the Virgo Radial Merger (VRM), where the progenitor collided with the
MW disc within the last 3 Gyr. These two scenarios make different predictions about observable structure in local phase space,
because the morphology of debris depends on how long it has had to phase mix. The recently identified phase-space folds in Gaia
DR3 have positive caustic velocities, making them fundamentally different than the phase-mixed chevrons found in simulations
at late times. Roughly 20 per cent of the stars in the prograde local stellar halo are associated with the observed caustics. Based
on a simple phase-mixing model, the observed number of caustics are consistent with a merger that occurred 1–2 Gyr ago.
We also compare the observed phase-space distribution to FIRE-2 Latte simulations of GSE-like mergers, using a quantitative
measurement of phase mixing (2D causticality). The observed local phase-space distribution best matches the simulated data
1–2 Gyr after collision, and certainly not later than 3 Gyr. This is further evidence that the progenitor of the ‘last major merger’
did not collide with the MW proto-disc at early times, as is thought for the GSE, but instead collided with the MW disc within
the last few Gyr, consistent with the body of work surrounding the VRM.
This presentation explores a brief idea about the structural and functional attributes of nucleotides, the structure and function of genetic materials along with the impact of UV rays and pH upon them.
Phenomics assisted breeding in crop improvementIshaGoswami9
As the population is increasing and will reach about 9 billion upto 2050. Also due to climate change, it is difficult to meet the food requirement of such a large population. Facing the challenges presented by resource shortages, climate
change, and increasing global population, crop yield and quality need to be improved in a sustainable way over the coming decades. Genetic improvement by breeding is the best way to increase crop productivity. With the rapid progression of functional
genomics, an increasing number of crop genomes have been sequenced and dozens of genes influencing key agronomic traits have been identified. However, current genome sequence information has not been adequately exploited for understanding
the complex characteristics of multiple gene, owing to a lack of crop phenotypic data. Efficient, automatic, and accurate technologies and platforms that can capture phenotypic data that can
be linked to genomics information for crop improvement at all growth stages have become as important as genotyping. Thus,
high-throughput phenotyping has become the major bottleneck restricting crop breeding. Plant phenomics has been defined as the high-throughput, accurate acquisition and analysis of multi-dimensional phenotypes
during crop growing stages at the organism level, including the cell, tissue, organ, individual plant, plot, and field levels. With the rapid development of novel sensors, imaging technology,
and analysis methods, numerous infrastructure platforms have been developed for phenotyping.
ESPP presentation to EU Waste Water Network, 4th June 2024 “EU policies driving nutrient removal and recycling
and the revised UWWTD (Urban Waste Water Treatment Directive)”
The use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptxMAGOTI ERNEST
Although Artemia has been known to man for centuries, its use as a food for the culture of larval organisms apparently began only in the 1930s, when several investigators found that it made an excellent food for newly hatched fish larvae (Litvinenko et al., 2023). As aquaculture developed in the 1960s and ‘70s, the use of Artemia also became more widespread, due both to its convenience and to its nutritional value for larval organisms (Arenas-Pardo et al., 2024). The fact that Artemia dormant cysts can be stored for long periods in cans, and then used as an off-the-shelf food requiring only 24 h of incubation makes them the most convenient, least labor-intensive, live food available for aquaculture (Sorgeloos & Roubach, 2021). The nutritional value of Artemia, especially for marine organisms, is not constant, but varies both geographically and temporally. During the last decade, however, both the causes of Artemia nutritional variability and methods to improve poorquality Artemia have been identified (Loufi et al., 2024).
Brine shrimp (Artemia spp.) are used in marine aquaculture worldwide. Annually, more than 2,000 metric tons of dry cysts are used for cultivation of fish, crustacean, and shellfish larva. Brine shrimp are important to aquaculture because newly hatched brine shrimp nauplii (larvae) provide a food source for many fish fry (Mozanzadeh et al., 2021). Culture and harvesting of brine shrimp eggs represents another aspect of the aquaculture industry. Nauplii and metanauplii of Artemia, commonly known as brine shrimp, play a crucial role in aquaculture due to their nutritional value and suitability as live feed for many aquatic species, particularly in larval stages (Sorgeloos & Roubach, 2021).
Comparing Evolved Extractive Text Summary Scores of Bidirectional Encoder Rep...University of Maribor
Slides from:
11th International Conference on Electrical, Electronics and Computer Engineering (IcETRAN), Niš, 3-6 June 2024
Track: Artificial Intelligence
https://www.etran.rs/2024/en/home-english/
The binding of cosmological structures by massless topological defectsSérgio Sacani
Assuming spherical symmetry and weak field, it is shown that if one solves the Poisson equation or the Einstein field
equations sourced by a topological defect, i.e. a singularity of a very specific form, the result is a localized gravitational
field capable of driving flat rotation (i.e. Keplerian circular orbits at a constant speed for all radii) of test masses on a thin
spherical shell without any underlying mass. Moreover, a large-scale structure which exploits this solution by assembling
concentrically a number of such topological defects can establish a flat stellar or galactic rotation curve, and can also deflect
light in the same manner as an equipotential (isothermal) sphere. Thus, the need for dark matter or modified gravity theory is
mitigated, at least in part.
2015 01 09 - Rende - Unical - Martin Gebser: Clingo = Answer Set Programming + Control
1. Clingo = Answer Set Programming + Control
Martin Gebser Roland Kaminski
Benjamin Kaufmann Torsten Schaub
University of Potsdam
Aalto University
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 1 / 20
2. Motivation
ASP is an approach to declarative problem solving, combining
a rich yet simple modeling language
with high-performance solving capacities
tailored to Knowledge Representation and Reasoning
Elaborate reasoning processes feature
incremental solving, as in planning or finite model finding, or even
reactive solving, as in robotics or query-answering
Problem
Logic
Program Grounder Solver Stable
Models
Solutions
- - -
?
6
One-shot ASP Solving
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 2 / 20
3. Motivation
ASP is an approach to declarative problem solving, combining
a rich yet simple modeling language
with high-performance solving capacities
tailored to Knowledge Representation and Reasoning
Elaborate reasoning processes feature
incremental solving, as in planning or finite model finding, or even
reactive solving, as in robotics or query-answering
Problem
Logic
Program Grounder Solver Stable
Models
Solutions
- - -
?
6
Incremental ASP Solving
6
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 2 / 20
4. Motivation
ASP is an approach to declarative problem solving, combining
a rich yet simple modeling language
with high-performance solving capacities
tailored to Knowledge Representation and Reasoning
Elaborate reasoning processes feature
incremental solving, as in planning or finite model finding, or even
reactive solving, as in robotics or query-answering
Problem
Logic
Program Grounder Solver Stable
Models
Solutions
- - -
?
6
Reactive ASP Solving
66
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 2 / 20
5. Outline
1 Background
2 (More) Control
3 Summary
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 3 / 20
7. Background
Clingo 3 Series
One-shot ASP solving by means of grounder gringo and solver clasp
Clingo: gringo | clasp
Incremental ASP solving by dedicated handling of three program parts
iClingo: Clingo [base ∪ n
i=1cumulative(i) ∪ volatile(n)]∗
n=1
base: grounded once and stored by solver
cumulative(i): grounded for increasing i-values and stored by solver
volatile(i): grounded like cumulative(i) but not stored by solver
Reactive ASP solving by further incorporating external program parts
oClingo: iClingo [ m
j=1external(j)]∗
m=1
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 5 / 20
8. Background
Clingo 3 Series
One-shot ASP solving by means of grounder gringo and solver clasp
Clingo: gringo | clasp
Incremental ASP solving by dedicated handling of three program parts
iClingo: Clingo [base ∪ n
i=1cumulative(i) ∪ volatile(n)]∗
n=1
base: grounded once and stored by solver
cumulative(i): grounded for increasing i-values and stored by solver
volatile(i): grounded like cumulative(i) but not stored by solver
Reactive ASP solving by further incorporating external program parts
oClingo: iClingo [ m
j=1external(j)]∗
m=1
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 5 / 20
9. Background
Clingo 3 Series
One-shot ASP solving by means of grounder gringo and solver clasp
Clingo: gringo | clasp
Incremental ASP solving by dedicated handling of three program parts
iClingo: Clingo [base ∪ n
i=1cumulative(i) ∪ volatile(n)]∗
n=1
base: grounded once and stored by solver
cumulative(i): grounded for increasing i-values and stored by solver
volatile(i): grounded like cumulative(i) but not stored by solver
Reactive ASP solving by further incorporating external program parts
oClingo: iClingo [ m
j=1external(j)]∗
m=1
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 5 / 20
15. Background
Encoding for One-shot ASP Solving
diff(-1;1).
{ move(D,T) : diff(D) } 1 :- time(T).
move(T) :- move(D,T).
% State update
at(F, T) :- at(F,T-1), time(T), not move(T).
at(F+D,T) :- at(F,T-1), move(D,T), floor(F+D).
:- time(T), not 1 { at(F,T) } 1.
% Pending requests
task(F1,F2,D,T) :- request(F1,F2,T), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,T) :- task(F1,F2,D,T-1), time(T), not exec(F1,F2,D,T).
% Started tasks must be processed till completion
exec(F1,F2,D,T) :- task(F1,F2,D,T-1), at(F1,T-1), move(D,T).
exec(F2,D,T) :- exec(F1,F2,D,T).
exec(F2,D,T) :- exec(F2,D,T-1), time(T), not at(F2,T-1).
exec(D,T) :- exec(F2,D,T).
:- exec(D,T), not move(D,T).
:- move(D,T), not move(D,T+1), not exec(D,T), not exec(-D,T+1).
% Move iff there is some task to process
open(T) :- task(F1,F2,D,T).
open(T) :- exec(F2,D,T), not at(F2,T).
:- move(T), not open(T-1).
:- open(T), not move(T+1).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 7 / 20
16. Background
One-shot ASP Solving
Request 1: clingo-3 <files> <(echo "time(1..3).")
Solving...
Answer: 1
move(1,2) move(-1,3)
Request 2: clingo-3 <files> <(echo "time(1..5).")
Solving...
Answer: 1
move(1,2) move(1,3) move(-1,4) move(-1,5)
1
2
3
1
1
2
3
1 2 3
1
2
3
1
2
1
2
3
1
2
2
3 4
5
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 8 / 20
17. Background
One-shot ASP Solving
Request 1: clingo-3 <files> <(echo "time(1..3).")
Solving...
Answer: 1
move(1,2) move(-1,3)
Request 2: clingo-3 <files> <(echo "time(1..5).")
Solving...
Answer: 1
move(1,2) move(1,3) move(-1,4) move(-1,5)
1
2
3
1
1
2
3
1 2 3
1
2
3
1
2
1
2
3
1
2
2
3 4
5
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 8 / 20
18. Background
One-shot ASP Solving
Request 1: clingo-3 <files> <(echo "time(1..3).")
Solving...
Answer: 1
move(1,2) move(-1,3)
Request 2: clingo-3 <files> <(echo "time(1..5).")
Solving...
Answer: 1
move(1,2) move(1,3) move(-1,4) move(-1,5)
1
2
3
1
1
2
3
1 2 3
1
2
3
1
2
1
2
3
1
2
2
3 4
5
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 8 / 20
19. Background
One-shot ASP Solving
Request 1: clingo-3 <files> <(echo "time(1..3).")
Solving...
Answer: 1
move(1,2) move(-1,3)
Request 2: clingo-3 <files> <(echo "time(1..5).")
Solving...
Answer: 1
move(1,2) move(1,3) move(-1,4) move(-1,5)
1
2
3
1
1
2
3
1 2 3
1
2
3
1
2
1
2
3
1
2
2
3 4
5
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 8 / 20
20. Background
Encoding for Incremental ASP Solving
#base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#cumulative t.
{ move(D,T) : diff(D) } 1 :- time(T).
move(T) :- move(D,T).
% State update
at(F, T) :- at(F,T-1), time(T), not move(T).
at(F+D,T) :- at(F,T-1), move(D,T), floor(F+D).
:- time(T), not 1 { at(F,T) } 1.
% Pending requests
task(F1,F2,D,T) :- request(F1,F2,T), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,T) :- task(F1,F2,D,T-1), time(T), not exec(F1,F2,D,T).
% Started tasks must be processed till completion
...
:- move(D,T), not move(D,T+1), not exec(D,T), not exec(-D,T+1).
% Move iff there is some task to process
...
:- open(T), not move(T+1).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 9 / 20
21. Background
Encoding for Incremental ASP Solving
#base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#cumulative t.
{ move(D,T) : diff(D) } 1 :- time(T).
move(T) :- move(D,T).
% State update
at(F, T) :- at(F,T-1), time(T), not move(T).
at(F+D,T) :- at(F,T-1), move(D,T), floor(F+D).
:- time(T), not 1 { at(F,T) } 1.
% Pending requests
task(F1,F2,D,T) :- request(F1,F2,T), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,T) :- task(F1,F2,D,T-1), time(T), not exec(F1,F2,D,T).
% Started tasks must be processed till completion
...
:- move(D,T), not move(D,T+1), not exec(D,T), not exec(-D,T+1).
% Move iff there is some task to process
...
:- open(T), not move(T+1).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 9 / 20
22. Background
Encoding for Incremental ASP Solving
#base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#cumulative t.
{ move(D,T) : diff(D) } 1 :- time(T).
move(T) :- move(D,T).
% State update
at(F, T) :- at(F,T-1), time(T), not move(T).
at(F+D,T) :- at(F,T-1), move(D,T), floor(F+D).
:- time(T), not 1 { at(F,T) } 1.
% Pending requests
task(F1,F2,D,T) :- request(F1,F2,T), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,T) :- task(F1,F2,D,T-1), time(T), not exec(F1,F2,D,T).
% Started tasks must be processed till completion
...
:- move(D,T), not move(D,T+1), not exec(D,T), not exec(-D,T+1).
% Move iff there is some task to process
...
:- open(T), not move(T+1).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 9 / 20
23. Background
Encoding for Incremental ASP Solving
#base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#cumulative t.
{ move(D,T) : diff(D) } 1 :- time(T).
move(T) :- move(D,T).
% State update
at(F, T) :- at(F,T-1), time(T), not move(T).
at(F+D,T) :- at(F,T-1), move(D,T), floor(F+D).
:- time(T), not 1 { at(F,T) } 1.
% Pending requests
task(F1,F2,D,T) :- request(F1,F2,T), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,T) :- task(F1,F2,D,T-1), time(T), not exec(F1,F2,D,T).
% Started tasks must be processed till completion
...
:- move(D,T), not move(D,T+1), not exec(D,T), not exec(-D,T+1).
% Move iff there is some task to process
...
:- open(T), not move(T+1).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 9 / 20
24. Background
Encoding for Incremental ASP Solving
#base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#cumulative t.
{ move(D,T) : diff(D) } 1 :- time(T).
move(T) :- move(D,T).
% State update
at(F, T) :- at(F,T-1), time(T), not move(T).
at(F+D,T) :- at(F,T-1), move(D,T), floor(F+D).
:- time(T), not 1 { at(F,T) } 1.
% Pending requests
task(F1,F2,D,T) :- request(F1,F2,T), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,T) :- task(F1,F2,D,T-1), time(T), not exec(F1,F2,D,T).
% Started tasks must be processed till completion
...
:- move(D,T), not move(D,T+1), not exec(D,T), not exec(-D,T+1).
% Move iff there is some task to process
...
:- open(T), not move(T+1).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 9 / 20
25. Background
Encoding for Incremental ASP Solving
#base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#cumulative t.
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
at(F, t) :- at(F,t-1), not move(t).
at(F+D,t) :- at(F,t-1), move(D,t), floor(F+D).
:- not 1 { at(F,t) } 1.
% Pending requests
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t), not move(D,t+1), not exec(D,t), not exec(-D,t+1).
% Move iff there is some task to process
...
:- open(t), not move(t+1).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 9 / 20
26. Background
Encoding for Incremental ASP Solving
#base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#cumulative t.
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
at(F, t) :- at(F,t-1), not move(t).
at(F+D,t) :- at(F,t-1), move(D,t), floor(F+D).
:- not 1 { at(F,t) } 1.
% Pending requests
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t), not move(D,t+1), not exec(D,t), not exec(-D,t+1).
% Move iff there is some task to process
...
:- open(t), not move(t+1).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 9 / 20
27. Background
Encoding for Incremental ASP Solving
#base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#cumulative t.
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
at(F, t) :- at(F,t-1), not move(t).
at(F+D,t) :- at(F,t-1), move(D,t), floor(F+D).
:- not 1 { at(F,t) } 1.
% Pending requests
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
...
:- open(t-1), not move(t).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 9 / 20
28. Background
Encoding for Incremental ASP Solving
#base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#cumulative t.
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
at(F, t) :- at(F,t-1), not move(t).
at(F+D,t) :- at(F,t-1), move(D,t), floor(F+D).
:- not 1 { at(F,t) } 1.
% Pending requests
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
...
:- open(t-1), not move(t).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 9 / 20
43. (More) Control
Clingo 4 Approach
Custom grounding and solving via embedded scripting languages
Lua: main(prg), prg:ground(parts), prg:solve(), . . .
Python: main(prg), prg.ground(parts), prg.solve(), . . .
Library: prg.ground(parts), prg.solve(), . . .
Predecessor systems can easily be scripted
One-shot ASP solving (default): (ground | solve)
Incremental ASP solving: (ground | solve)∗
Reactive ASP solving: (ground∗
| solve)∗
. . .
Clingo: ASP + Control
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 14 / 20
44. (More) Control
Clingo 4 Approach
Custom grounding and solving via embedded scripting languages
Lua: main(prg), prg:ground(parts), prg:solve(), . . .
Python: main(prg), prg.ground(parts), prg.solve(), . . .
Library: prg.ground(parts), prg.solve(), . . .
Predecessor systems can easily be scripted
One-shot ASP solving (default): (ground | solve)
Incremental ASP solving: (ground | solve)∗
Reactive ASP solving: (ground∗
| solve)∗
. . .
Clingo: ASP + Control
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 14 / 20
45. (More) Control
Clingo 4 Approach
Custom grounding and solving via embedded scripting languages
Lua: main(prg), prg:ground(parts), prg:solve(), . . .
Python: main(prg), prg.ground(parts), prg.solve(), . . .
Library: prg.ground(parts), prg.solve(), . . .
Predecessor systems can easily be scripted
One-shot ASP solving (default): (ground | solve)
Incremental ASP solving: (ground | solve)∗
Reactive ASP solving: (ground∗
| solve)∗
. . .
Clingo: ASP + Control
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 14 / 20
46. (More) Control
Clingo 4 Approach
Custom grounding and solving via embedded scripting languages
Lua: main(prg), prg:ground(parts), prg:solve(), . . .
Python: main(prg), prg.ground(parts), prg.solve(), . . .
Library: prg.ground(parts), prg.solve(), . . .
Predecessor systems can easily be scripted
One-shot ASP solving (default): (ground | solve)
Incremental ASP solving: (ground | solve)∗
Reactive ASP solving: (ground∗
| solve)∗
. . .
Clingo: ASP + Control
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 14 / 20
47. (More) Control
Clingo 4 Approach
Custom grounding and solving via embedded scripting languages
Lua: main(prg), prg:ground(parts), prg:solve(), . . .
Python: main(prg), prg.ground(parts), prg.solve(), . . .
Library: prg.ground(parts), prg.solve(), . . .
Predecessor systems can easily be scripted
One-shot ASP solving (default): (ground | solve)
Incremental ASP solving: (ground | solve)∗
Reactive ASP solving: (ground∗
| solve)∗
. . .
Clingo: ASP + Control
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 14 / 20
48. (More) Control
Encoding for Incremental ASP Solving
#base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#cumulative t.
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
at(F, t) :- at(F,t-1), not move(t).
at(F+D,t) :- at(F,t-1), move(D,t), floor(F+D).
:- not 1 { at(F,t) } 1.
% Pending requests
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
...
:- open(t-1), not move(t).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 15 / 20
49. (More) Control
Encoding for Incremental ASP Solving
#base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#cumulative t.
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
at(F, t) :- at(F,t-1), not move(t).
at(F+D,t) :- at(F,t-1), move(D,t), floor(F+D).
:- not 1 { at(F,t) } 1.
% Pending requests
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
...
:- open(t-1), not move(t).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 15 / 20
50. (More) Control
Encoding for Incremental ASP Solving
#program base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#cumulative t.
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
at(F, t) :- at(F,t-1), not move(t).
at(F+D,t) :- at(F,t-1), move(D,t), floor(F+D).
:- not 1 { at(F,t) } 1.
% Pending requests
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
...
:- open(t-1), not move(t).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 15 / 20
51. (More) Control
Encoding for Incremental ASP Solving
#program base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#cumulative t.
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
at(F, t) :- at(F,t-1), not move(t).
at(F+D,t) :- at(F,t-1), move(D,t), floor(F+D).
:- not 1 { at(F,t) } 1.
% Pending requests
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
...
:- open(t-1), not move(t).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 15 / 20
52. (More) Control
Encoding for Incremental ASP Solving
#program base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#program cumulative(t).
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
at(F, t) :- at(F,t-1), not move(t).
at(F+D,t) :- at(F,t-1), move(D,t), floor(F+D).
:- not 1 { at(F,t) } 1.
% Pending requests
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
...
:- open(t-1), not move(t).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 15 / 20
53. (More) Control
Encoding for Incremental ASP Solving
#program base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#program cumulative(t).
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
at(F, t) :- at(F,t-1), not move(t).
at(F+D,t) :- at(F,t-1), move(D,t), floor(F+D).
:- not 1 { at(F,t) } 1.
% Pending requests
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
...
:- open(t-1), not move(t).
#volatile t.
:- open(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 15 / 20
54. (More) Control
Encoding for Incremental ASP Solving
#program base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#program cumulative(t).
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
at(F, t) :- at(F,t-1), not move(t).
at(F+D,t) :- at(F,t-1), move(D,t), floor(F+D).
:- not 1 { at(F,t) } 1.
% Pending requests
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
...
:- open(t-1), not move(t).
#external query(t).
:- open(t), query(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 15 / 20
55. (More) Control
Script for Incremental ASP Solving
#script(python)
from gringo import *
def main(prg):
imin = prg.get const("imin")
if imin == None: imin = 1
step = 0
parts = [("base", [])]
while True:
if step < imin:
step = step+1
parts.append(("cumulative", [step]))
if step == imin:
prg.ground(parts)
parts = []
prg.assign external(Fun("query", [step]), True)
ret = prg.solve()
if ret == SolveResult.SAT: break
prg.release external(Fun("query", [step]))
imin = imin+1
#end.
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 16 / 20
56. (More) Control
Script for Incremental ASP Solving
#script(python)
from gringo import *
def main(prg):
imin = prg.get const("imin")
if imin == None: imin = 1
step = 0
parts = [("base", [])]
while True:
if step < imin:
step = step+1
parts.append(("cumulative", [step]))
if step == imin:
prg.ground(parts)
parts = []
prg.assign external(Fun("query", [step]), True)
ret = prg.solve()
if ret == SolveResult.SAT: break
prg.release external(Fun("query", [step]))
imin = imin+1
#end.
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 16 / 20
57. (More) Control
Script for Incremental ASP Solving
#script(python)
from gringo import *
def main(prg):
imin = prg.get const("imin")
if imin == None: imin = 1
step = 0
parts = [("base", [])]
while True:
if step < imin:
step = step+1
parts.append(("cumulative", [step]))
if step == imin:
prg.ground(parts)
parts = []
prg.assign external(Fun("query", [step]), True)
ret = prg.solve()
if ret == SolveResult.SAT: break
prg.release external(Fun("query", [step]))
imin = imin+1
#end.
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 16 / 20
58. (More) Control
Script for Incremental ASP Solving
#script(python)
from gringo import *
def main(prg):
imin = prg.get const("imin")
if imin == None: imin = 1
step = 0
parts = [("base", [])]
while True:
if step < imin:
step = step+1
parts.append(("cumulative", [step]))
if step == imin:
prg.ground(parts)
parts = []
prg.assign external(Fun("query", [step]), True)
ret = prg.solve()
if ret == SolveResult.SAT: break
prg.release external(Fun("query", [step]))
imin = imin+1
#end.
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 16 / 20
59. (More) Control
Script for Incremental ASP Solving
#script(python)
from gringo import *
def main(prg):
imin = prg.get const("imin")
if imin == None: imin = 1
step = 0
parts = [("base", [])]
while True:
if step < imin:
step = step+1
parts.append(("cumulative", [step]))
if step == imin:
prg.ground(parts)
parts = []
prg.assign external(Fun("query", [step]), True)
ret = prg.solve()
if ret == SolveResult.SAT: break
prg.release external(Fun("query", [step]))
imin = imin+1
#end.
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 16 / 20
60. (More) Control
Script for Incremental ASP Solving
#script(python)
from gringo import *
def main(prg):
imin = prg.get const("imin")
if imin == None: imin = 1
step = 0
parts = [("base", [])]
while True:
if step < imin:
step = step+1
parts.append(("cumulative", [step]))
if step == imin:
prg.ground(parts)
parts = []
prg.assign external(Fun("query", [step]), True)
ret = prg.solve()
if ret == SolveResult.SAT: break
prg.release external(Fun("query", [step]))
imin = imin+1
#end.
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 16 / 20
61. (More) Control
Script for Incremental ASP Solving
#script(python)
from gringo import *
def main(prg):
imin = prg.get const("imin")
if imin == None: imin = 1
step = 0
parts = [("base", [])]
while True:
if step < imin:
step = step+1
parts.append(("cumulative", [step]))
if step == imin:
prg.ground(parts)
parts = []
prg.assign external(Fun("query", [step]), True)
ret = prg.solve()
if ret == SolveResult.SAT: break
prg.release external(Fun("query", [step]))
imin = imin+1
#end.
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 16 / 20
62. (More) Control
Script for Incremental ASP Solving
#script(python)
from gringo import *
def main(prg):
imin = prg.get const("imin")
if imin == None: imin = 1
step = 0
parts = [("base", [])]
while True:
if step < imin:
step = step+1
parts.append(("cumulative", [step]))
if step == imin:
prg.ground(parts)
parts = []
prg.assign external(Fun("query", [step]), True)
ret = prg.solve()
if ret == SolveResult.SAT: break
prg.release external(Fun("query", [step]))
imin = imin+1
#end.
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 16 / 20
63. (More) Control
My Script for Incremental ASP Solving
#script(python)
from gringo import *
def main(prg):
imin = prg.get const("imin")
if imin == None: imin = 1
step = 0
parts = [("base", [])]
while True:
if step < imin:
step = step+1
parts.append(("cumulative", [step]))
if step == imin:
prg.ground(parts)
parts = []
prg.assign external(Fun("query", [step]), True)
ret = prg.solve()
if ret == SolveResult.SAT: break
prg.release external(Fun("query", [step]))
imin = imin+1
#end.
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 16 / 20
64. (More) Control
My Script for Incremental ASP Solving
#script(python)
from gringo import *
def main(prg):
imin = prg.get const("imin")
if imin == None: imin = 1
step = 0
parts = [("base", []), ("task", [step])]
while True:
if step < imin:
step = step+1
parts.append(("cumulative", [step]))
parts.append(("task", [step]))
if step == imin:
prg.ground(parts)
parts = []
ret = prg.solve()
if ret == SolveResult.SAT: break
imin = imin+1
#end.
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 16 / 20
65. (More) Control
My Encoding for Incremental ASP Solving
#program base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#program cumulative(t).
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
...
% Pending requests
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
open(t) :- task(F1,F2,D,t).
open(t) :- exec(F2,D,t), not at(F2,t).
:- move(t), not open(t-1).
:- open(t-1), not move(t).
#external query(t).
:- open(t), query(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 17 / 20
66. (More) Control
My Encoding for Incremental ASP Solving
#program base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#program cumulative(t).
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
...
% Pending requests
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
open(t) :- task(F1,F2,D,t).
open(t) :- exec(F2,D,t), not at(F2,t).
:- move(t), not open(t-1).
:- open(t-1), not move(t).
#external query(t).
:- open(t), query(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 17 / 20
67. (More) Control
My Encoding for Incremental ASP Solving
#program base.
diff(-1;1).
task(F1,F2,D,0) :- request(F1,F2,0), D = (F2-F1)/|F2-F1|.
#program cumulative(t).
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
...
% Pending requests
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
open(t) :- task(F1,F2,D,t).
open(t) :- exec(F2,D,t), not at(F2,t).
:- move(t), not open(t-1).
:- open(t-1), not move(t).
#external query(t).
:- open(t), query(t).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 17 / 20
68. (More) Control
My Encoding for Incremental ASP Solving
#program base.
diff(-1;1).
#program task(t).
#external move(t+1).
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
open(t) :- task(F1,F2,D,t).
:- open(t), not move(t+1).
#program cumulative(t).
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
...
% Pending requests
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
open(t) :- exec(F2,D,t), not at(F2,t).
:- move(t), not open(t-1).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 17 / 20
69. (More) Control
My Encoding for Incremental ASP Solving
#program base.
diff(-1;1).
#program task(t).
#external move(t+1).
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
open(t) :- task(F1,F2,D,t).
:- open(t), not move(t+1).
#program cumulative(t).
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
...
% Pending requests
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
open(t) :- exec(F2,D,t), not at(F2,t).
:- move(t), not open(t-1).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 17 / 20
70. (More) Control
My Encoding for Incremental ASP Solving
#program base.
diff(-1;1).
#program task(t).
#external move(t+1).
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
open(t) :- task(F1,F2,D,t).
:- open(t), not move(t+1).
#program cumulative(t).
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
...
% Pending requests
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t-1), not move(D,t), not exec(D,t-1), not exec(-D,t).
% Move iff there is some task to process
open(t) :- exec(F2,D,t), not at(F2,t).
:- move(t), not open(t-1).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 17 / 20
71. (More) Control
My Encoding for Incremental ASP Solving
#program base.
diff(-1;1).
#program task(t).
#external move(t+1).
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
open(t) :- task(F1,F2,D,t).
:- open(t), not move(t+1).
#program cumulative(t).
#external move(D,t+1) : diff(D).
#external exec(D,t+1) : diff(D).
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
...
% Pending requests
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t), not move(D,t+1), not exec(D,t), not exec(-D,t+1).
% Move iff there is some task to process
open(t) :- exec(F2,D,t), not at(F2,t).
:- move(t), not open(t-1).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 17 / 20
72. (More) Control
My Encoding for Incremental ASP Solving
#program base.
diff(-1;1).
#program task(t).
#external move(t+1).
task(F1,F2,D,t) :- request(F1,F2,t), D = (F2-F1)/|F2-F1|.
open(t) :- task(F1,F2,D,t).
:- open(t), not move(t+1).
#program cumulative(t).
#external move(D,t+1) : diff(D).
#external exec(D,t+1) : diff(D).
{ move(D,t) : diff(D) } 1.
move(t) :- move(D,t).
% State update
...
% Pending requests
task(F1,F2,D,t) :- task(F1,F2,D,t-1), not exec(F1,F2,D,t).
% Started tasks must be processed till completion
...
:- move(D,t), not move(D,t+1), not exec(D,t), not exec(-D,t+1).
% Move iff there is some task to process
open(t) :- exec(F2,D,t), not at(F2,t).
:- move(t), not open(t-1).
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 17 / 20
73. (More) Control
Custom ASP Solving
Encoding consisting of named and parameterizable subprograms
#program base. (default), #program cumulative(t)., . . .
External (yet undefined) atoms provide input interface to other parts
#external <atom> [ : <body> ].
Embedded scripts allow for flexible grounding and solving control
#script(python | lua) . . . main(prg) . . . #end.
Instantiation triggered by passing subprogram names plus arguments
prg.ground([("base", []), ("task", [step])])
Ground program parts constitute modules (with disjoint head atoms)
Search for stable models of ground program parts stored by solver
prg.solve(), prg.solve(on model = pretty print), . . .
Incremental and/or reactive ASP solving via “i/oClingo” scripts
#include <iclingo>.
prg.add("request1", [], "request(2,1,1).")
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 18 / 20
74. (More) Control
Custom ASP Solving
Encoding consisting of named and parameterizable subprograms
#program base. (default), #program cumulative(t)., . . .
External (yet undefined) atoms provide input interface to other parts
#external <atom> [ : <body> ].
Embedded scripts allow for flexible grounding and solving control
#script(python | lua) . . . main(prg) . . . #end.
Instantiation triggered by passing subprogram names plus arguments
prg.ground([("base", []), ("task", [step])])
Ground program parts constitute modules (with disjoint head atoms)
Search for stable models of ground program parts stored by solver
prg.solve(), prg.solve(on model = pretty print), . . .
Incremental and/or reactive ASP solving via “i/oClingo” scripts
#include <iclingo>.
prg.add("request1", [], "request(2,1,1).")
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 18 / 20
75. (More) Control
Custom ASP Solving
Encoding consisting of named and parameterizable subprograms
#program base. (default), #program cumulative(t)., . . .
External (yet undefined) atoms provide input interface to other parts
#external <atom> [ : <body> ].
Embedded scripts allow for flexible grounding and solving control
#script(python | lua) . . . main(prg) . . . #end.
Instantiation triggered by passing subprogram names plus arguments
prg.ground([("base", []), ("task", [step])])
Ground program parts constitute modules (with disjoint head atoms)
Search for stable models of ground program parts stored by solver
prg.solve(), prg.solve(on model = pretty print), . . .
Incremental and/or reactive ASP solving via “i/oClingo” scripts
#include <iclingo>.
prg.add("request1", [], "request(2,1,1).")
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 18 / 20
77. Summary
Summary
ASP as an under-the-hood technology !
Clingo 4
Multi-shot ASP solving
Continuously changing programs
Opens up new areas of applications
Agents
Policies
Planning
Robotics
Interaction
Theory solving
Query-answering
. . .
http://potassco.sourceforge.net
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 20 / 20
78. Summary
Summary
ASP as an under-the-hood technology !
Clingo 4
Multi-shot ASP solving
Continuously changing programs
Opens up new areas of applications
Agents
Policies
Planning
Robotics
Interaction
Theory solving
Query-answering
. . .
http://potassco.sourceforge.net
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 20 / 20
79. Summary
Summary
ASP as an under-the-hood technology !
Clingo 4
Multi-shot ASP solving
Continuously changing programs
Opens up new areas of applications
Agents
Policies
Planning
Robotics
Interaction
Theory solving
Query-answering
. . .
http://potassco.sourceforge.net
M. Gebser, R. Kaminski, B. Kaufmann, T. Schaub Clingo = ASP + Control 20 / 20