0

In OptaPlanner User Guide, there's an example of assigning 4 processes to 2 computers with 2 contrains (CPU & RAM).

Cloud balance example

I created a CloudBalance solution to test the this example. It's surprising that the best score is always -1hard, while the optimal solution is 0hard. I have tried with different score calculators but result is the same.

Here's the result

Process 1 -> Computer 2 
Process 2 -> Computer 1
Process 3 -> Computer 1
Process 4 -> Computer 2

Can anyone help explain why it does not find the optimal solution? Any advice is appreciated.

Below is the method to create CloudBalance

public static CloudBalance createCloudBalance(){
    CloudBalance cb = new CloudBalance();

    CloudComputer cc1 = new CloudComputer();
    cc1.setId(1L);
    cc1.setCpuPower(7);
    cc1.setMemory(6);
    cc1.setNetworkBandwidth(100);
    cc1.setCost(30);

    CloudComputer cc2 = new CloudComputer();
    cc2.setId(2L);
    cc2.setCpuPower(6);
    cc2.setMemory(6);
    cc2.setNetworkBandwidth(100);
    cc2.setCost(25);

    List<CloudComputer> computerList = new ArrayList<CloudComputer>(2);
    computerList.add(cc1);
    computerList.add(cc2);

    CloudProcess cp1 = new CloudProcess();
    cp1.setId(1L);
    cp1.setRequiredCpuPower(5);
    cp1.setRequiredMemory(5);
    cp1.setRequiredNetworkBandwidth(1);

    CloudProcess cp2 = new CloudProcess();
    cp2.setId(2L);
    cp2.setRequiredCpuPower(4);
    cp2.setRequiredMemory(3);
    cp2.setRequiredNetworkBandwidth(1);

    CloudProcess cp3 = new CloudProcess();
    cp3.setId(3L);
    cp3.setRequiredCpuPower(2);
    cp3.setRequiredMemory(3);
    cp3.setRequiredNetworkBandwidth(1);

    CloudProcess cp4 = new CloudProcess();
    cp4.setId(4L);
    cp4.setRequiredCpuPower(2);
    cp4.setRequiredMemory(1);
    cp4.setRequiredNetworkBandwidth(1);

    List<CloudProcess> processList = new ArrayList<CloudProcess>(4);
    processList.add(cp1);
    processList.add(cp2);
    processList.add(cp3);
    processList.add(cp4);

    cb.setComputerList(computerList);
    cb.setProcessList(processList);

    return cb;
}

Update CloudBalancingHelloWorld to use the method above

CloudBalance unsolvedCloudBalance = createCloudBalance();
AlBlue
  • 23,254
  • 14
  • 71
  • 91
Tu Dao
  • 1
  • What's your solver config? Can you also try exhaustiveSearch to confirm that finds the optimal solution? – Geoffrey De Smet Jun 20 '16 at 08:03
  • Thank you. I didn't notice that the default solver config does not use exhaustiveSearch. It does find optimal solution with exhaustiveSearch. – Tu Dao Jul 05 '16 at 13:51

1 Answers1

0

Add pillarSwapMoveSelector and pillarChangeMoveSelector - we're likely going to add these out of the box soon.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120