Created
May 13, 2020 06:56
-
-
Save phabee/dea5bc5a1b60fd7a3adcf705dfa1e02e to your computer and use it in GitHub Desktop.
Call Gurobi from Matlab and transform inequalities to equalities introducing Slack-Variables
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
model.obj = [1,1,0,0,0,0]'; | |
model.sense = ['=', '=', '=', '=', '>', '>', '>', '>']'; | |
model.rhs = [200000, 100, 200, 0, 0, 0, 0, 0]'; | |
model.lb = [0, 0, 0, 0, 0, 0]'; | |
model.ub = [1e22, 1e22, 1e22, 1e22, 1e22, 1e22]'; | |
model.vtype = ['C', 'C', 'C', 'C', 'C', 'C']' | |
model.A = sparse([800, 400, 1, 0, 0, 0; 1, 0, 0, -1, 0, 0; 0, 1, 0, 0, -1, 0; 2, -1, 0, 0, 0, 1; zeros(4,2), eye(4)]); | |
model.modelsense = 'max'; | |
model.slack = [0, 0, 1, 1, 1, 1]; | |
params.outputflag = 1; | |
params.logfile = 'gurobi_solver.log'; | |
result = gurobi(model, params); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment