Python Interface
In order to use the Python interface, two paths must be defined so Python apps can access both the CUDA toolkit as well as the Amazolve installation directory where the azopy.pyd module resides. To add the CUDA toolkit path, use the following Python code near the top of the file (see full sample below):
import os
os.add_dll_directory(os.environ['CUDA_PATH'] + r"\bin")
Then, add the Amazolve installation directory to the PYTHONPATH:
set PYTHONPATH=%PYTHONPATH%;C:\Amazolve\bin
Objects
The Python interface to Amazolve contains the following objects:
Solver
: Runs the solver.SolverConfig
: Contains all the fields described in the previous Common Parameters section.SolverResult
: Contains the results of the solver run.ConstraintResult
: A list of these is contained inSolverResult
.
Solver Object
- Methods:
- `SolverResult solve(SolverConfig)'
- Returns:
SolverResult
(object) - Parameters:
SolverConfig
(object)
- Returns:
- `SolverResult solve(SolverConfig)'
SolverConfig Object
- Fields:
- (Contains all fields listed in Common Parameters)
SolverResult Object
- Fields:
resource_count
: Returns the configured resource count of the atom matrix.time_count
: Returns the configured time count of the atom matrix.state_count
: Returns the configured state count of the atom matrix.constraints
: A list ofConstraintResult
objects containing individual constraint scores.score
: The final score of the returned atoms.atoms
: A 2d array of the atoms.stop_reason
: The reason the solver stopped:0
: Unknown reason, likely a failure.1
: Target score was reached.2
: Total run time was reached.3
: No change in score time was reached.
time_taken
: The total time taken (in seconds).
ConstraintResult Object
- Fields:
cid
: The constraint ID (CID
) defined in the constraint in the problem definition.cscore
: The constraint's score.ctime
: The time (in milliseconds) the constraint took. This is only provided in debug run mode.
Examples Repo
A complete Python test application is available here.