Saturday 27 October 2018

TravelTimeCalculator: Creating a Google Directions Request

After adding a button on the Google Maps view, I've added a listener to it that fetches the center coordinate for the view (cameraTarget).



If those coordinates are available, the app will build a string that will query the Google Directions API for biking between two coordinates:

https://maps.googleapis.com/maps/api/directions/json?origin=55.59,13.019&destination=55.6,13.019&mode=bicycling&key=<MY_API_KEY>

After typing the string into a web browser, I get:

In the next blog post, I'll send the request from the app and analyze the result string.

Saturday 20 October 2018

TrafficControl: Implementing Speed Calculation

I've created a flowchart that shows how the train selects what speed to set.

Some methods needs to be implemented:

  • track::getFreeDistance(int trainID) - This will check the free distance for trainID. If the train isn't on that track, the function shall return 0.  


Saturday 13 October 2018

TravelTimeCalculator: Adding Project to Github

After being able to add a numb button to the user interface, I've decided to add the project to my Github account: https://github.com/cutetrains/TravelTimeCalculator

Since I'm in a learning curve in Android design, the quality of the code and design of this app will be quite low. If you're looking for some advice from Android gurus, refer to the documentation or any of the thousands more skilled developers.

The app sets up a Google maps view with a button on top of that. (TODO: Move the button to the lower right of the view so that the user can press the button with the hand that holds the device)



When opening the app, the app fetches the last known location (TODO: Fetch also the current location, in case the phone has no last known location) and prints it to logcat. It also proposes eight other coordinates that surround the device.

If the user taps the button, there is code that reacts to that. Currently, it just prints a logcat message, but I'll make the app print the center coordinates of the map view and the zoom factor to logcat.

Saturday 6 October 2018

Book Review: Artificial Intelligence: A Modern Approach

The third book that I read about Artificial intelligence is a rather academic one, written by Stuart Russell and Peter Norvig.

With more than a thousand pages, it is too heavy for an introduction to the field. It is more suitable for people looking for an academic, or theoretical research of the AI field.

The book focuses quite much on information theory, searching, representation of knowledge and how to handle uncertainties. All those subjects are interesting, but all the theory in the first 850 pages feel a bit overwhelming.

The interesting chapters are in the end (natural language, image perception, robotics and the road ahead).

If I'd have more time to spend reading the book (I'm on a parental leave now and the book loan is four weeks only), I would have given it more time. Now, I skipped 3/4 of the book. That is more related to my personal situation than the qualities of the book.

I think that a combination of the two other books that I've written about will give a good introduction to the AI field.

One Sidenote
There is one aspect of AI that I've been thinking above that I don't see in the books: We, the humans. In many cases we don't know, or we don't admit what goals we want to pursue. Often the goals, or the focus changes quickly, and we often choose actions that will prevent the goals.

For example, the overall goal with customer support centres is to resolve the end users issues. When KPIs are introduced to monitor the efficiency (often defined as time to resolve tickets), the agents have incentives to close tickets before the issue is solved, forcing the end user to call another agent and describe the problem again. If we request an AI to target several conflicting goals, we will see very... interesting results.

I've also seen cases where policymakers want to dodge responsibility for their decicions by forcing their own agencies to make cruel decisions. When the decisions are critizised, the policymakers can blame the agency.

On the other hand, when defining utility functions and their relative priority and preferences, hopefully a clever AI system, or its designers will be able to confront the customer and make them make up their mind.