Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a scheduling algorithm like (PSO, ABC ) in ifogsim #7

Open
FWHDeveloper opened this issue Sep 18, 2018 · 32 comments
Open

Add a scheduling algorithm like (PSO, ABC ) in ifogsim #7

FWHDeveloper opened this issue Sep 18, 2018 · 32 comments

Comments

@FWHDeveloper
Copy link

Please where can I add a scheduling algorithm in ifogsim

@Irfan508
Copy link

You should extend the ModulePlacement class.
The existing scheduling algorithm is given in ModulePlacementEdgewards.java

@sujannou
Copy link

sujannou commented Jun 9, 2020

Dear Irfan508
Could you please share on which method of ModulePlacementEdgewards.java/ModulePlacement.java class is scheduling algorithm implemented and which scheduling algorithm is implemented in the default?

@Irfan508
Copy link

@sujannou
U may either extend the ModulePlacement class and write the code from scratch
or you can choose to modify the _placeModulesInPath(path)_function only
By default the AppModules are placed on the fog device with lowest transmission delay

@sujannou
Copy link

Thanks Irfan508 for your valuable comments.

@sujannou
Copy link

sujannou commented Jun 11, 2020

@Irfan508 , which parameter shows any AppModules have the lowest transmission delay?
I am still not clear, which scheduling algorithm is used by default? Is it FCFS, SJF, or other.
The codes in "placeModulesInPath" method are as follow;
private void placeModulesInPath(List path) {
if(path.size()==0)return;
List placedModules = new ArrayList();
Map<AppEdge, Double> appEdgeToRate = new HashMap<AppEdge, Double>();

	/**
	 * Periodic edges have a fixed periodicity of tuples, so setting the tuple rate beforehand
	 */
	for(AppEdge edge : getApplication().getEdges()){
		if(edge.isPeriodic()){
			appEdgeToRate.put(edge, 1/edge.getPeriodicity());
		}
	}
	
	for(Integer deviceId : path){
		FogDevice device = getFogDeviceById(deviceId);
		Map<String, Integer> sensorsAssociated = getAssociatedSensors(device);
		Map<String, Integer> actuatorsAssociated = getAssociatedActuators(device);
		placedModules.addAll(sensorsAssociated.keySet()); // ADDING ALL SENSORS TO PLACED LIST
		placedModules.addAll(actuatorsAssociated.keySet()); // ADDING ALL ACTUATORS TO PLACED LIST
		
		/*
		 * Setting the rates of application edges emanating from sensors
		 */
		for(String sensor : sensorsAssociated.keySet()){
			for(AppEdge edge : getApplication().getEdges()){
				if(edge.getSource().equals(sensor)){
					appEdgeToRate.put(edge, sensorsAssociated.get(sensor)*getRateOfSensor(sensor));
				}
			}
		}
					
		/*
		 * Updating the AppEdge rates for the entire application based on knowledge so far
		 */
		boolean changed = true;
		while(changed){		//Loop runs as long as some new information is added
			changed=false;
			Map<AppEdge, Double> rateMap = new HashMap<AppEdge, Double>(appEdgeToRate);
			for(AppEdge edge : rateMap.keySet()){
				AppModule destModule = getApplication().getModuleByName(edge.getDestination());
				if(destModule == null)continue;
				Map<Pair<String, String>, SelectivityModel> map = destModule.getSelectivityMap();
				for(Pair<String, String> pair : map.keySet()){
					if(pair.getFirst().equals(edge.getTupleType())){
						double outputRate = appEdgeToRate.get(edge)*map.get(pair).getMeanRate(); // getting mean rate from SelectivityModel
						AppEdge outputEdge = getApplication().getEdgeMap().get(pair.getSecond());
						if(!appEdgeToRate.containsKey(outputEdge) || appEdgeToRate.get(outputEdge)!=outputRate){
							// if some new information is available
							changed = true;
						}
						appEdgeToRate.put(outputEdge, outputRate);
					}
				}
			}
		}
		
		/*
		 * Getting the list of modules ready to be placed on current device on path
		 */
		List<String> modulesToPlace = getModulesToPlace(placedModules);
		
		while(modulesToPlace.size() > 0){ // Loop runs until all modules in modulesToPlace are deployed in the path
			String moduleName = modulesToPlace.get(0);
			double totalCpuLoad = 0;
			
			//IF MODULE IS ALREADY PLACED UPSTREAM, THEN UPDATE THE EXISTING MODULE
			int upsteamDeviceId = isPlacedUpstream(moduleName, path);
			if(upsteamDeviceId > 0){
				if(upsteamDeviceId==deviceId){
					placedModules.add(moduleName);
					modulesToPlace = getModulesToPlace(placedModules);
					
					// NOW THE MODULE TO PLACE IS IN THE CURRENT DEVICE. CHECK IF THE NODE CAN SUSTAIN THE MODULE
					for(AppEdge edge : getApplication().getEdges()){		// take all incoming edges
						if(edge.getDestination().equals(moduleName)){
							double rate = appEdgeToRate.get(edge);
							totalCpuLoad += rate*edge.getTupleCpuLength();
						}
					}
					if(totalCpuLoad + getCurrentCpuLoad().get(deviceId) > device.getHost().getTotalMips()){
						Logger.debug("ModulePlacementEdgeward", "Need to shift module "+moduleName+" upstream from device " + device.getName());
						List<String> _placedOperators = shiftModuleNorth(moduleName, totalCpuLoad, deviceId, modulesToPlace);
						for(String placedOperator : _placedOperators){
							if(!placedModules.contains(placedOperator))
								placedModules.add(placedOperator);
						}
					} else{
						placedModules.add(moduleName);
						getCurrentCpuLoad().put(deviceId, getCurrentCpuLoad().get(deviceId)+totalCpuLoad);
						getCurrentModuleInstanceNum().get(deviceId).put(moduleName, getCurrentModuleInstanceNum().get(deviceId).get(moduleName)+1);
						Logger.debug("ModulePlacementEdgeward", "AppModule "+moduleName+" can be created on device "+device.getName());
					}
				}
			}else{
				// FINDING OUT WHETHER PLACEMENT OF OPERATOR ON DEVICE IS POSSIBLE
				for(AppEdge edge : getApplication().getEdges()){		// take all incoming edges
					if(edge.getDestination().equals(moduleName)){
						double rate = appEdgeToRate.get(edge);
						totalCpuLoad += rate*edge.getTupleCpuLength();
					}
				}
					
				if(totalCpuLoad + getCurrentCpuLoad().get(deviceId) > device.getHost().getTotalMips()){
					Logger.debug("ModulePlacementEdgeward", "Placement of operator "+moduleName+ "NOT POSSIBLE on device "+device.getName());
				}
				else{
					Logger.debug("ModulePlacementEdgeward", "Placement of operator "+moduleName+ " on device "+device.getName() + " successful.");
					getCurrentCpuLoad().put(deviceId, totalCpuLoad + getCurrentCpuLoad().get(deviceId));
					System.out.println("Placement of operator "+moduleName+ " on device "+device.getName() + " successful.");

					if(!currentModuleMap.containsKey(deviceId))
						currentModuleMap.put(deviceId, new ArrayList<String>());
					currentModuleMap.get(deviceId).add(moduleName);
					placedModules.add(moduleName);
					modulesToPlace = getModulesToPlace(placedModules);
					getCurrentModuleLoadMap().get(device.getId()).put(moduleName, totalCpuLoad);
					
					int max = 1;
					for(AppEdge edge : getApplication().getEdges()){
						if(edge.getSource().equals(moduleName) && actuatorsAssociated.containsKey(edge.getDestination()))
							max = Math.max(actuatorsAssociated.get(edge.getDestination()), max);
						if(edge.getDestination().equals(moduleName) && sensorsAssociated.containsKey(edge.getSource()))
							max = Math.max(sensorsAssociated.get(edge.getSource()), max);
					}
					getCurrentModuleInstanceNum().get(deviceId).put(moduleName, max);
				}
			}
		
		
			modulesToPlace.remove(moduleName);
		}
		
	}
	
}

