DingJianpeng
Published

The Most Reasonable Elevator Scheduling Strategy Based on AI

Identify the elevator environment through the algorithm of artificial intelligence to achieve the most reasonable scheduling strategy.

AdvancedWork in progress60 days715
The Most Reasonable Elevator Scheduling Strategy Based on AI

Things used in this project

Hardware components

Thundercomm AI Kit
ThunderSoft Thundercomm AI Kit
×1

Story

Read more

Schematics

Elevator scheduling

Elevator scheduling

Code

Elevator scheduling

Java
calculate the elevator load
public class ElevatorScheduling {
	
	private static int[] valueSort(int[] a,int N,int n)
	{
		int[] res=new int[n];
		int k=0;
		for(int i=0;i<=N;i++)
		{
			int temp=a[i];
			while(temp>0)
			{
				res[k++]=a[i];
			}
		}
		return res;
	}
	
 
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int n=sc.nextInt();
		int passenger[]=new int[N+1];
		for(int i=0;i<n;i++)
		{
			passenger[sc.nextInt()]+=1;
		}
		sc.close();
		int[] res=valueSort(passenger,N,n);
		int stopFloor=res[(n+1)/2-1];
		int nMinFloor=0;
		for(int i=1;i<=N;i++)
		{
			nMinFloor+=(i-stopFloor)*passenger[i];
		}
}

Credits

DingJianpeng
1 project • 0 followers

Comments