diff --git a/requirements.txt b/requirements.txt index 61ce085..6a2e232 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ build==0.7.0 -Cython==0.29.35 +Cython>=3.0.0 wheel==0.40.0 -pyscipopt==4.4.0 +pyscipopt>=4.4.0 diff --git a/src/pygcgopt/detector.pxi b/src/pygcgopt/detector.pxi index c0cd84a..c5e470a 100644 --- a/src/pygcgopt/detector.pxi +++ b/src/pygcgopt/detector.pxi @@ -75,23 +75,23 @@ cdef wrap_detector_callback_result(Detector detector, PARTIALDEC_DETECTION_DATA* result[0] = result_dict.get("result", result[0]) -cdef SCIP_RETCODE PyDetectorFree (SCIP* scip, DEC_DETECTOR* detector): +cdef SCIP_RETCODE PyDetectorFree (SCIP* scip, DEC_DETECTOR* detector) noexcept: py_detector = get_py_detector(detector) py_detector.freeDetector() Py_DECREF(py_detector) return SCIP_OKAY -cdef SCIP_RETCODE PyDetectorInit (SCIP* scip, DEC_DETECTOR* detector): +cdef SCIP_RETCODE PyDetectorInit (SCIP* scip, DEC_DETECTOR* detector) noexcept: py_detector = get_py_detector(detector) py_detector.initDetector() return SCIP_OKAY -cdef SCIP_RETCODE PyDetectorExit (SCIP* scip, DEC_DETECTOR* detector): +cdef SCIP_RETCODE PyDetectorExit (SCIP* scip, DEC_DETECTOR* detector) noexcept: py_detector = get_py_detector(detector) py_detector.exitDetector() return SCIP_OKAY -cdef SCIP_RETCODE PyDetectorPropagatePartialdec (SCIP* scip, DEC_DETECTOR* detector, PARTIALDEC_DETECTION_DATA* partialdecdetectiondata, SCIP_RESULT* result): +cdef SCIP_RETCODE PyDetectorPropagatePartialdec (SCIP* scip, DEC_DETECTOR* detector, PARTIALDEC_DETECTION_DATA* partialdecdetectiondata, SCIP_RESULT* result) noexcept: cdef SCIP_CLOCK* clock = start_new_clock(scip) py_detector = get_py_detector(detector) @@ -104,7 +104,7 @@ cdef SCIP_RETCODE PyDetectorPropagatePartialdec (SCIP* scip, DEC_DETECTOR* detec return SCIP_OKAY -cdef SCIP_RETCODE PyDetectorFinishPartialdec (SCIP* scip, DEC_DETECTOR* detector, PARTIALDEC_DETECTION_DATA* partialdecdetectiondata, SCIP_RESULT* result): +cdef SCIP_RETCODE PyDetectorFinishPartialdec (SCIP* scip, DEC_DETECTOR* detector, PARTIALDEC_DETECTION_DATA* partialdecdetectiondata, SCIP_RESULT* result) noexcept: cdef SCIP_CLOCK* clock = start_new_clock(scip) py_detector = get_py_detector(detector) @@ -117,7 +117,7 @@ cdef SCIP_RETCODE PyDetectorFinishPartialdec (SCIP* scip, DEC_DETECTOR* detector return SCIP_OKAY -cdef SCIP_RETCODE PyDetectorPostprocessPartialdec (SCIP* scip, DEC_DETECTOR* detector, PARTIALDEC_DETECTION_DATA* partialdecdetectiondata, SCIP_RESULT* result): +cdef SCIP_RETCODE PyDetectorPostprocessPartialdec (SCIP* scip, DEC_DETECTOR* detector, PARTIALDEC_DETECTION_DATA* partialdecdetectiondata, SCIP_RESULT* result) noexcept: cdef SCIP_CLOCK* clock = start_new_clock(scip) py_detector = get_py_detector(detector) @@ -130,19 +130,19 @@ cdef SCIP_RETCODE PyDetectorPostprocessPartialdec (SCIP* scip, DEC_DETECTOR* det return SCIP_OKAY -cdef SCIP_RETCODE PyDetectorSetParamAggressive (SCIP* scip, DEC_DETECTOR* detector, SCIP_RESULT* result): +cdef SCIP_RETCODE PyDetectorSetParamAggressive (SCIP* scip, DEC_DETECTOR* detector, SCIP_RESULT* result) noexcept: py_detector = get_py_detector(detector) result_dict = py_detector.setParamAggressive() or {} result[0] = result_dict.get("result", result[0]) return SCIP_OKAY -cdef SCIP_RETCODE PyDetectorSetParamDefault (SCIP* scip, DEC_DETECTOR* detector, SCIP_RESULT* result): +cdef SCIP_RETCODE PyDetectorSetParamDefault (SCIP* scip, DEC_DETECTOR* detector, SCIP_RESULT* result) noexcept: py_detector = get_py_detector(detector) result_dict = py_detector.setParamDefault() or {} result[0] = result_dict.get("result", result[0]) return SCIP_OKAY -cdef SCIP_RETCODE PyDetectorSetParamFast (SCIP* scip, DEC_DETECTOR* detector, SCIP_RESULT* result): +cdef SCIP_RETCODE PyDetectorSetParamFast (SCIP* scip, DEC_DETECTOR* detector, SCIP_RESULT* result) noexcept: py_detector = get_py_detector(detector) result_dict = py_detector.setParamFast() or {} result[0] = result_dict.get("result", result[0]) diff --git a/src/pygcgopt/gcg.pxd b/src/pygcgopt/gcg.pxd index 32f57c5..e64b2c0 100644 --- a/src/pygcgopt/gcg.pxd +++ b/src/pygcgopt/gcg.pxd @@ -53,7 +53,33 @@ cdef extern from "gcg/gcg.h": int nnewpartialdecs double detectiontime - SCIP_RETCODE DECincludeDetector(SCIP* scip, const char* name, const char decchar, const char* description, int freqCallRound, int maxCallRound, int minCallRound, int freqCallRoundOriginal, int maxCallRoundOriginal, int minCallRoundOriginal, int priority, SCIP_Bool enabled, SCIP_Bool enabledFinishing, SCIP_Bool enabledPostprocessing, SCIP_Bool skip, SCIP_Bool usefulRecall, DEC_DETECTORDATA *detectordata, SCIP_RETCODE (*freeDetector) (SCIP* scip, DEC_DETECTOR* detector), SCIP_RETCODE (*initDetector) (SCIP* scip, DEC_DETECTOR* detector), SCIP_RETCODE (*exitDetector) (SCIP* scip, DEC_DETECTOR* detector), SCIP_RETCODE (*propagatePartialdecDetector) (SCIP* scip, DEC_DETECTOR* detector, PARTIALDEC_DETECTION_DATA* partialdecdetectiondata, SCIP_RESULT* result), SCIP_RETCODE (*finishPartialdecDetector) (SCIP* scip, DEC_DETECTOR* detector, PARTIALDEC_DETECTION_DATA* partialdecdetectiondata, SCIP_RESULT* result), SCIP_RETCODE (*postprocessPartialdecDetector) (SCIP* scip, DEC_DETECTOR* detector, PARTIALDEC_DETECTION_DATA* partialdecdetectiondata, SCIP_RESULT* result), SCIP_RETCODE (*setParamAggressiveDetector) (SCIP* scip, DEC_DETECTOR* detector, SCIP_RESULT* result), SCIP_RETCODE (*setParamDefaultDetector) (SCIP* scip, DEC_DETECTOR* detector, SCIP_RESULT* result), SCIP_RETCODE (*setParamFastDetector) (SCIP* scip, DEC_DETECTOR* detector, SCIP_RESULT* result)) + SCIP_RETCODE DECincludeDetector( + SCIP* scip, const char* name, + const char decchar, + const char* description, + int freqCallRound, + int maxCallRound, + int minCallRound, + int freqCallRoundOriginal, + int maxCallRoundOriginal, + int minCallRoundOriginal, + int priority, + SCIP_Bool enabled, + SCIP_Bool enabledFinishing, + SCIP_Bool enabledPostprocessing, + SCIP_Bool skip, + SCIP_Bool usefulRecall, + DEC_DETECTORDATA *detectordata, + SCIP_RETCODE (*freeDetector) (SCIP* scip, DEC_DETECTOR* detector) noexcept, + SCIP_RETCODE (*initDetector) (SCIP* scip, DEC_DETECTOR* detector) noexcept, + SCIP_RETCODE (*exitDetector) (SCIP* scip, DEC_DETECTOR* detector) noexcept, + SCIP_RETCODE (*propagatePartialdecDetector) (SCIP* scip, DEC_DETECTOR* detector, PARTIALDEC_DETECTION_DATA* partialdecdetectiondata, SCIP_RESULT* result) noexcept, + SCIP_RETCODE (*finishPartialdecDetector) (SCIP* scip, DEC_DETECTOR* detector, PARTIALDEC_DETECTION_DATA* partialdecdetectiondata, SCIP_RESULT* result) noexcept, + SCIP_RETCODE (*postprocessPartialdecDetector) (SCIP* scip, DEC_DETECTOR* detector, PARTIALDEC_DETECTION_DATA* partialdecdetectiondata, SCIP_RESULT* result) noexcept, + SCIP_RETCODE (*setParamAggressiveDetector) (SCIP* scip, DEC_DETECTOR* detector, SCIP_RESULT* result) noexcept, + SCIP_RETCODE (*setParamDefaultDetector) (SCIP* scip, DEC_DETECTOR* detector, SCIP_RESULT* result) noexcept, + SCIP_RETCODE (*setParamFastDetector) (SCIP* scip, DEC_DETECTOR* detector, SCIP_RESULT* result) noexcept + ) DEC_DETECTORDATA* DECdetectorGetData(DEC_DETECTOR* detector) @@ -103,14 +129,14 @@ cdef extern from "gcg/pricer_gcg.h": int priority, SCIP_Bool heurenabled, SCIP_Bool exactenabled, - SCIP_RETCODE (*solverupdate) (SCIP* pricingprob, GCG_SOLVER* solver, int probnr, SCIP_Bool varobjschanged, SCIP_Bool varbndschanged, SCIP_Bool consschanged), - SCIP_RETCODE (*solversolve) (SCIP* scip, SCIP* pricingprob, GCG_SOLVER* solver, int probnr, SCIP_Real dualsolconv, SCIP_Real* lowerbound, GCG_PRICINGSTATUS* status), - SCIP_RETCODE (*solveheur) (SCIP* scip, SCIP* pricingprob, GCG_SOLVER* solver, int probnr, SCIP_Real dualsolconv, SCIP_Real* lowerbound, GCG_PRICINGSTATUS* status), - SCIP_RETCODE (*solverfree) (SCIP* scip, GCG_SOLVER* solver), - SCIP_RETCODE (*solverinit) (SCIP* scip, GCG_SOLVER* solver), - SCIP_RETCODE (*solverexit) (SCIP* scip, GCG_SOLVER* solver), - SCIP_RETCODE (*solverinitsol) (SCIP* scip, GCG_SOLVER* solver), - SCIP_RETCODE (*solverexitsol) (SCIP* scip, GCG_SOLVER* solver), + SCIP_RETCODE (*solverupdate) (SCIP* pricingprob, GCG_SOLVER* solver, int probnr, SCIP_Bool varobjschanged, SCIP_Bool varbndschanged, SCIP_Bool consschanged) noexcept, + SCIP_RETCODE (*solversolve) (SCIP* scip, SCIP* pricingprob, GCG_SOLVER* solver, int probnr, SCIP_Real dualsolconv, SCIP_Real* lowerbound, GCG_PRICINGSTATUS* status) noexcept, + SCIP_RETCODE (*solveheur) (SCIP* scip, SCIP* pricingprob, GCG_SOLVER* solver, int probnr, SCIP_Real dualsolconv, SCIP_Real* lowerbound, GCG_PRICINGSTATUS* status) noexcept, + SCIP_RETCODE (*solverfree) (SCIP* scip, GCG_SOLVER* solver) noexcept, + SCIP_RETCODE (*solverinit) (SCIP* scip, GCG_SOLVER* solver) noexcept, + SCIP_RETCODE (*solverexit) (SCIP* scip, GCG_SOLVER* solver) noexcept, + SCIP_RETCODE (*solverinitsol) (SCIP* scip, GCG_SOLVER* solver) noexcept, + SCIP_RETCODE (*solverexitsol) (SCIP* scip, GCG_SOLVER* solver) noexcept, GCG_SOLVERDATA* solverdata ) GCG_SOLVER** GCGpricerGetSolvers(SCIP* scip) diff --git a/src/pygcgopt/pricing_solver.pxi b/src/pygcgopt/pricing_solver.pxi index a7b8b48..64e3ef8 100644 --- a/src/pygcgopt/pricing_solver.pxi +++ b/src/pygcgopt/pricing_solver.pxi @@ -36,45 +36,45 @@ cdef PricingSolver get_py_pricing_solver(GCG_SOLVER* pricingSolver): return py_pricing_solver -cdef SCIP_RETCODE PyPricingSolverFree (SCIP* scip, GCG_SOLVER* solver): +cdef SCIP_RETCODE PyPricingSolverFree (SCIP* scip, GCG_SOLVER* solver) noexcept: py_pricing_solver = get_py_pricing_solver(solver) py_pricing_solver.freeSolver() Py_DECREF(py_pricing_solver) return SCIP_OKAY -cdef SCIP_RETCODE PyPricingSolverInit (SCIP* scip, GCG_SOLVER* solver): +cdef SCIP_RETCODE PyPricingSolverInit (SCIP* scip, GCG_SOLVER* solver) noexcept: py_pricing_solver = get_py_pricing_solver(solver) py_pricing_solver.initSolver() return SCIP_OKAY -cdef SCIP_RETCODE PyPricingSolverExit (SCIP* scip, GCG_SOLVER* solver): +cdef SCIP_RETCODE PyPricingSolverExit (SCIP* scip, GCG_SOLVER* solver) noexcept: py_pricing_solver = get_py_pricing_solver(solver) py_pricing_solver.exitSolver() return SCIP_OKAY -cdef SCIP_RETCODE PyPricingSolverInitSol (SCIP* scip, GCG_SOLVER* solver): +cdef SCIP_RETCODE PyPricingSolverInitSol (SCIP* scip, GCG_SOLVER* solver) noexcept: py_pricing_solver = get_py_pricing_solver(solver) py_pricing_solver.initSolution() return SCIP_OKAY -cdef SCIP_RETCODE PyPricingSolverExitSol (SCIP* scip, GCG_SOLVER* solver): +cdef SCIP_RETCODE PyPricingSolverExitSol (SCIP* scip, GCG_SOLVER* solver) noexcept: py_pricing_solver = get_py_pricing_solver(solver) py_pricing_solver.exitSolution() return SCIP_OKAY -cdef SCIP_RETCODE PyPricingSolverUpdate (SCIP* pricingprob, GCG_SOLVER* solver, int probnr, SCIP_Bool varobjschanged, SCIP_Bool varbndschanged, SCIP_Bool consschanged): +cdef SCIP_RETCODE PyPricingSolverUpdate (SCIP* pricingprob, GCG_SOLVER* solver, int probnr, SCIP_Bool varobjschanged, SCIP_Bool varbndschanged, SCIP_Bool consschanged) noexcept: py_pricing_solver = get_py_pricing_solver(solver) py_pricingprob = GCGPricingModel.create(pricingprob) py_pricing_solver.updateSolver(py_pricingprob, probnr, varobjschanged, varbndschanged, consschanged) return SCIP_OKAY -cdef SCIP_RETCODE PyPricingSolverSolve (SCIP* scip, SCIP* pricingprob, GCG_SOLVER* solver, int probnr, SCIP_Real dualsolconv, SCIP_Real* lowerbound, GCG_PRICINGSTATUS* status): +cdef SCIP_RETCODE PyPricingSolverSolve (SCIP* scip, SCIP* pricingprob, GCG_SOLVER* solver, int probnr, SCIP_Real dualsolconv, SCIP_Real* lowerbound, GCG_PRICINGSTATUS* status) noexcept: py_pricing_solver = get_py_pricing_solver(solver) py_pricingprob = GCGPricingModel.create(pricingprob) result_dict = py_pricing_solver.solve(py_pricingprob, probnr, dualsolconv) @@ -83,7 +83,7 @@ cdef SCIP_RETCODE PyPricingSolverSolve (SCIP* scip, SCIP* pricingprob, GCG_SOLVE return SCIP_OKAY -cdef SCIP_RETCODE PyPricingSolverSolveHeur (SCIP* scip, SCIP* pricingprob, GCG_SOLVER* solver, int probnr, SCIP_Real dualsolconv, SCIP_Real* lowerbound, GCG_PRICINGSTATUS* status): +cdef SCIP_RETCODE PyPricingSolverSolveHeur (SCIP* scip, SCIP* pricingprob, GCG_SOLVER* solver, int probnr, SCIP_Real dualsolconv, SCIP_Real* lowerbound, GCG_PRICINGSTATUS* status) noexcept: py_pricing_solver = get_py_pricing_solver(solver) py_pricingprob = GCGPricingModel.create(pricingprob) result_dict = py_pricing_solver.solveHeuristic(py_pricingprob, probnr, dualsolconv)