예제 #1
0
func (prob *perFlowACOProblem) Start(c chan problems.ProblemUpdate) problems.ProblemUpdate {
	prob.loadConf()
	prob.loadProblem()

	prob.status = 1
	prob.newSeq = make(chan []int)
	prob.updateChan = c
	prob.log = problems.NewLog("values", "", log.Ltime)

	//Load the algorithm
	root := os.Getenv("HOME")
	buf, err := ioutil.ReadFile(root + "/.DistGo/perFlowACOProblem/alg.js")
	if err != nil {
		log.Fatal("perFlowACO Start error: ", err)
	}

	//Generate the seed
	seed := prob.neh()

	//three times
	seed = prob.jobIndexBased(seed)
	seed = prob.jobIndexBased(seed)
	seed = prob.jobIndexBased(seed)

	prob.bestSeq = seed
	prob.bestValue = prob.evaluate(prob.bestSeq)
	prob.log.Println(prob.bestValue, prob.bestSeq)

	prob.alg = "var costs = " + prob.matrix2string(prob.costs) + "\n" + string(buf)

	return problems.ProblemUpdate{prob.alg, prob.bestSeq, prob.status}
}
예제 #2
0
func (prob *pruebaProblem) Start(c chan problems.ProblemUpdate) problems.ProblemUpdate {

	prob.file = problems.NewLog("valores", "", 2)

	prob.best = 0

	prob.c = c

	prob.number = 1

	//Load the algorithm
	root := os.Getenv("HOME")
	buf, err := ioutil.ReadFile(root + "/.DistGo/pruebaProblem/alg.js")
	if err != nil {
		log.Fatal("prueba Start error: ", err)
	}

	prob.alg = string(buf)

	return problems.ProblemUpdate{prob.alg, prob.best, prob.number}

}