<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">Op 07-02-13 15:43, Aijin Nakanishi
schreef:<br>
</div>
<blockquote
cite="mid:CA+9JSF4iQrB2FpMyODC4mX=EJZTdWL4xieDMWdoNwyO+izRQzw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>I'm trying to understand when is proccess assigned to a
computer by that java example.<br>
<br>
----------------<br>
public HardAndSoftScore calculateScore(CloudBalance
cloudBalance) {<br>
int hardScore = 0;<br>
int softScore = 0;<br>
for (CloudComputer computer :
cloudBalance.getComputerList()) {<br>
int cpuPowerUsage = 0;<br>
int memoryUsage = 0;<br>
int networkBandwidthUsage = 0;<br>
boolean used = false;<br>
<br>
// Calculate usage<br>
for (CloudProcess process :
cloudBalance.getProcessList()) {<br>
if (computer.equals(process.getComputer())) {<br>
cpuPowerUsage +=
process.getRequiredCpuPower();<br>
memoryUsage +=
process.getRequiredMemory();<br>
networkBandwidthUsage +=
process.getRequiredNetworkBandwidth();<br>
used = true;<br>
}<br>
}<br>
<br>
// Hard constraints<br>
int cpuPowerAvailable = computer.getCpuPower() -
cpuPowerUsage;<br>
if (cpuPowerAvailable < 0) {<br>
hardScore += cpuPowerAvailable;<br>
}<br>
int memoryAvailable = computer.getMemory() -
memoryUsage;<br>
if (memoryAvailable < 0) {<br>
hardScore += memoryAvailable;<br>
}<br>
int networkBandwidthAvailable =
computer.getNetworkBandwidth() - networkBandwidthUsage;<br>
if (networkBandwidthAvailable < 0) {<br>
hardScore += networkBandwidthAvailable;<br>
}<br>
<br>
// Soft constraints<br>
if (used) {<br>
softScore -= computer.getCost();<br>
}<br>
}<br>
return DefaultHardAndSoftScore.valueOf(hardScore,
softScore);<br>
}<br>
--------------------<br>
<br>
</div>
I didn't understand how the cloudcomputers received it<br>
</div>
</blockquote>
What do you mean?<br>
That ScoreCalculator is configured in the SolverConfig.xml, so
that's why it gets called.<br>
<br>
<blockquote
cite="mid:CA+9JSF4iQrB2FpMyODC4mX=EJZTdWL4xieDMWdoNwyO+izRQzw@mail.gmail.com"
type="cite">
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
</blockquote>
<br>
</body>
</html>