Dynamic Solver location allocation problem


layout: POST
title: location allocation algorithm based on dynamic programming
subtitle: picking path length using optimized arrival of people picking the warehouse location assignment
DATE: 2020-01-15
author: ZS
header-img: img / POST-BG web.jpg--ios9
Cataog: to true
Tags:
- Dynamic Program
- Mathimatics-Numerical algorithms
- Schedule

Use picking path length to optimize the arrival of people picking the warehouse location assignment

Our readers Hello everyone, ZS today to share the use of dynamic programming algorithm to solve the allocation problem locations. The main idea comes from the paper: Exact route-length formulas and a storage location assignment heuristic for picker-to-parts warehouses. Dynamic programming algorithm has always been of people are scratching their heads algorithm, small series just started writing this program, when really wrote collapse, but to always believe the socialist core values, as long as the ideology is not landslide, you can stroke along ideas! Closer to home, on!

Typical examples of dynamic programming algorithm

1 dynamic plans for the Shortest Path
The core idea of dynamic programming algorithm for the original problem is solved by the sub-optimal solutions optimal solutions. , The shortest path from A to D, if A is known from the Pac1 C1 shortest path, the shortest path from A to the PAC2 C2, C3 from A to PAC3 shortest path from A to shortest C4 shown in Fig. 1 path Pac4. Then the shortest path from A to D is min {Pac1 + C1D, Pac2 + C2D, Pac3 + C3D, Pac4 + C4D}
so move forward step by step, the shortest path can be calculated.

Introduction location allocation problem

Figure 2 warehouse layout
2, the shelf on both sides of the longitudinal channel, for inventory. Two channels connecting the front and rear transverse shelf. Symmetrical about the longitudinal channel shelf, carry in and out indiscriminately, that the two belong to the same column.

Simplified

  •   按需求频率由大到小将货物分为A,B,C三类。(需求频率:给定订单,需要各类货物的占比)
    
  • 货物数目和库位数目相等。各类货物总数一定。
    

purpose

  • Each location matching the type of goods and reasonable

Probability Hypothesis

  • Given the probability of picking orders are equal picking each A, B, C empathy.
  • Each cargo has a certain probability of being chosen to assign the goods to the location, it will determine the probability of picking somewhere. pij this algorithm is more crucial variables.
  • Distribution of goods in the warehouse optimization problem ------ >>>> probability of picking warehouse distribution problems

Evaluation - picking average path length

3 to return to Formula picking strategy, for example (a total of four kinds)

Figure 4 objective function
Figure 4 Figure 3 routing policy in, for example, to solve a given a probability distribution, the average path length of the picking, as the objective function, the optimization class distribution warehouse goods.

Dynamic Solver location allocation problem

In warehouse 4 × 4 pattern, A, B dynamic programming algorithm described two kinds of goods:
with v [m] [na] [ nb] represent sub-problems, the goods na, nb m assigned before channels.

5 Dynamic Solver location allocation problem

/*
		动态规划算法的伪代码
*/
for i←0 to all
      for j←0 to all-i
            k←all-i-j
            if   i,j,k 不符合约束条件 
                 then continue
             culum cu(i,j,k)
            cu.Sofar_length←某较大的数
            for o←0 to all_last
	for p←0 to all_last-o
	      q←all_last-o-p
	      if  o,p,q 不符合约束条件 
	           then continue
  	      计算 zi
	      culum cu(zi)
	     cu.计算转化成本
	     if  转换成本+v[m-1][o][p]<cu.Sofar_length
                            更新 cu
v[m][i][j]←cu

Code

