Skip to content

Commit

Permalink
Change Results structure, add DummySolver
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelLipski committed Nov 12, 2013
1 parent 0f9461c commit 1529b73
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 115 deletions.
21 changes: 21 additions & 0 deletions src/main/java/com/poshwolf/core/DummySolver.java
@@ -0,0 +1,21 @@
package com.poshwolf.core;

public class DummySolver implements Solver {

public ResultWithOrder solve(TaskDefinition task, ProgressListener listener) {
ResultWithOrder r = new ResultWithOrder();

r.setExecutionTimespan(2345);
r.setComputationTime(23.45);

int[][] o = new int[task.getMachineCount()][task.getJobCount()];;
for (int m = 0; m < task.getMachineCount(); m++)
for (int j = 0; j < task.getJobCount(); j++)
o[m][j] = (m + 1) * (j + 1);
r.setJobOrderForMachines(o);

return r;
}
}


@@ -1,11 +1,7 @@

package com.poshwolf.core;

public class ComputationResult {

// The order of jobs to be executed on each machine
// found by the algorithm
private int[][] jobOrderForMachines; // matrix: machinCount x jobCount
public class Result {

// The actual result - the minimal overall timespan of execution
private int executionTimespan;
Expand All @@ -30,13 +26,6 @@ public void setComputationTime(double computationTime) {
this.computationTime = computationTime;
}

public int[][] getJobOrderForMachines() {
return jobOrderForMachines;
}

public void setJobOrderForMachines(int[][] jobOrderForMachines) {
this.jobOrderForMachines = jobOrderForMachines;
}
}


18 changes: 18 additions & 0 deletions src/main/java/com/poshwolf/core/ResultWithOrder.java
@@ -0,0 +1,18 @@

package com.poshwolf.core;


public class ResultWithOrder extends Result {

// The order of jobs to be executed on each machine
// found by the algorithm
private int[][] jobOrderForMachines; // matrix: machinCount x jobCount

public int[][] getJobOrderForMachines() {
return jobOrderForMachines;
}

public void setJobOrderForMachines(int[][] jobOrderForMachines) {
this.jobOrderForMachines = jobOrderForMachines;
}
}
18 changes: 18 additions & 0 deletions src/main/java/com/poshwolf/core/ResultWithOrderAndInput.java
@@ -0,0 +1,18 @@

package com.poshwolf.core;

public class ResultWithOrderAndInput extends ResultWithOrder {

// The input task definition provided to the solver
private TaskDefinition task;


public TaskDefinition getTask() {
return task;
}

public void setTask(TaskDefinition task) {
this.task = task;
}
}

2 changes: 1 addition & 1 deletion src/main/java/com/poshwolf/core/Solver.java
Expand Up @@ -2,7 +2,7 @@

public interface Solver {

ComputationResult solve(TaskDefinition task, ProgressListener listener);
ResultWithOrder solve(TaskDefinition task, ProgressListener listener);
}


100 changes: 0 additions & 100 deletions src/main/scala/Web.scala

This file was deleted.

Expand Up @@ -92,8 +92,8 @@ class PoshWolfWebService {
}

@WebMethod
def solve( @WebParam(name="task") task: TaskDefinition): ComputationResult = {
val result = new ComputationResult()
def solve( @WebParam(name="task") task: TaskDefinition): ResultWithOrder = {
val result = new ResultWithOrder()

val order = for (i <- List.range(0, task.getMachineCount))
yield new Array[Int](task.getJobCount)
Expand Down

0 comments on commit 1529b73

Please sign in to comment.