Hard Constraint doesn't seem to work

Hiyas, setting up a hard constraint to ensure a fixed delivery sequence.

//Setup the hard constraint
        HardRouteConstraint accessConstraint = new HardRouteConstraint() {

            @Override
            public boolean fulfilled(JobInsertionContext iContext) {
                
                int currentJobID = Integer.parseInt(iContext.getJob().getId());
                
                   if((currentJobID - 1) != previousJobID){
                        return false;
                    }
                
                System.out.println("Check that was done Current ID-1 = "+(currentJobID - 1)+" != "+previousJobID+" = Previous ID"); 
                
                previousJobID = Integer.parseInt(iContext.getJob().getId());
                
                return true;
            }

        };

The output seems to be doing the correct checks -

Check that was done Current ID-1 = 0 != 0 = Previous ID
Check that was done Current ID-1 = 1 != 1 = Previous ID
Check that was done Current ID-1 = 2 != 2 = Previous ID
Check that was done Current ID-1 = 3 != 3 = Previous ID
Check that was done Current ID-1 = 4 != 4 = Previous ID
Check that was done Current ID-1 = 5 != 5 = Previous ID
Check that was done Current ID-1 = 6 != 6 = Previous ID

Although it is only assigning the first job

+--------------------------------------------------------------------------------------------------------------------------------+
| detailed solution                                                                                                              |
+---------+----------------------+-----------------------+-----------------+-----------------+-----------------+-----------------+
| route   | vehicle              | activity              | job             | arrTime         | endTime         | costs           |
+---------+----------------------+-----------------------+-----------------+-----------------+-----------------+-----------------+
| 1       | vehicle              | start                 | -               | undef           | 0               | 0               |
| 1       | vehicle              | service               | 1               | 0               | 0               | 0               |
| 1       | vehicle              | end                   | -               | 0               | undef           | 0               |
+--------------------------------------------------------------------------------------------------------------------------------+
+----------------+
| unassignedJobs |
+----------------+
| 2              |
| 3              |
| 4              |
| 5              |
| 6              |
| Ongoing to end |

Am I misunderstanding how the hard constraints are set up?
Do hard constraints get setup once per job? Or for every iteration?

Powered by Discourse