linear-programmingamplglpkmathprog

GLPK MathProg - conditional constraint


I have the following MILP problem, relevant part of code:

param n, integer, >= 0;
set jobs := 1..n;
param P{i in jobs, j in jobs}, binary;

var s{i in jobs}, integer, >=0;
var e{i in jobs}, integer, >=0;

var Cmax, integer, >=0;

minimize total: Cmax;

s.t. crit_3{i in jobs,j in jobs}: s[i] >= e[j];

I want the criterion crit_3 to represent the following equation:

The constraint

Basically, I want the constraints to only activate for a given combination of i and j when the matrix P[i,j] = 1. How can I achieve this?


Solution

  • Something like s.t. crit_3{i in jobs,j in jobs: P[i,j]=1}: s[i] >= e[j]; should do the job.