Skip to content

Instantly share code, notes, and snippets.

@Ghabry
Created August 17, 2019 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ghabry/fbe283587bba4dbb2e62721a075a368f to your computer and use it in GitHub Desktop.
Save Ghabry/fbe283587bba4dbb2e62721a075a368f to your computer and use it in GitHub Desktop.
glpk
let lp = {
name: 'test',
objective: {
direction: glpk.GLP_MAX,
name: 'r5',
vars: [
{ name: 'D', coef: -1.0 },
{ name: 'D_ext', coef: 1.0 }
]
},
subjectTo: [
{
name: 'r1',
vars: [
{ name: 'A', coef: 1.0 },
{ name: 'A_ext', coef: -1.0 }
],
bnds: { type: glpk.GLP_UP, ub: 10.0, lb: 0.0 }
},
{
name: 'r2',
vars: [
{ name: 'A', coef: -1.0 },
{ name: 'B', coef: 1.0 }
],
bnds: { type: glpk.GLP_LO, ub: 10000.0, lb: -10000.0 }
},
{
name: 'r3',
vars: [
{ name: 'A', coef: -1.0 },
{ name: 'C', coef: 1.0 }
],
bnds: { type: glpk.GLP_LO, ub: 10000.0, lb: 0.0 }
},
{
name: 'r4',
vars: [
{ name: 'B', coef: -1.0 },
{ name: 'C', coef: -1.0 },
{ name: 'D', coef: 1.0 }
],
bnds: { type: glpk.GLP_LO, ub: 10000.0, lb: 0.0 }
},
{
name: 'r6',
vars: [
{ name: 'E', coef: 1.0 },
{ name: 'E_ext', coef: -1.0 }
],
bnds: { type: glpk.GLP_LO, ub: 3.0, lb: 0.0 }
},
{
name: 'r7',
vars: [
{ name: 'D', coef: 1.0 },
{ name: 'E', coef: -2.0 }
],
bnds: { type: glpk.GLP_LO, ub: 10000.0, lb: 0.0 }
}
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment