Consider the following optimization problem, where $t_i$ is known
$$ \max_{0\leq a_1,\cdots,a_k\leq 1} \sum_{i=1}^k a_it_i $$
I want to ensure that the following inequality holds after optimization is completed
$$ a_1\leq a_2\leq \cdots \leq a_k $$
So how should I add constraints to the original objective function?
Some thoughts: I tried to add this item in the objective function to achieve my purpose
$$ M\cdot \sum_{i=2}^k (a_{i}-a_{i-1}), \quad M >>0 $$
But I soon discovered that this constraint does not guarantee that $a_i$ is increasing. Because only one of the sum terms is required to be large and the other terms are less than 0, it can also be guaranteed that the sum is a large integer. In addition, even if this constraint is correct, I still need to balance it with the original objective function through a hyperparameter.
So is there a better solution?