Skip to content

Instantly share code, notes, and snippets.

@samueleresca
Last active December 23, 2021 11:02
Show Gist options
  • Save samueleresca/01ee4261c772f1330bc27a469c62b1f6 to your computer and use it in GitHub Desktop.
Save samueleresca/01ee4261c772f1330bc27a469c62b1f6 to your computer and use it in GitHub Desktop.
problemDefinition := lpDefinition {
Vars: []float64 {1.0, 1.0, 1.0}, // dice A , dice B, dice C
Constraints: [][2]float64{
{1, 6}, // Index 0: dice A
{1, 6}, // Index 1: dice B
{1, 6}, // Index 2: dice C
},
Objectives: [][]float64{
// LB A B C UB
{1.0, 1.0, -1.0, 0.0, math.Inf(1)}, // 1 ≤ a - b ≤ ∞ | Dice A cannot be equal to dice B
{1.0, 0.0, 1.0, -1.0, math.Inf(1)}, // 1 ≤ b - c ≤ ∞ | Dice B cannot be equal to dice C
{math.Inf(-1), 1.0, -2.0, 1.0, -1.0}, // a − b < b − c -> -∞ ≤ a - 2b + c ≤ -1 | The main objective codified from the problem.
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment