How to write this optimization prolem in CVX?

The error is due to multiplying CVX variables, A.*F

Is A really binary, not general integer. If so, declare it binary..

If A is binary, believe this can be reformulated as a mixed-integer convex problem using Big M logic to express S >= t.*D as a constraint conditional on the relevant element of A being one…To do this, please read and follow the guidance in the recommendations I provided you in Can this optimization problem be modeled in CVX? - #4 by Mark_L_Stone .

I’ll let you look at " MIP formulations and linearizations Quick reference" by FICO https://www.artelys.com/uploads/pdfs/Xpress/mipformref-1.pdf to figure it out.

A great resource for conic optimization modeling,which has some some integer material, is the “MOSEK Modeling Cookbook” https://docs.mosek.com/modeling-cookbook/index.html , which will greatly help you use CVX (even if you don’t use Mosek, but please don’t tell @Erling I said that).

You’ll probably benefit from putting in the effort to work through “Model Building in Mathematical Programming”, 5th Edition by H. Paul Williams https://www.wiley.com/en-us/Model+Building+in+Mathematical+Programming%2C+5th+Edition-p-9781118443330 . This ought to really help you do effective integer modeling and formulation.

If you have read these, you do not seem to have fully grasped them yet.