Maximizing a convex function with linear constraints
Your problem in revision 3 of the question is NP-hard by a reduction from the vertex cover problem.  Slightly more precisely, even if aip’s are restricted to 0 or 1, it is NP-complete to decide whether the maximum value in the question is equal to N or less than N.  (Note that the maximum value cannot be greater than N if aip’s are 0 or 1.)  The detail is left as an exercise.