Conditions for attaining the maximum values of thermoelectric power in intermetallic semiconductors of the MgAgAs structural type