Skip to content

Commit

Permalink
LP format export: free variables
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikPeters committed Feb 25, 2024
1 parent 016bc56 commit a1298e2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lp-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ export function toLPFormat(model) {
// Bounds
let boundsString = "Bounds\n";
model.variables.forEach((varObj, varName) => {
if (varObj.lb !== 0 || varObj.ub !== "+infinity") {
if (varObj.vtype === "BINARY") {
return;
}
if (varObj.lb === "-infinity" && varObj.ub === "+infinity") {
boundsString += ` ${varName} free\n`;
} else if (varObj.lb !== 0 || varObj.ub !== "+infinity") {
boundsString += ` ${varObj.lb === "-infinity" ? "-inf" : varObj.lb} <= ${varName} <= ${varObj.ub === "+infinity" ? "+inf" : varObj.ub}\n`;
}
});
Expand Down

0 comments on commit a1298e2

Please sign in to comment.