Skip to content
Snippets Groups Projects
Commit 6838fc5d authored by Guillaume-Helbecque's avatar Guillaume-Helbecque
Browse files

declare lbounds inside pfsp_search

parent 3953bbd8
No related branches found
No related tags found
No related merge requests found
......@@ -26,15 +26,6 @@ config const inst: int = 14; // instance
const jobs = taillard_get_nb_jobs(inst);
const machines = taillard_get_nb_machines(inst);
var lbound1 = new WrapperLB1(jobs, machines); //lb1_bound_data(jobs, machines);
taillard_get_processing_times(lbound1!.lb1_bound.p_times, inst);
fill_min_heads_tails(lbound1!.lb1_bound);
var lbound2 = new WrapperLB2(jobs, machines);
fill_machine_pairs(lbound2!.lb2_bound/*, LB2_FULL*/);
fill_lags(lbound1!.lb1_bound.p_times, lbound2!.lb2_bound);
fill_johnson_schedules(lbound1!.lb1_bound.p_times, lbound2!.lb2_bound);
const initUB = taillard_get_best_ub(inst);
proc check_parameters()
......@@ -70,7 +61,7 @@ proc print_results(const optimum: int, const exploredTree: uint, const exploredS
writeln("=================================================\n");
}
proc decompose_lb2(const parent: Node, ref tree_loc: uint, ref num_sol: uint,
proc decompose_lb2(const ref lbound1, const ref lbound2, const parent: Node, ref tree_loc: uint, ref num_sol: uint,
ref best: int, ref pool: SinglePool(Node))
{
for i in parent.limit1+1..(jobs-1) {
......@@ -80,7 +71,7 @@ proc decompose_lb2(const parent: Node, ref tree_loc: uint, ref num_sol: uint,
child.prmu = parent.prmu;
child.prmu[parent.depth] <=> child.prmu[i];
var lowerbound = lb2_bound(lbound1!.lb1_bound, lbound2!.lb2_bound, child.prmu, child.limit1, jobs, best);
var lowerbound = lb2_bound(lbound1, lbound2, child.prmu, child.limit1, jobs, best);
if (child.depth == jobs) { // if child leaf
num_sol += 1;
......@@ -146,12 +137,21 @@ proc pfsp_search(ref optimum: int, ref exploredTree: uint, ref exploredSol: uint
*/
timer.start();
var lbound1 = new lb1_bound_data(jobs, machines);
taillard_get_processing_times(lbound1.p_times, inst);
fill_min_heads_tails(lbound1);
var lbound2 = new lb2_bound_data(jobs, machines);
fill_machine_pairs(lbound2/*, LB2_FULL*/);
fill_lags(lbound1.p_times, lbound2);
fill_johnson_schedules(lbound1.p_times, lbound2);
while (pool.size < 10000) {
var hasWork = 0;
var parent = pool.popFront(hasWork);
if !hasWork then break;
decompose_lb2(parent, exploredTree, exploredSol, best, pool);
decompose_lb2(lbound1, lbound2, parent, exploredTree, exploredSol, best, pool);
}
timer.stop();
const res1 = (timer.elapsed(), exploredTree, exploredSol);
......@@ -169,22 +169,22 @@ proc pfsp_search(ref optimum: int, ref exploredTree: uint, ref exploredSol: uint
var parents: [0..#M] Node = noinit;
var bounds: [0..#(M*jobs)] int(32) = noinit;
var lbound1_d: lbound1.type;
var lbound2_d: lbound2.type;
var lbound1_d: WrapperLB1;
var lbound2_d: WrapperLB2;
var parents_d: WrapperArrayParents;
var bounds_d: WrapperArrayBounds;
on device {
lbound1_d = new WrapperLB1(jobs, machines);
lbound1_d!.lb1_bound.p_times = lbound1!.lb1_bound.p_times;
lbound1_d!.lb1_bound.min_heads = lbound1!.lb1_bound.min_heads;
lbound1_d!.lb1_bound.min_tails = lbound1!.lb1_bound.min_tails;
lbound1_d!.lb1_bound.p_times = lbound1.p_times;
lbound1_d!.lb1_bound.min_heads = lbound1.min_heads;
lbound1_d!.lb1_bound.min_tails = lbound1.min_tails;
lbound2_d = new WrapperLB2(jobs, machines);
lbound2_d!.lb2_bound.johnson_schedules = lbound2!.lb2_bound.johnson_schedules;
lbound2_d!.lb2_bound.lags = lbound2!.lb2_bound.lags;
lbound2_d!.lb2_bound.machine_pairs = lbound2!.lb2_bound.machine_pairs;
lbound2_d!.lb2_bound.machine_pair_order = lbound2!.lb2_bound.machine_pair_order;
lbound2_d!.lb2_bound.johnson_schedules = lbound2.johnson_schedules;
lbound2_d!.lb2_bound.lags = lbound2.lags;
lbound2_d!.lb2_bound.machine_pairs = lbound2.machine_pairs;
lbound2_d!.lb2_bound.machine_pair_order = lbound2.machine_pair_order;
parents_d = new WrapperArrayParents();
bounds_d = new WrapperArrayBounds();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment