### Need Help Converting Pseudocode to C++ to find Branch-and-Bound for the Early/Tardy Problem with a Common Due-Date

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879`` ``````// main() function. // It initiates the search for the optimal solution. main() // Create the root node. create(root_node) root_node.Type := LEAF root_node.Offspring_List := EMPTY // evaluate() returns the U pper Bound as the OFV of the root // node. root_node.OFV := evaluate(root_node.Type,root_node.Sequence,AP) optimal_node := root_node find_an_optimum(root_node) // An optimal solution has been found. Optimal_Sequence := optimal_node.Sequence end main() // find_optimum() recursive function. // Examines its argument-node and updates the optimal solution if // applicable. find_an_optimum(parent_node) // Create the parent node's children. // The number of children generated depends on the parent's // sequence. parent_node.Offspring_List := create_list(parent_node.Sequence) // First node-screening loop. // It will be determined which children are worth of further // examination. for each child_node in Offspring_List child_node.Type :=determine_type(child_node.Sequence) child_node.Offspring_List := EMPTY // If the child is a leaf node, then evaluate() returns the // Lower Bound associated with the child's sequence. // Otherwise, If the child is a // terminal node, then it returns the child's actual OFV. child_node.OFV := evaluate(child_node.Type,child_node.Sequence,AP) if child_node.Type is not TERMINAL and child_node.OFV < optimal_node.OFV Then continue with next child_node else if child_node.Type is TERMINAL and child_node.OFV < optimal_node.OFV Then optimal_node := child_node end if remove_from(parent_node.Offspring_List,child_node) end if end for // If the parent gave birth only to terminal nodes, // the next while loop will not execute. // Second node-screening loop. // If any children survived, examine the one promising a better // solution. // After each examination eliminate from the parent's Offspring // List all these children that would lead to a worse solution; // then repeat the process until no child is left in the parent's // Offspring List. while parent_node.Offspring_List is not EMPTY // Indentify the child with the lowest Lower Bound. minimum_LB := PLUS_INFINITY for each child_node in parent_node.Offspring_List if child_node.OFV < minimum_LB Then chosen_child_node := child_node end if end for // Examine the selected child find_an_optimum(chosen_child_node) remove_from(parent_node.Offspring_List,chosen_child_node) // Eliminate children that would lead the B&B to a worse // solution. for each child_node in parent_node.Offspring_List if child_node.OFV >= optimal_node.OFV Then remove_from(parent_node.Offspring_List,child_node) end if end for end while end find_an_optimum()``````

Can someone help me to get a good start on this, I really need some direction.
Topic archived. No new replies allowed.