I wanna convert this if statement to linear equation.
for i,j -> 1 to n
if D[i]>D[j] and f[i] > s[j] then w[i]+=c[j]
The line below is what has come to my mind so far, but I do not know how to write the rest. C(j) has to be multiplied by a phrase (that phrase is a code condition) If the result of that phrase (in parentheses below) was 1, add C(j) to w(j) and if it was 0, do not add it to w(j). Can you tell me how to write that condition in such a way that if the condition is true, it becomes 1, and if the condition is false, it become 0?
sum( j, c[j]*(?) )