GSCIP - MathOpt integer programming backend

Problem: solve a small integer linear model through MathOpt using the GSCIP backend.

Show code
import { initMathOpt, MathOpt, setWorkerBridgeEnabled } from 'or-tools-wasm/mathopt';

setWorkerBridgeEnabled(true);
await initMathOpt();

const model = MathOpt.Model('gscip_simple_mip');
const x = model.addIntegerVariable({ lowerBound: 0, upperBound: 10, name: 'x' });
const y = model.addIntegerVariable({ lowerBound: 0, upperBound: 10, name: 'y' });

model.addLinearConstraint({ upperBound: 4, terms: [
  { variable: x, coefficient: 1 },
  { variable: y, coefficient: 1 },
]});
model.addLinearConstraint({
  upperBound: 2,
  terms: [{ variable: x, coefficient: 1 }],
});
model.maximize([
  { variable: x, coefficient: 1 },
  { variable: y, coefficient: 2 },
]);

const result = await MathOpt.solve(model, {
  solverType: MathOpt.SolverType.GSCIP,
  threads: 4,
});
console.log(result.objectiveValue, result.variableValues);

GSCIP is SCIP exposed through the MathOpt frontend.

Model

  • The decision variables are binary choices for x and y.
  • The capacity constraint allows at most one selected choice.
  • The objective gives x a higher value than y.
  • MathOpt sends the model to GSCIP and reads back the selected variables.
Run the solver to view the solution.

Status / Response: