I mean, i know how it is called, it is inside the xml configuration:
----------
  <!-- Domain model configuration -->
  <solutionClass>org.drools.planner.examples.cloudbalancing.domain.CloudBalance</solutionClass>
  <planningEntityClass>org.drools.planner.examples.cloudbalancing.domain.CloudProcess</planningEntityClass>

  <!-- Score configuration -->
  <scoreDirectorFactory>
    <scoreDefinitionType>HARD_AND_SOFT</scoreDefinitionType>
    <simpleScoreCalculatorClass>org.drools.planner.examples.cloudbalancing.solver.score.CloudBalancingSimpleScoreCalculator</simpleScoreCalculatorClass>-->
   
  </scoreDirectorFactory>
---------

i want to understant the java class doing the assign to cloudcomputers. I don't see any setCloudProcess to a CloudComputer, even so, when the planner ends, all process have been distributed to cloudcomputer. That's what I am trying to understand, how does it works. I did a debug but i didn't catch the moment a cloud computer receives a cloudprocess


2013/2/7 Geoffrey De Smet <ge0ffrey.spam@gmail.com>

Op 07-02-13 15:43, Aijin Nakanishi schreef:
I'm trying to understand when is proccess assigned to a computer by that java example.

----------------
    public HardAndSoftScore calculateScore(CloudBalance cloudBalance) {
        int hardScore = 0;
        int softScore = 0;
        for (CloudComputer computer : cloudBalance.getComputerList()) {
            int cpuPowerUsage = 0;
            int memoryUsage = 0;
            int networkBandwidthUsage = 0;
            boolean used = false;

            // Calculate usage
            for (CloudProcess process : cloudBalance.getProcessList()) {
                if (computer.equals(process.getComputer())) {
                    cpuPowerUsage += process.getRequiredCpuPower();
                    memoryUsage += process.getRequiredMemory();
                    networkBandwidthUsage += process.getRequiredNetworkBandwidth();
                    used = true;
                }
            }

            // Hard constraints
            int cpuPowerAvailable = computer.getCpuPower() - cpuPowerUsage;
            if (cpuPowerAvailable < 0) {
                hardScore += cpuPowerAvailable;
            }
            int memoryAvailable = computer.getMemory() - memoryUsage;
            if (memoryAvailable < 0) {
                hardScore += memoryAvailable;
            }
            int networkBandwidthAvailable = computer.getNetworkBandwidth() - networkBandwidthUsage;
            if (networkBandwidthAvailable < 0) {
                hardScore += networkBandwidthAvailable;
            }

            // Soft constraints
            if (used) {
                softScore -= computer.getCost();
            }
        }
        return DefaultHardAndSoftScore.valueOf(hardScore, softScore);
    }
--------------------

I didn't understand how the cloudcomputers received it
What do you mean?
That ScoreCalculator is configured in the SolverConfig.xml, so that's why it gets called.



_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users