Could you please share with me some codes done/modified in the method "placeModulesInPath(List path)" which used any traditional scheduling algorithms like FCFS, SJF, Round Robbin. My email id is [email protected]. Hope the basic and traditional scheduling algorithms will help me to understand better on working of scheduling algorithms in iFogsim.

@Irfan508
Copy link

I would suggest u go through the base paper of iFogSim again. the default scheduling algorithm is given in the paper.
Also during scheduling, leaf-to-root traversal is followed in network topology, with leaf node having the least transmission delay and root having the maximum delay.

@Irfan508
Copy link

the algorithm implemented in "IrfanEdgewards.java" is given in https://ieeexplore.ieee.org/document/9057799

@syedrizwanhassan
Copy link

@Irfan508

Dear Sir. I have the same issue, can you please send me the code to re-simulate the simulations performed in your above said paper.

[email protected]

Thanks

@rupinder516
Copy link

@Irfan508

I am a student who has been given the assignment to implement the PSO algorithm in iFogSim to reduce latency, energy consumption, and cost. I have read some research papers regarding it but I am still confused and don't know how to proceed. Can you give me a little guidance?

@KrishnanandRai
Copy link

@Irfan508

I am a student who has been given the assignment to implement the PSO algorithm in iFogSim to reduce latency, energy consumption, and cost. I have read some research papers regarding it but I am still confused and don't know how to proceed. Can you give me a little guidance?

