ManageSolvers.go 530 B

123456789101112131415161718192021222324
  1. package solver
  2. import (
  3. "fmt"
  4. "strconv"
  5. "time"
  6. )
  7. func (solver *Solver) ManageSolver() {
  8. for rows1Index := range solver.row1s {
  9. // Sleep a while when there are more or an equal number of Go routines running
  10. for solver.cores >= solver.Controller.NumCPUs {
  11. time.Sleep(time.Duration(1))
  12. }
  13. // Luanch a solver in its separate go routine
  14. fmt.Println(strconv.Itoa(solver.cores) + ">=" + strconv.Itoa(solver.Controller.NumCPUs))
  15. solver.cores = solver.cores + 1
  16. go solver.CheckCombinationsLevel1(rows1Index)
  17. }
  18. }