Maximizing entanglement in bosonic Josephson junctions using shortcuts to adiabaticity and optimal control