Skip to content
Snippets Groups Projects
Commit e08bb3b1 authored by Maxime MORGE's avatar Maxime MORGE :construction_worker:
Browse files

PSSI: XP for consumption

parent edd578a2
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ class ConsumptionCampaign(simulatedCost: SimulatedCost, fromStable: Boolean = fa ...@@ -25,7 +25,7 @@ class ConsumptionCampaign(simulatedCost: SimulatedCost, fromStable: Boolean = fa
val decentralizedDispatcherId = "akka.actor.default-dispatcher" val decentralizedDispatcherId = "akka.actor.default-dispatcher"
val configurations : List[ConsumptionConfiguration] = { // The configurations val configurations : List[ConsumptionConfiguration] = { // The configurations
val numbersOfJobs = List.range(6, 9, 1) // l in [4,5[ val numbersOfJobs = List.range(4, 5, 1) // l in [4,5[
val numbersOfTasks = List.range(40, 320, 40) val numbersOfTasks = List.range(40, 320, 40)
if (byNodes) if (byNodes)
List.tabulate(9)(nbNodes => new ConsumptionConfiguration(8+ nbNodes, 4, 120, Uncorrelated)) List.tabulate(9)(nbNodes => new ConsumptionConfiguration(8+ nbNodes, 4, 120, Uncorrelated))
...@@ -47,7 +47,7 @@ class ConsumptionCampaign(simulatedCost: SimulatedCost, fromStable: Boolean = fa ...@@ -47,7 +47,7 @@ class ConsumptionCampaign(simulatedCost: SimulatedCost, fromStable: Boolean = fa
5 5
} }
private val outcomeWithNegotiation = new DealConsumptionOutcome() private val outcomeWithNegotiation = new DealConsumptionOutcome()
private var outcomeWithoutNegotiation = new NoDealConsumptionOutcome() private var outcomeWithoutNegotiation = new DealConsumptionOutcome()
var consumer : SynchronousDecentralizedConsumer = _ var consumer : SynchronousDecentralizedConsumer = _
...@@ -123,12 +123,11 @@ class ConsumptionCampaign(simulatedCost: SimulatedCost, fromStable: Boolean = fa ...@@ -123,12 +123,11 @@ class ConsumptionCampaign(simulatedCost: SimulatedCost, fromStable: Boolean = fa
val d = 3 // d instances per resource val d = 3 // d instances per resource
val stap = STAP.randomProblem(l, m, n, o, d, configuration.randomGenerationRule) val stap = STAP.randomProblem(l, m, n, o, d, configuration.randomGenerationRule)
for(_ <- 1 to nbAllocations) { // foreach initial allocation for(_ <- 1 to nbAllocations) { // foreach initial allocation
val decentralizedSystem = ActorSystem("AgentBasedConsumer" + AgentBasedConsumer.id) val decentralizedSystem = ActorSystem("DecentralizedSystem1")
AgentBasedConsumer.id += 1 val decentralizedSystem2 = ActorSystem("DecentralizedSystem2")
val decentralizedConsumerSystem = ActorSystem("DecentralizedConsumer" + AgentBasedConsumer.id) val decentralizedSystem3 = ActorSystem("DecentralizedSystem3")
AgentBasedConsumer.id += 1 val decentralizedConsumerSystem = ActorSystem("DecentralizedConsumer")
val decentralizedBalancerSystem = ActorSystem("DecentralizedBalancer" + AgentBasedConsumer.id) val decentralizedBalancerSystem = ActorSystem("DecentralizedBalancer")
AgentBasedConsumer.id += 1
var allocation = ExecutedAllocation.randomAllocation(stap) var allocation = ExecutedAllocation.randomAllocation(stap)
if (fromStable){ if (fromStable){
...@@ -160,15 +159,22 @@ class ConsumptionCampaign(simulatedCost: SimulatedCost, fromStable: Boolean = fa ...@@ -160,15 +159,22 @@ class ConsumptionCampaign(simulatedCost: SimulatedCost, fromStable: Boolean = fa
new NoneSingleCounterProposalStrategy, new NoneSingleCounterProposalStrategy,
decentralizedSystem, name = ConsumerType, dispatcherId = decentralizedDispatcherId, decentralizedSystem, name = ConsumerType, dispatcherId = decentralizedDispatcherId,
false, simulatedCost) false, simulatedCost)
case "PSI" => //TODO case "PSI" =>
new AgentBasedConsumer(stap, new SynchronousDecentralizedConsumer(stap,
GlobalFlowtime, decentralizedSystem2,
//new NoneMultiProposalStrategy, name = "PSI",
new ConcreteMultiProposalStrategy(1000.0), dispatcherId = decentralizedDispatcherId,
None, monitor = false,
new NoneSingleCounterProposalStrategy, ssi = false,
decentralizedSystem, name = ConsumerType, dispatcherId = decentralizedDispatcherId, psi = true)
false, simulatedCost) case "SSI" =>
new SynchronousDecentralizedConsumer(stap,
decentralizedSystem3,
name = "SSI",
dispatcherId = decentralizedDispatcherId,
monitor = false,
ssi = true,
psi = false)
case s => case s =>
throw new RuntimeException(s"ERROR ConsumptionCampaign is not able to manage consumer $s") throw new RuntimeException(s"ERROR ConsumptionCampaign is not able to manage consumer $s")
} }
...@@ -209,7 +215,7 @@ class ConsumptionCampaign(simulatedCost: SimulatedCost, fromStable: Boolean = fa ...@@ -209,7 +215,7 @@ class ConsumptionCampaign(simulatedCost: SimulatedCost, fromStable: Boolean = fa
val consumptionSetting = new ConsumptionSetting(allocation, consumer) val consumptionSetting = new ConsumptionSetting(allocation, consumer)
val consumptionExperiments = new ConsumptionExperiment(consumptionSetting) val consumptionExperiments = new ConsumptionExperiment(consumptionSetting)
if (debug) println(s"ConsumptionCampaign: configuration=$configuration consumer=${consumer.name} run $nbRuns") if (debug) println(s"ConsumptionCampaign: configuration=$configuration consumer=${consumer.name} run $nbRuns")
outcomeWithoutNegotiation = consumptionExperiments.run().asInstanceOf[NoDealConsumptionOutcome] outcomeWithoutNegotiation = consumptionExperiments.run().asInstanceOf[DealConsumptionOutcome]
if (debug) println(s"ConsumptionCampaign: configuration=$configuration consumer=${consumer.name} run $nbRuns ends") if (debug) println(s"ConsumptionCampaign: configuration=$configuration consumer=${consumer.name} run $nbRuns ends")
consumptionOutcomes = consumptionOutcomes.updatedWith(consumer.name)({ consumptionOutcomes = consumptionOutcomes.updatedWith(consumer.name)({
case Some(list) => Some(outcomeWithoutNegotiation :: list) case Some(list) => Some(outcomeWithoutNegotiation :: list)
......
...@@ -45,14 +45,6 @@ class DealConsumptionOutcome(metrics: Map[String,Double] = Map( ...@@ -45,14 +45,6 @@ class DealConsumptionOutcome(metrics: Map[String,Double] = Map(
"11NbSecondStages" -> 0.0, "11NbSecondStages" -> 0.0,
"12MeanSimulatedFlowtime"-> 0.0)) extends ConsumptionOutcome(metrics) "12MeanSimulatedFlowtime"-> 0.0)) extends ConsumptionOutcome(metrics)
/**
* Class representing the outcome of an experiment for a standard consumer
*/
class NoDealConsumptionOutcome(metrics: Map[String, Double] = Map(
"00MeanRealFlowtime" -> 0.0
))
extends ConsumptionOutcome(metrics)
/** /**
* Class representing the outcome of an experiment for a standard consumer * Class representing the outcome of an experiment for a standard consumer
*/ */
...@@ -94,9 +86,22 @@ class ConsumptionExperiment(setting: ConsumptionSetting) extends Experiment[Cons ...@@ -94,9 +86,22 @@ class ConsumptionExperiment(setting: ConsumptionSetting) extends Experiment[Cons
)) ))
case s: SynchronousDecentralizedConsumer => case s: SynchronousDecentralizedConsumer =>
result = s.consume(setting.allocation) result = s.consume(setting.allocation)
outcome = new NoDealConsumptionOutcome( val solvingTime = System.nanoTime() - startingTime
outcome = new DealConsumptionOutcome(
Map( Map(
"00MeanRealFlowtime" -> result.realGlobalMeanFlowtime, "00MeanRealFlowtime" -> result.realGlobalMeanFlowtime,
"01MeanGlobalFlowtime" -> result.consumptions2allocation.meanGlobalFlowtime,
"02SolvingTime" -> solvingTime.toDouble,
"03LocalRatio" -> result.consumptions2allocation.localAvailabilityRatio,
"04NbDeals" -> setting.consumer.nbDeals,
"05NbDelegations" -> setting.consumer.nbDelegations,
"06NbSwaps" -> setting.consumer.nbSwaps,
"07NbTimeouts" -> setting.consumer.nbTimeouts,
"08EndowmentSize" -> setting.consumer.avgEndowmentSize,
"09NbDelegatedTasks" -> setting.consumer.nbDelegatedTasks,
"10NbFirstStages" -> setting.consumer.nbFirstStages,
"11NbSecondStages" -> setting.consumer.nbSecondStages,
"12MeanSimulatedFlowtime" -> result.consumptions2allocation.realGlobalMeanFlowtime
)) ))
} }
if (result.isSound) outcome if (result.isSound) outcome
......
...@@ -9,7 +9,7 @@ import org.smastaplus.core.SimulatedCostE ...@@ -9,7 +9,7 @@ import org.smastaplus.core.SimulatedCostE
*/ */
object WithVsWithoutNegotiationCampaign extends App { object WithVsWithoutNegotiationCampaign extends App {
val fileName = "consumption4jobs8nodes5staps5allocations040-320tasks" val fileName = "consumption4jobs8nodes5staps5allocations040-320tasks"
val balancerTypes : List[String] = List("DecentralizedConsumerMultiDelegationGlobalFlowtime") val balancerTypes : List[String] = List("DecentralizedConsumerMultiDelegationGlobalFlowtime", "PSI", "SSI")
private val campaign = new ConsumptionCampaign(simulatedCost = new SimulatedCostE, byNodes = false) private val campaign = new ConsumptionCampaign(simulatedCost = new SimulatedCostE, byNodes = false)
campaign.run(balancerTypes, fileName) campaign.run(balancerTypes, fileName)
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment