Technical Paper – Intelligent MRP

Fuzzy Rule-Based Finite Capacity Planning Implementation of MRP for Discrete Manufacturing Environments

Corresponding Author : Buddhika Kurera (bckurera@geneai.edu.lk)

Abstract – Discrete Manufacturing is a term commonly used to identify manufacturing processes which produce items that can be counted, tracked as units. One of the common challenges in manufacturing industry is the production planning. As a result, many methods have been invented over the years to solve the planning problem optimizing the schedules. In such methods Material Requirement Planning plays a major role as it calculates the demand and supply beforehand. However, the fact of ignorance of capacity constraints in classical MRP to simplify the problem, leads to undesirable outputs when it comes to real-life scenarios as assumptions fails. The main issue in finite capacity planning approach is the complexity of the problem. As the number of variables and constraints grow, the complexity of the MRP calculation increases exponentially. In this research the main focus is to implement an effective mechanism to manage the problem. For the purpose, a fuzzy rule-based approach has been studied. Fuzzy logic is not a strange concept in scheduling. In fact, when data is not certain, usage of fuzzy logic would be an excellent choice. However, in this research fuzzy logic has been used to improve the efficiency, hence reducing the complexity of the problem. A model has been proposed to achieve the objective. Simulations based on numerical analysis have been carried out to fine tune the model based on benchmark problems afterwards.

Keywords: Discrete Manufacturing, Material Requirement Planning, MRP, Fuzzy rule-base, Fuzzy

Happy Women’s Day 2018

Today is reserved for celebrating the most complicated object that God had ever created aka the woman. HAPPY WOMEN’S DAY !!!!

Vectors in C++

Vectors in C++ is an interesting data structure which is bit similar to arrays. Not having a fixed size is the main difference though. The vector class is in C++ std namespace.

Vectors are associated with some useful methods which are handy in controlling vectors. Refer to the guide for more info.

Method push_back( ) to be used to add elements to a vector. Accessing an element can be done through accessing the relevant index as in arrays. size( ) gives the number of elements in a vector.

Defining a Vector

Creating an instance of the vector class.

#include <iostream>
#include <vector>

using namespace std;

int main()
{
vector<string> names;

cout << "Size of the vector : " << names.size() << endl;
return 0;
}

Assign Values to a Vector

#include <iostream>
#include <vector>

using namespace std;

int main()
{
vector<string> names;
names.push_back("Alex");
names.push_back("Bob");

cout << "Size of the vector :" << names.size() << endl;
cout << "First Name :" << names << endl;

names = "Alex the great";

cout << "First Name :" << names << endl;

return 0;
}

Example

Here is an example on how vectors can be used to solve a problem.

Write a function that accepts an upper bound positive integer and then calculate all the prime numbers within the given integer (excluding). Prime number set should starts with 2 in the index = 0.

#include <iostream>
#include <vector>

using namespace std;

vector<int> get_primes(int num);
bool is_prime(int num);

int main()
{
vector<int> output;
output = get_primes(20);

for(int j=0; j < output.size(); j++){
cout << "Prime No at index - " << j << " = " << output[j] << endl;
}

return 0;
}

vector<int> get_primes(int limit){
vector<int> primes;
for(int i = 2; i < limit; i++){
if(is_prime(i)){
primes.push_back(i);
}
}
return primes;
}

bool is_prime(int num){
for(int i = 2; i<num; i++){
int r = num % i;
if(r ==0){
return false;
}
}
return true;
}

Output

Prime No at index - 0 = 2
Prime No at index - 1 = 3
Prime No at index - 2 = 5
Prime No at index - 3 = 7
Prime No at index - 4 = 11
Prime No at index - 5 = 13
Prime No at index - 6 = 17
Prime No at index - 7 = 19

The code is self-explanatory. Notice how vectors are used in methods. Assigning values and accessing the indexes.

Coding Challenge #1 – Sum of multiples

Here is a little coding challenge to try.

The objective is to find the sum of multiples within a given range.

For example assume that given multiples are 4, 5 and 7. The upper limit is 20 (excluding). Multiples of 4 within 20 are 4, 8, 12 and 16. Then multiples of 5 within 20 are 5, 10 and 15. The multiples of 7 within 20 are 7 and 14. The objective is to find the sum of all those numbers.

The upper limit and the number of multiples can be vary from problem to problem.

Solution in Cpp

#include <iostream>

using namespace std;

int isMult(int mult[], int n, int length);

int main () {
int no_of_mult = 2;
int multiSet[no_of_mult] = {3, 5};
int upper_limit = 10;

int sum = 0;
for (int i=0; i &lt; upper_limit; i++){
sum = sum + isMult(multiSet, i, no_of_mult);
}
cout &lt;&lt; "Sum = " &lt;&lt; sum;
}

int isMult(int mult[], int n, int length){
for(int i =0; i &lt; length; i++){
int r = n % mult[i];
if(r == 0){
return n;
}
}
return 0;
}

Try it online http://tpcg.io/ujmQDD

Finding nth prime number – JavaScript

Recently one of my friends mentioned a coding problem where the 1001th prime needs to be found out. Out of many ways to achieve the answer, I used the elimination method which probably you would have used in the elementary school. Formally, this method is known as Sieve of Eratosthenes. When the position of the prime needs to be found out this approach is pretty simple and straightforward.

Following is how the problem is solved:

The 1001th prime is 7927
The source code can be used to find out any nth prime.

However the time efficiency of this algorithm is in order of n! which means for higher upper limit, this method is extremely slower.

Check the code which is self explanatory.

class prime{
constructor(){
}

getPrimes(limit){
let arr = this.createList(limit);
let primes = this.savePrimes(arr);
return primes;
}

createList(max){
let numberList = [];
for (let i=2; i<=max; i++) {
numberList.push(i);
}
return numberList;
}

savePrimes(numArr){
let i, j;
for (i=0; i < numArr.length; i++){
let x = numArr[i];
for (j=i+1; j < numArr.length; j++ ){
let y = numArr[j];
let r = y%x;
if(r==0){
numArr[j] = null;
}
}
numArr = this.removeZeros(numArr);
}
return numArr;
}

removeZeros(numArr){
let newArr = [];
for (let x in numArr){
let e = numArr[x];
if(e!=null){
newArr.push(e);
}
}
return newArr;
}
}

let obj = new prime();
let primeNumbers = obj.getPrimes(10000);

New Approach to Solve Dynamic Job Shop Scheduling Problem Using Genetic Algorithm

This paper has been presented in 3rd International Conference on Information Technology Research held in Colombo on 2018 December 06th.

New Approach to Solve Dynamic Job Shop Scheduling Problem Using Genetic Algorithm

Authors : Chandradeepa Kurera, Palitha Dasanayake

Session Chair : Prof. Chan-Yun Yang

Abstract— Job Shop Scheduling Problem (JSSP) is one of the most common problems in manufacturing due to its widespread application and the usability across the manufacturing industry. Due to the vast solution space the JSSP problem deals with, it is impossible to apply brute force search techniques to obtain an optimal solution. In this research, Genetic Algorithm (GA) approach, which is another widely used nonlinear optimization technique, has been used to propose a solution using a novel chromosome representation which makes seeking solutions for the Dynamic JSSP more efficient. Due to operation order criteria of the jobs and the machine allocation requirement on machines, generating solutions for JSSP needs an extra effort to eliminate infeasible solutions. Due to level of the complexity with added constraints, there is a high tendency to get more infeasible solutions than feasible solutions. This results in consuming a lot of computing resources to correct such a conventional order-based chromosome representation. Due to this, a new representation is proposed in this paper. It is found that the proposed new chromosome representation approach makes it possible to model such dynamic behaviours of schedules without compromising the performances of GA.

Keywords— Genetic Algorithm, Job Shop Scheduling Problem, Dynamic Job Shop Scheduling Problem

Corresponding Author – bckurera AT gmail DOT com

Conference Web Site – http://www.icitr.mrt.ac.lk/

Working with Dictionaries – JSON in Python

In Python, Dictionary is a data structure in which data is indexed by the key value. Therefore in order to access it’s data members the key value is required. When converting data to JSON it is ideal to use dictionary as JSON format support the key-index and value pairing format. In this post, it is mentioned how to achieve dictionary to JSON and JSON to dictionary conversion.

Dictionary

A structure of a simple dictionary is as follow:

sample_dictionary = {'key-1' : 'value-1', 'key-2' : 'value-2' }

There is a function named dict( ) which can be used to create a dictionary.

JSON library

In Python, JSON library is readily available. Main two methods we are using are dumps and loads.

.dumps()

Converts a data structure in this case a dictionary to a JSON string.

This method can be used to convert a JSON string to a dictionary data structure so that it can be accessed within the code using key-values of the indexes.

Study the following example, a dictionary is defined with few levels, termed as nested dictionary. Data of a Tennis match is arranged.

import json

match = {
'match-name' : 'USA F35 Futures',
'match-general-info' :
{'match-date' : '2018.12.04', 'match-time' : '22:30', 'match-place' : 'Tallahassee'},
'player-A' :
{'name' : 'Random Name A', 'age' : 20,
'rankings' : {'local' : 4, 'ITF' : 17, 'results' :
{'winner': 35, 'runner-up': 20, 'break-down' :
{'semi' : 10, 'quarter' : 4, 'R16' : 1}
}
}
}
}

json_string = json.dumps(match,0)

print ('Data Set in JSON format \n' + json_string)