Showing posts with label Book. Show all posts
Showing posts with label Book. Show all posts

Thursday, April 2, 2020

On the importance of well-written error messages

This is funny:
"I also tried to get Fortran programs running on Imperial's IBM 7010, since I sort of knew Fortran, certainly better than I knew Cobol, and Fortran would have been better suited for data analysis. It was only after weeks of fighting JCL, IBM's Job Control Language, that I deduced that there was no Fortran compiler on the 7010, but the JCL error messages were so inscrutable that no one else had figured that out either." [1]

Indeed, even today error messages are often poorly formulated and leaving users in the dark.

IBM 7010


References

  1. Brian Kernighan, UNIX, A History and a Memoir, 2020. 

Tuesday, December 3, 2019

Opt Art



New book by TSP and Domino art creator Robert Bosch [1].

Content:

  1. Optimization and the Visual Arts?
  2. Truchet Tiles
  3. Linear Optimization and the Lego Problem
  4. The Linear Assignment problem and Cartoon Mosaics
  5. Domino Mosaics
  6. From the TSP to Continuous Line Drawings
  7. TSP Art with Side Constraints
  8. Knight's Tours
  9. Labyrinth Design with Tiling and Pattern Matching
  10. Mosaics with Side Constraints
  11. Game-of-life Mosaics
Yes, it contains color pictures.

TSP Art


An example of a TSP drawing (from [2]):

25,000-city TSPortrait of George Dantzig [2,3]
Original fotograph


I guess more cities are needed to prevent his teeth from disappearing.


Domino Art


You can submit your picture and create a domino mosaic through NEOS [4].  I tried this with the Dantzig picture. With a "high quality" output image this creates a large model:

Reduced MIP has 13915 rows, 1511565 columns, and 4534695 nonzeros.
Reduced MIP has 1511565 binaries, 0 generals, 0 SOSs, and 0 indicators.

This is not small at all. Although the model is large, it is easy to solve. It only took 11 nodes (most of the work was in the root node). The model is an assignment problem with side constraints [5]. Basically the costs are the difference in gray scale value between the picture and the domino piece for each cell. The constraints are: exactly one domino in each cell and place all dominos. NEOS solves this by processing the picture in Matlab and then solving the model with GAMS/CPLEX. The output PNG file is also notably large: 2.8 MB. Too large to include in this blog. A screen grab looks like:

Screen capture of hi-res image

After zooming in we see indeed the dominos:

Zooming in

With some effort we can recognize part of the frame of the eye glasses here.

References

Tuesday, July 30, 2019

Advanced R (second edition)


The second edition is out. My version has color pictures (so it must be good!). This book is about the R programming language (not about statistical techniques). Even if you know R really well, you will learn from this book. Hadley Wickham is the author of many extremely useful R packages including ggplot.

Contents


  1. Introduction

    I Foundation
  2. Names and values
  3. Vectors
  4. Subsetting
  5. Control flow
  6. Functions
  7. Environments
  8. Conditions

    II Functional Programming
  9. Functionals
  10. Function factories
  11. Function operators

    III Object-oriented Programming
  12. Base types
  13. S3
  14. R6
  15. S4
  16. Trade-offs

    IV Metaprogramming
  17. Big picture
  18. Expressions
  19. Quasiquotation
  20. Evaluation
  21. Translating R code

    V Techniques
  22. Debugging
  23. Measuring performance
  24. Improving performance
  25. Rewriting R code in C++

References


  1. https://adv-r.hadley.nz/  Online version of book
  2. https://github.com/hadley/adv-r The source code for the book. The book is written in bookdown.
  3. https://bookdown.org/