What is the ideal amount of shade for a house with air conditioning and solar cells on the roof? Considering a mid latitude (e.g. in Virginia), south facing, single family house with two stories, AC cooling and solar power on the roof:
What would be the ideal level / amount of shade for the house in summer?
An additional condition is that the entire house is shaded, so the question is not about which part of the house should be shaded, but to which degree the entire house should be shaded.
As a concrete example, there's a tree in front of the house. Is it better to cut the tree down or not?
The interior of the house is cooled by an AC unit that consumes electricity.
Solar cells on the roof produce electricity from sunlight, which partially offsets the electricity consumption of the AC unit. However, direct sunlight is also heating the house, increasing the power consumption of the AC unit again.
Additional shade shields the house from the heat of the sun, but also may reduce the power from the solar panels.
So the question would be if there is an optimum point there.
Shade could come from trees in front of the house, other buildings, or e.g. solar sails.
The answer could also be "None", or "as much shade as possible".
 A: I would expect that the ideal situation would be to shade all of the house except the solar panels (which are presumably on the roof). These would actually shade the house themselves, and would benefit from as much sunlight as possible. Actually arranging this in practice is probably difficult though.
A: 
The answer could also be "None", or "as much shade as possible".

The obvious answer would be "get as much shade as possible for the house, without shading the panels on the roof", but if that was possible you would not have asked this question in the first place. For anything more specific than this, the answer is: it is complicated. Have in mind that even small shade on photovoltaic panels significantly decreases their conversion efficiency!

We are missing many parameters here, and I am afraid even if you give more details there is no simple answer. Depending on the house parameters, maybe you can "afford" letting more sunshine in such that you do not shade photovoltaic panels and get better conversion efficiency. But it is usually very complicated to model these systems.
If you truly want to optimize the geometry of shading, I will just give here some guidelines how to approach this problem:

*

*Get data for which you could do simulations. This includes some historical air temperatures and preferably solar irradiance. The former should not be difficult to get, but the latter might be a challenge!


*Setup a model that describes your situation with clear distinction to control and output variables: (i) control variables are the ones over which you have control such as geometry of shading, and (ii) output variables are the ones that you optimize (indoor temperature, electricity consumption etc.)


*Setup a criterium function which will give some numerical value from the outputs such that you can compare the quality of a solution. A solution is one particular set of control values.


*Employ some optimization algorithm to find the best solution. This could be a basic brute-force method in which you try many different combinations for input variables, or some smarter optimization technique.
