In my refight of the Peninsular War, the French Army of Spain is in a particularly tricky situation. Wellington is on the Spanish-Portuguese border with around 50,000 veteran troops. The French Army of Spain is in the barren territory to the east of Wellington on the Spanish side of the border. They number about 60,000 troops of variable quality, but mainly veterans. A Spanish army of 20,ooo troops - wildly varying quality - has re-taken Madrid and is marching northwards against the French lines of communication to Bayonne. There are no large forces belonging to the French in the North of Spain except Soult's Corps of around 20,000 which is around Astorga, which is holding down an equally-sized although slightly less skilled Spanish force opposing it from Galicia.
So what should Joseph do?
If he presses home the attack on Wellington and fails, he will probably be destroyed.
If he retreats then Wellington will probably pursue and together with Elio will outnumber Joseph.
If he detaches a force to defeat Elio, Wellington will probably have sufficient troops to almost guarantee defeating him.
If he retires on Soult in Astorga, Wellington will mask them while Elio cuts off the army from France.
Hopefully this screen shot makes things clear. The river is the Tagus, Madrid is to the East.