@rupinder516
I am also working on same type of idea, if you have any leads please connect with me on following mail id.

[email protected]

@Tauseef-45
Copy link

Done with PSO and ACO in iFogsim, but need firs come first serve policy help

@Shelly1193
Copy link

Done with PSO and ACO in iFogsim, but need firs come first serve policy help

Sir, can you please share the code for PSO and ACO in github.

@0Vipin0
Copy link

0Vipin0 commented May 17, 2021

@Shelly1193 @Tauseef-45 If you are working on the scheduling code, can you please share the code?

@pushkal00
Copy link

Could anyone please help in the implementation of tuple scheduling in ifogsim?

@Shelly1193
Copy link

Shelly1193 commented Jun 1, 2021 via email

@pushkal00
Copy link

No, I haven't received any code related to ifogsim yet

@srinu49
Copy link

srinu49 commented Aug 15, 2021

@Irfan508 Can you please share the code of https://ieeexplore.ieee.org/document/9057799 mentioned link. My email id : [email protected]

@aishajohani
Copy link

Hello @Irfan508 Can you please share me too the code of https://ieeexplore.ieee.org/document/9057799 mentioned link. My email id : [email protected]

@aishajohani
Copy link

Hello @pushkal00 , have you received any code? If so please share me on this email id: [email protected]

@aishajohani
Copy link

Done with PSO and ACO in iFogsim, but need firs come first serve policy help

Hi @Tauseef-45 , can you please share me the code On this email id: [email protected]

@abeerailyas
Copy link

did anyone receive the code? kindly email me too at [email protected]

@Shelly1193
Copy link

Shelly1193 commented Jul 6, 2022 via email

@Shelly1193
Copy link

Shelly1193 commented Jul 6, 2022 via email

@rozaasa
Copy link

rozaasa commented Oct 7, 2022

Can you please share the working code.

@rozaasa
Copy link

rozaasa commented Oct 7, 2022

I would suggest u go through the base paper of iFogSim again. the default scheduling algorithm is given in the paper. Also during scheduling, leaf-to-root traversal is followed in network topology, with leaf node having the least transmission delay and root having the maximum delay.

can you please help me

@rozaasa
Copy link

rozaasa commented Oct 7, 2022

Done with PSO and ACO in iFogsim, but need firs come first serve policy help

can you please help me

@fath004
Copy link

fath004 commented Oct 17, 2022

Done with PSO and ACO in iFogsim, but need firs come first serve policy help

I have no idea why you wrote done with PSO and ACO without helping others and you ask for help. I did ask for PSO code a long time ago and I deleted my comments. FYI I finished SJF , FCFS, and GCN but really I am done with these useless comments. Everyone asks for help and no one wants to help . Do not expect anyone to help you if you do not wanna help others .

@rozaasa
Copy link

rozaasa commented Oct 21, 2022

Done with PSO and ACO in iFogsim, but need firs come first serve policy help

I have no idea why you wrote done with PSO and ACO without helping others and you ask for help. I did ask for PSO code a long time ago and I deleted my comments. FYI I finished SJF , FCFS, and GCN but really I am done with these useless comments. Everyone asks for help and no one wants to help . Do not expect anyone to help you if you do not wanna help others .

please can you help me?

@Shelly1193
Copy link

Shelly1193 commented Oct 21, 2022 via email

@Tauseef-45
Copy link

Tauseef-45 commented Oct 21, 2022 via email

@Yamna2023
Copy link

Hi everyone, can you send me the code please in this mail :
[email protected]

@Yamna2023
Copy link

i need PSO and ACO code please
send me the code please
[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests