mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Call "nudge" from constraint solver
This commit is contained in:
@@ -63,7 +63,11 @@ CS.PackagesResolver.prototype.resolve = function (dependencies, constraints,
|
||||
// - allAnswers (for testing, calculate all possible answers and put an extra
|
||||
// property named "allAnswers" on the result)
|
||||
CS.PackagesResolver._resolveWithInput = function (input, options) {
|
||||
var solver = new CS.Solver(input);
|
||||
options = options || {};
|
||||
|
||||
var solver = new CS.Solver(input, {
|
||||
nudge: options.nudge
|
||||
});
|
||||
|
||||
// Disable runtime type checks (they slow things down by a factor of 3)
|
||||
return Logic._disablingTypeChecks(function () {
|
||||
|
||||
@@ -18,7 +18,7 @@ CS.Solver = function (input, options) {
|
||||
return p + "@" + vConstraint.raw;
|
||||
});
|
||||
|
||||
self.options = options;
|
||||
self.options = options || {};
|
||||
|
||||
self.steps = [];
|
||||
self.stepsByName = {};
|
||||
@@ -180,8 +180,11 @@ CS.Solver.prototype.minimize = function (step, options) {
|
||||
self.solution = logic.minimize(
|
||||
self.solution, costTerms, costWeights, {
|
||||
progress: function (status, cost) {
|
||||
if (status === 'improving') {
|
||||
if (DEBUG) {
|
||||
if (self.options.nudge) {
|
||||
self.options.nudge();
|
||||
}
|
||||
if (DEBUG) {
|
||||
if (status === 'improving') {
|
||||
console.log(cost + " ... trying to improve ...");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user