Artificial Intelligence By Example
上QQ阅读APP看书,第一时间看更新

Using the McCulloch-Pitts neuron 

The mathematical aspect relies on finding a model for inputs for huge volumes in a corporate warehouse.

In one mode, the inputs can be described as follows:

  • Thousands of forecast product arrivals with a low priority weight: w1 = 10
  • Thousands of confirmed arrivals with a high priority weight: w2 = 70
  • Thousands of unplanned arrivals decided by the sales department: w3 = 75
  • Thousands of forecasts with a high priority weight: w4 = 60
  • Thousands of confirmed arrivals that have a low turnover and so have a low weight: w5 = 20

These weights represent vector w:

All of these products have to be stored in optimal locations, and the distance between nearly 100 docks and thousands of locations in the warehouse for the AGV has to be minimized.

Let's focus on our neuron. Only these weights will be used, though a system such as this one will add up to more than 50 weights and parameters per neuron.

In the first chapter, the reward matrix was size 6x6. Six locations were described (A to F), and now six locations (l1 to l6) will be represented in a warehouse.

A 6x6 reward matrix represents the target of the McCulloch-Pitts layer implemented for the six locations.

Also, this matrix was the input in the first chapter. In real life, and in real companies, you will have to find a way to build datasets from scratch. The reward matrix becomes the output of this part of the process. The following source code shows the input of the reinforcement learning program used in the first chapter. The goal of this chapter describes how to produce the following reward matrix.

# R is The Reward Matrix for each location in a warehouse (or any other problem)
R = ql.matrix([ [0,0,0,0,1,0],
[0,0,0,1,0,1],
[0,0,100,1,0,0],
[0,1,1,0,1,0],
[1,0,0,1,0,0],
[0,1,0,0,0,0] ])

For this warehouse problem, the McCulloch-Pitts neuron sums up the weights of the priority vector described previously to fill in the reward matrix.

Each location will require its neuron, with its weights.

  • Inputs are the flows in a warehouse or any form of data
  • Weights will be defined in this model 
  • Bias is for stabilizing the weights
  • Values will be the output

There are as many ways as you can imagine to create reward matrices. This chapter describes one way of doing it that works.