/************************动态规划算法的核心*************************************************************/
 void calcul::doDP(vector<answer> *ans)
{
	culum ***v;
	v=new culum **[M];	
	for(int m=0;m<M;m++)
	{	
		if(m==0)
		{
			int all=N;
			v[0]=new culum * [all+1];
			for(int i=0;i<=all;i++)
				{
					 v[0][i]=new culum[all-i+1];
					for(int j=0;j<=all-i;j++)		
					{
						int k=all-i-j;
						if(calcul::panduan(i,j,k))//判断是否满足各类数目小于总货物数
							continue;
						culum cu; 

						cu.calcul_cost(1,i,j,k,i,j,k); // 第一批i,j,k到某通道用到的货物个数统计,第二批ijk该通道货物数统计
				
						cu.set_lastABC(0,0,0);

						cu.Sofar_length=cu.get_cost();
						v[m][i][j]=cu;
					}
				}
		}		
		else if(m!=(M-1)) //不是最后一个通道也不是第一个通道的情况 
		{
			int all=N*(m+1);
			v[m]=new culum *[all+1];
			for(int i=0;i<=all;i++)
				{
					v[m][i]=new culum[all-i+1];
					for(int j=0;j<=all-i;j++)		
					{
						int k=all-i-j;
						if(calcul::panduan(i,j,k)) //判断是否满足各类数目小于总货物数
							continue;					
						int all_last=N*m;
						
						culum cu;
						culum cu_temp; 

						cu.Sofar_length=9999;
						//穷举前一个通道所有状态解,就是查询数组,并且和本阶段的状态结合,取最优
						for(int o=0;o<=all_last;o++)//穷举上一个通道解的状态
							{
								for(int p=0;p<=all_last-o;p++)
								{	
									int q=all_last-o-p;
									if(calcul::panduan(o,p,q)) //判断是否满足各类数目小于总货物数
										continue;
									int ma=i-o; 	// (i-o) m通道a个数 
									int mb=j-p;		//(j-p)  m通道b个数
									int mc=k-q;  	//(all-i-j)-(all_last-o-p)  m通道c个数
									if((ma<0)||(mb<0)||(mc<0)) //m通道不可行  但是没有用最优化条件
										continue;	
									if((ma+mb+mc)!=N)  //这一项是必须的 保证ma(或者mb,mc)不超过N
										continue;  //只有加和为N才能继续运行 否则跳转
									int lastI=o-v[m-1][o][p].lastA;
									int lastJ=p-v[m-1][o][p].lastB;
								//	int lastK=q-v[m-1][o][p].lastC;
									if(ma>lastI||(ma+mb)>(lastI+lastJ)) //最优化条件,条件要搞清楚
										continue;	
								
									cu_temp=v[0][ma][mb]; //单个通道的库位分配 只有库位分配 ELi enterprob有价值
								
									cu_temp.calcul_cost(m+1,i,j,k); //计算lastprob,Elc,以及cost 
								
								
									if(v[m-1][o][p].Sofar_length+cu_temp.get_cost()<cu.Sofar_length)
									{
										cu=cu_temp; //除了Sofar_length和 lastABC都已经更新完毕

										cu.Sofar_length=v[m-1][o][p].Sofar_length+cu.get_cost();

										cu.set_lastABC(o,p,q);//cu.lastA=o;cu.lastB=p;cu.lastC=q;									
									//这里m=2~M-2是第3~M-1通道 ,o p 是状态(m,i,j)的上一状态最优解
									}														
								}

							}

						v[m][i][j]=cu;						
					}
				}
		
		}
		else //对应最后一个通道情况 m=M-1时
		{
			int i=overall_A;
			int j=overall_B;
			int k=overall_C;
			v[m]=new culum *[1];
			v[m][0]=new culum[1];

			int all_last=N*m;	
			
			culum cu; //1 代表通道号
			cu.Sofar_length=9999;
			culum cu_temp; 
			//穷举前一个通道所有状态解,就是查询数组,并且和本阶段的状态结合,取最优
			for(int o=0;o<=all_last;o++)//穷举上一个通道解的状态
				{
				for(int p=0;p<=all_last-o;p++)
					{	
						int q=all_last-o-p;
						if(calcul::panduan(o,p,q)) //判断是否满足各类数目小于总货物数
							continue;
						int ma=i-o; 	// (i-o) m通道a个数 
						int mb=j-p;		//(j-p)  m通道b个数
						int mc=k-q;  	//(all-i-j)-(all_last-o-p)  m通道c个数	
						if((ma+mb+mc)!=N)
							continue;
						if(ma<0||mb<0||mc<0) //m通道不可行  但是没有用最优化条件
							continue;				
						int lastI=o-v[m-1][o][p].lastA;
						int lastJ=p-v[m-1][o][p].lastB;
					//	int lastK=q-v[m-1][o][p].lastC;
						if(ma>lastI||(ma+mb)>(lastI+lastJ)) //最优化条件
							continue;					
																
						cu_temp=v[0][ma][mb];

						cu_temp.calcul_cost(m+1,i,j,k);
					
						if(v[m-1][o][p].Sofar_length+cu_temp.get_cost()<cu.Sofar_length)
						{
							cu=cu_temp;
							cu.Sofar_length=v[m-1][o][p].Sofar_length+cu.get_cost();
							cu.set_lastABC(o,p,q);//cu.lastA=o;cu.lastB=p;cu.lastC=q;			
							//这里m=2~M-2是第3~M-1通道 所以 o p 是状态(m,i,j)的第一个通道最优解				
						}	
									
					}
				}
			v[m][0][0]=cu;						
		}
	}

Experimental results

Example 6 FIG input data

Output data of Example 7

In Figure 7 each row represents a channel warehouse. Column 1 is the channel number, 2,3,4 column is the number of types of cargo, the last one is the evaluation value.

references

[1]Arjan S. Dijkstra,Kees Jan Roodbergen. Exact route-length formulas and a storage location assignment heuristic for picker-to-parts warehouses[J]. Transportation Research Part E,2017,102.

Published an original article · won praise 0 · Views 12

Guess you like

Origin blog.csdn.net/weixin_40300702/article/details/104696224