score:7
Bus is around 80-90 € (return). I think that there is very expensive and only an option if
Flight depends on the day and company. The cheapest companies are Ryanair and EasyJet. Expect to pay at least 40 € for a return ticket to Porto and 60 € to Lisbon. Anyway, you can find one way tickets from 15 € to Porto or 27 € to Lisbon if you plan in advance. I think this is a good option (may be the cheapest) to get to Porto.
You can book a sit in a RENFE train to get to Lisbon from 50-60 € (return), but it's really slow (night train). Your best bet is to try the high speed train, but then the price is higher than 100 €.
The cheapest way to reach Portugal from Madrid is using a shared car service. Specifically, in Spain the most used is BlaBlaCar, but there are a lot more (Carpooling, Amovens and some non-international more). In your case, Madrid ↔ Lisbon is 25-30 € each way and Madrid ↔ Porto is around 30 € (it seems easier to find a shared car to Lisbon than to Porto, and both are easier in weekends). You must take into account that these services are not as reliables as a train or bus and are usually booked one week in advance (before, the drivers don't register their routes).