mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-22 03:24:57 +08:00
style: enable MemberName
in checkstyle (#5193)
* style: enable MemberName in checkstyle * style: simply uncomment `MemberName` --------- Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
This commit is contained in:
@ -13,24 +13,24 @@ public class OptimalJobScheduling {
|
||||
|
||||
private final int numberProcesses;
|
||||
private final int numberMachines;
|
||||
private final int[][] Run;
|
||||
private final int[][] Transfer;
|
||||
private final int[][] Cost;
|
||||
private final int[][] run;
|
||||
private final int[][] transfer;
|
||||
private final int[][] cost;
|
||||
|
||||
/**
|
||||
* Constructor of the class.
|
||||
* @param numberProcesses ,refers to the number of precedent processes(N)
|
||||
* @param numberMachines ,refers to the number of different machines in our disposal(M)
|
||||
* @param Run , N*M matrix refers to the cost of running each process to each machine
|
||||
* @param Transfer ,M*M symmetric matrix refers to the transportation delay for each pair of
|
||||
* @param run , N*M matrix refers to the cost of running each process to each machine
|
||||
* @param transfer ,M*M symmetric matrix refers to the transportation delay for each pair of
|
||||
* machines
|
||||
*/
|
||||
public OptimalJobScheduling(int numberProcesses, int numberMachines, int[][] Run, int[][] Transfer) {
|
||||
public OptimalJobScheduling(int numberProcesses, int numberMachines, int[][] run, int[][] transfer) {
|
||||
this.numberProcesses = numberProcesses;
|
||||
this.numberMachines = numberMachines;
|
||||
this.Run = Run;
|
||||
this.Transfer = Transfer;
|
||||
this.Cost = new int[numberProcesses][numberMachines];
|
||||
this.run = run;
|
||||
this.transfer = transfer;
|
||||
this.cost = new int[numberProcesses][numberMachines];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,7 +50,7 @@ public class OptimalJobScheduling {
|
||||
|
||||
for (int j = 0; j < numberMachines; j++) { // for each Machine
|
||||
|
||||
Cost[i][j] = runningCost(i, j);
|
||||
cost[i][j] = runningCost(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -71,7 +71,7 @@ public class OptimalJobScheduling {
|
||||
|
||||
if (process == 0) // refers to the first process,which does not require for a previous one
|
||||
// to have been executed
|
||||
return Run[process][machine];
|
||||
return run[process][machine];
|
||||
else {
|
||||
|
||||
int[] runningCosts = new int[numberMachines]; // stores the costs of executing our Process depending on
|
||||
@ -79,7 +79,7 @@ public class OptimalJobScheduling {
|
||||
|
||||
for (int k = 0; k < numberMachines; k++) // computes the cost of executing the previous
|
||||
// process to each and every Machine
|
||||
runningCosts[k] = Cost[process - 1][k] + Transfer[k][machine] + Run[process][machine]; // transferring the result to our Machine and executing
|
||||
runningCosts[k] = cost[process - 1][k] + transfer[k][machine] + run[process][machine]; // transferring the result to our Machine and executing
|
||||
// the Process to our Machine
|
||||
|
||||
return findMin(runningCosts); // returns the minimum running cost
|
||||
@ -88,19 +88,19 @@ public class OptimalJobScheduling {
|
||||
|
||||
/**
|
||||
* Function used in order to return the minimum Cost.
|
||||
* @param cost ,an Array of size M which refers to the costs of executing a Process to each
|
||||
* @param costArr ,an Array of size M which refers to the costs of executing a Process to each
|
||||
* Machine
|
||||
* @return the minimum cost
|
||||
*/
|
||||
private int findMin(int[] cost) {
|
||||
private int findMin(int[] costArr) {
|
||||
|
||||
int min = 0;
|
||||
|
||||
for (int i = 1; i < cost.length; i++) {
|
||||
for (int i = 1; i < costArr.length; i++) {
|
||||
|
||||
if (cost[i] < cost[min]) min = i;
|
||||
if (costArr[i] < costArr[min]) min = i;
|
||||
}
|
||||
return cost[min];
|
||||
return costArr[min];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,7 +111,7 @@ public class OptimalJobScheduling {
|
||||
for (int i = 0; i < numberProcesses; i++) {
|
||||
|
||||
for (int j = 0; j < numberMachines; j++) {
|
||||
System.out.print(Cost[i][j]);
|
||||
System.out.print(cost[i][j]);
|
||||
System.out.print(" ");
|
||||
}
|
||||
|
||||
@ -124,6 +124,6 @@ public class OptimalJobScheduling {
|
||||
* Getter for the running Cost of i process on j machine.
|
||||
*/
|
||||
public int getCost(int process, int machine) {
|
||||
return Cost[process][machine];
|
||||
return cost[process][machine];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user