Commit 3b41a790 authored by Iran's avatar Iran
Browse files

changing variable names

parent 45b39ed7
......@@ -53,50 +53,46 @@ public class TestReusableResourceScheduler {
final Scheduler scheduler = new Scheduler(0,600,0);
final ActivityNetworkSolver temporalActivitySolver = (ActivityNetworkSolver)scheduler.getConstraintSolvers()[0];
final SymbolicVariableActivity one = (SymbolicVariableActivity)temporalActivitySolver.createVariable("Robot 1");
final SymbolicVariableActivity two = (SymbolicVariableActivity)temporalActivitySolver.createVariable("Robot 2");
final SymbolicVariableActivity three = (SymbolicVariableActivity)temporalActivitySolver.createVariable("Robot 3");
final SymbolicVariableActivity activityOne = (SymbolicVariableActivity)temporalActivitySolver.createVariable("Robot 1");
final SymbolicVariableActivity activityTwo = (SymbolicVariableActivity)temporalActivitySolver.createVariable("Robot 2");
final SymbolicVariableActivity activityThree = (SymbolicVariableActivity)temporalActivitySolver.createVariable("Robot 3");
//introducing reusable resource with capacity 4:
//ReusableResource rr1 = new ReusableResource(varOH, valOH, 4);
ReusableResource rr1 = new ReusableResource(null, null, 4);
rr1.setUsage(one,two,three);
rr1.setUsage(activityOne,activityTwo,activityThree);
scheduler.addMetaConstraint(rr1);
rr1.setPeakCollectionStrategy(PEAKCOLLECTION.COMPLETE);
//The activities use the resource in the following amounts:
one.setSymbolicDomain("2");
two.setSymbolicDomain("2");
three.setSymbolicDomain("3");
activityOne.setSymbolicDomain("2");
activityTwo.setSymbolicDomain("2");
activityThree.setSymbolicDomain("3");
//Activities have DURATIONS:
//(note: these are unary constraints, which means that each constraint is an edge from an activity to itself)
AllenIntervalConstraint dur1 = new AllenIntervalConstraint(AllenIntervalConstraint.Type.Duration, new Bounds(35, 55));
dur1.setFrom(one);
dur1.setTo(one);
dur1.setFrom(activityOne);
dur1.setTo(activityOne);
AllenIntervalConstraint dur2 = new AllenIntervalConstraint(AllenIntervalConstraint.Type.Duration, new Bounds(35, 55));
dur2.setFrom(two);
dur2.setTo(two);
dur2.setFrom(activityTwo);
dur2.setTo(activityTwo);
AllenIntervalConstraint dur3 = new AllenIntervalConstraint(AllenIntervalConstraint.Type.Duration, new Bounds(35, 55));
dur3.setFrom(three);
dur3.setTo(three);
dur3.setFrom(activityThree);
dur3.setTo(activityThree);
//Add the constraints
temporalActivitySolver.addConstraints(dur1,dur2,dur3);
//There are PRECEDENCES between activities:
//(note: these are binary constraints, which means that each constraint is an edge from an activity to another activity)
AllenIntervalConstraint con1 = new AllenIntervalConstraint(AllenIntervalConstraint.Type.Before, Type.Before.getDefaultBounds());
//no conflict: two before three
AllenIntervalConstraint con1 = new AllenIntervalConstraint(AllenIntervalConstraint.Type.Before, Type.Before.getDefaultBounds());
//two conflicts: two before one
con1.setFrom(one);
con1.setTo(two);
con1.setFrom(activityTwo);
con1.setTo(activityOne);
//temporalActivitySolver.addConstraint(con1);
//Add the constraints
//Visualization
final TimelinePublisher tp = new TimelinePublisher(temporalActivitySolver.getConstraintNetwork(), "Robot 1", "Robot 2", "Robot 3");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment