-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bite the bullet and commit build outputs so that they are as accessib…
…le as possible for people that may not be able to run the build in some OS or setup. An upside of this is that examples and documentation can be served out of the box without having to build them. Remove package.json 'prepare' scripts because they are no longer needed, as installing from git will already include build outputs.
- Loading branch information
Showing
25 changed files
with
3,698 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
.vscode | ||
node_modules | ||
tmp/ | ||
es/ | ||
/coverage | ||
lib/ | ||
|
||
*.lock | ||
*lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { Expression } from './expression.js'; | ||
import { Variable } from './variable.js'; | ||
/** | ||
* An enum defining the linear constraint operators. | ||
* | ||
* |Value|Operator|Description| | ||
* |----|-----|-----| | ||
* |`Le`|<=|Less than equal| | ||
* |`Ge`|>=|Greater than equal| | ||
* |`Eq`|==|Equal| | ||
* | ||
* @enum {Number} | ||
*/ | ||
export declare enum Operator { | ||
Le = 0, | ||
Ge = 1, | ||
Eq = 2 | ||
} | ||
/** | ||
* A linear constraint equation. | ||
* | ||
* A constraint equation is composed of an expression, an operator, | ||
* and a strength. The RHS of the equation is implicitly zero. | ||
* | ||
* @class | ||
* @param {Expression} expression The constraint expression (LHS). | ||
* @param {Operator} operator The equation operator. | ||
* @param {Expression} [rhs] Right hand side of the expression. | ||
* @param {Number} [strength=Strength.required] The strength of the constraint. | ||
*/ | ||
export declare class Constraint { | ||
constructor(expression: Expression | Variable, operator: Operator, rhs?: Expression | Variable | number, strength?: number); | ||
/** | ||
* Returns the unique id number of the constraint. | ||
* @private | ||
*/ | ||
id(): number; | ||
/** | ||
* Returns the expression of the constraint. | ||
* | ||
* @return {Expression} expression | ||
*/ | ||
expression(): Expression; | ||
/** | ||
* Returns the relational operator of the constraint. | ||
* | ||
* @return {Operator} linear constraint operator | ||
*/ | ||
op(): Operator; | ||
/** | ||
* Returns the strength of the constraint. | ||
* | ||
* @return {Number} strength | ||
*/ | ||
strength(): number; | ||
toString(): string; | ||
private _expression; | ||
private _operator; | ||
private _strength; | ||
private _id; | ||
} | ||
//# sourceMappingURL=constraint.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { Expression } from './expression.js'; | ||
import { Strength } from './strength.js'; | ||
/** | ||
* An enum defining the linear constraint operators. | ||
* | ||
* |Value|Operator|Description| | ||
* |----|-----|-----| | ||
* |`Le`|<=|Less than equal| | ||
* |`Ge`|>=|Greater than equal| | ||
* |`Eq`|==|Equal| | ||
* | ||
* @enum {Number} | ||
*/ | ||
export var Operator; | ||
(function (Operator) { | ||
Operator[Operator["Le"] = 0] = "Le"; | ||
Operator[Operator["Ge"] = 1] = "Ge"; | ||
Operator[Operator["Eq"] = 2] = "Eq"; | ||
})(Operator || (Operator = {})); | ||
/** | ||
* A linear constraint equation. | ||
* | ||
* A constraint equation is composed of an expression, an operator, | ||
* and a strength. The RHS of the equation is implicitly zero. | ||
* | ||
* @class | ||
* @param {Expression} expression The constraint expression (LHS). | ||
* @param {Operator} operator The equation operator. | ||
* @param {Expression} [rhs] Right hand side of the expression. | ||
* @param {Number} [strength=Strength.required] The strength of the constraint. | ||
*/ | ||
var Constraint = /** @class */ (function () { | ||
function Constraint(expression, operator, rhs, strength) { | ||
if (strength === void 0) { strength = Strength.required; } | ||
this._id = CnId++; | ||
this._operator = operator; | ||
this._strength = Strength.clip(strength); | ||
if (rhs === undefined && expression instanceof Expression) { | ||
this._expression = expression; | ||
} | ||
else { | ||
this._expression = expression.minus(rhs); | ||
} | ||
} | ||
/** | ||
* Returns the unique id number of the constraint. | ||
* @private | ||
*/ | ||
Constraint.prototype.id = function () { | ||
return this._id; | ||
}; | ||
/** | ||
* Returns the expression of the constraint. | ||
* | ||
* @return {Expression} expression | ||
*/ | ||
Constraint.prototype.expression = function () { | ||
return this._expression; | ||
}; | ||
/** | ||
* Returns the relational operator of the constraint. | ||
* | ||
* @return {Operator} linear constraint operator | ||
*/ | ||
Constraint.prototype.op = function () { | ||
return this._operator; | ||
}; | ||
/** | ||
* Returns the strength of the constraint. | ||
* | ||
* @return {Number} strength | ||
*/ | ||
Constraint.prototype.strength = function () { | ||
return this._strength; | ||
}; | ||
Constraint.prototype.toString = function () { | ||
return (this._expression.toString() + ' ' + ['<=', '>=', '='][this._operator] + ' 0 (' + this._strength.toString() + ')'); | ||
}; | ||
return Constraint; | ||
}()); | ||
export { Constraint }; | ||
/** | ||
* The internal constraint id counter. | ||
* @private | ||
*/ | ||
var CnId = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { IMap } from './maptype.js'; | ||
import { Variable } from './variable.js'; | ||
/** | ||
* An expression of variable terms and a constant. | ||
* | ||
* The constructor accepts an arbitrary number of parameters, | ||
* each of which must be one of the following types: | ||
* - number | ||
* - Variable | ||
* - Expression | ||
* - 2-tuple of [number, Variable|Expression] | ||
* | ||
* The parameters are summed. The tuples are multiplied. | ||
* | ||
* @class | ||
* @param {...(number|Variable|Expression|Array)} args | ||
*/ | ||
export declare class Expression { | ||
constructor(...args: any[]); | ||
/** | ||
* Returns the mapping of terms in the expression. | ||
* | ||
* This *must* be treated as const. | ||
* @private | ||
*/ | ||
terms(): IMap<Variable, number>; | ||
/** | ||
* Returns the constant of the expression. | ||
* @private | ||
*/ | ||
constant(): number; | ||
/** | ||
* Returns the computed value of the expression. | ||
* | ||
* @private | ||
* @return {Number} computed value of the expression | ||
*/ | ||
value(): number; | ||
/** | ||
* Creates a new Expression by adding a number, variable or expression | ||
* to the expression. | ||
* | ||
* @param {Number|Variable|Expression} value Value to add. | ||
* @return {Expression} expression | ||
*/ | ||
plus(value: number | Variable | Expression): Expression; | ||
/** | ||
* Creates a new Expression by substracting a number, variable or expression | ||
* from the expression. | ||
* | ||
* @param {Number|Variable|Expression} value Value to substract. | ||
* @return {Expression} expression | ||
*/ | ||
minus(value: number | Variable | Expression): Expression; | ||
/** | ||
* Creates a new Expression by multiplying with a fixed number. | ||
* | ||
* @param {Number} coefficient Coefficient to multiply with. | ||
* @return {Expression} expression | ||
*/ | ||
multiply(coefficient: number): Expression; | ||
/** | ||
* Creates a new Expression by dividing with a fixed number. | ||
* | ||
* @param {Number} coefficient Coefficient to divide by. | ||
* @return {Expression} expression | ||
*/ | ||
divide(coefficient: number): Expression; | ||
isConstant(): boolean; | ||
toString(): string; | ||
private _terms; | ||
private _constant; | ||
} | ||
//# sourceMappingURL=expression.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.