Skip to content

Instantly share code, notes, and snippets.

@chrispahm
Created April 4, 2017 21:01
Show Gist options
  • Save chrispahm/bdf41968731df72056c53ba7f1426143 to your computer and use it in GitHub Desktop.
Save chrispahm/bdf41968731df72056c53ba7f1426143 to your computer and use it in GitHub Desktop.
acceptableThreshold Definition
// Current implementation:
// The variable bestPossibleEval will be equal to the evaluation of the first simplex iteration
// displaying the best possible solution to the problem.
// The while loop will now be terminated if the current bestEvaluation is smaller (due to negtaive sign)
// than the acceptableThreshold -> supposed to be the way its done in GAMS
while (branches.length > 0 && toleranceFlag === true) {
var acceptableThreshold = this.bestPossibleEval * (1 - (tolerance/100));
// Abort while loop if termination tolerance is both specified and condition is met
if (tolerance > 0) {
if (bestEvaluation < acceptableThreshold) {
toleranceFlag = false;
}
}
// Updating the acceptableThreshold with every iteration
// Here the acceptableThreshold is linked to the relaxed Evaluation of a branch.
// The issue I'm facing when testing this setup is that the loop is (obviously) terminated
// once a branch pop's up where the relaxed solution is arbitrary close to the bestEvaluation,
// as the deduction of the tolerance closes the gap between the two.
// The result is therefore rather a random feasible solution, rather than being somehow linked
// to the actual optimal solution.
while (branches.length > 0 && toleranceFlag === true) {
var acceptableThreshold = this.evaluation * (1 - (tolerance/100));
// Abort while loop if termination tolerance is both specified and condition is met
if (tolerance > 0) {
if (bestEvaluation < acceptableThreshold) {
toleranceFlag = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment