Started out using Optapy as I am slightly more familiar with python than java. I would like to write some tests for my constraints to ensure they work correctly but I can't seem to find any documentation or examples of a test class in python and how to execute/run it?
Not sure if this is supported in Octapy or only in octaplanner.
Any help or guidance would be appreciated.
Thanks
As of 8.30.0b0,
ConstraintVerifiertesting is now supported inoptapy. First, create aConstraintVerifierfrom your@constraint_providerfunction:(or alternatively, from your
SolverConfig)Then you can create tests for particular constraints:
This tests the constraint
room_conflictin isolation from all the other constraints. You can also test all constraints usingverify_that()(no parameters) and replacepenalizes_bywithscores.For a complete example, see the tests in the optapy school timetabling quickstart.