Created
December 10, 2016 21:11
-
-
Save Strernd/0689aa3eaaf2554e6d1a3f5298c7d742 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************* | |
* OPL 12.5.1.0 Model | |
* Author: BAT4769 | |
* Creation Date: Dec 5, 2016 at 11:14:35 AM | |
*********************************************/ | |
int n=4; // cargos | |
int m=3; // compartments | |
int a=2; // aircrafts | |
range cargos = 1..n; | |
range comps = 1..m; | |
range acs = 1..a; | |
float profit[cargos] = [310,380,350,285]; | |
float weight[cargos] = [19,16,23,13]; | |
float volume[cargos] = [480,650,580,390]; | |
float weight_cap[acs][comps] = [[5,6,8],[10,16,8]]; | |
float volume_cap[acs][comps] = [[6800,8700,5300],[6800,8700,5300]]; | |
// variables | |
dvar float+ x[acs][cargos][comps]; | |
dvar float+ y[acs]; | |
// objective | |
dexpr float obj = sum (h in acs, i in cargos, j in comps) profit[i] * x[h][i][j]; | |
maximize obj; | |
//consraints | |
subject to{ | |
forall(i in cargos) | |
available_weight: | |
sum(h in acs, j in comps) x[h][i][j] <= weight[i]; | |
forall(h in acs) | |
{ | |
forall(j in comps) | |
weight_capacity: | |
sum(i in cargos) x[h][i][j] <= weight_cap[h][j]; | |
forall(j in comps) | |
volume_capacity: | |
sum(i in cargos) x[h][i][j]*volume[i] <= volume_cap[h][j]; | |
forall(j in comps) | |
balancing_constraint: | |
sum(i in cargos) x[h][i][j]/weight_cap[h][j] == y[h]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment