please help me

I have a problem as assume

```
variable f1 integer
variable f2 integer
variable x binary
```

I want to

```
if f1>f2
x==1;
else
x==0;
end
```

I can use gurobi as cvx_slover, but I can’t generate this model?

please advise me,

please help me

I have a problem as assume

```
variable f1 integer
variable f2 integer
variable x binary
```

I want to

```
if f1>f2
x==1;
else
x==0;
end
```

I can use gurobi as cvx_slover, but I can’t generate this model?

please advise me,

I am afraid I don’t understand what you are trying to accomplish, so I can’t help.

You can use the Big M method to formulate this.

Assume f1-f2 can be bounded by numerical constants M1 and M2, such that

```
-M1+1 <= f1-f2 <= M2
```

then your desired conditional constraint can be expressed as

```
f2-f1 <= M1*(1-x)-1
f1-f2 <= M2*x
```

Note that your values of M1 and M2 need not be tight, but the tighter they are, the easier the problem may be to solve.