Lindo Systems

! Entropy model in LINGO.
 Find the distribution of maximum entropy,
 subject to it satisfying certain problem
 specific constraints;
! Keywords: Entropy maximization, Information theory;
SETS:
  OUTCOME: P;
ENDSETS
DATA:
 OUTCOME = 1..6; ! The possible outcomes;
ENDDATA
! The maximum entropy objective;
  MAX = -@SUM( OUTCOME(j): p(j)*@LOG(p(j)));

! Probabilities sum to 1;
  @SUM( OUTCOME(j): P(j)) = 1;


! Suppose we have a problem specific requirement
  that the mean outcome should be 2.3;
  @SUM( OUTCOME(j): j*P(j)) = 2.3;