Skip to main content

Class: FloatExpr

A class representing floating-point expression in the model. Currently, there is no way to create floating-point expressions. The class is only a base class for IntExpr.

Extends

Extended by

Methods

getName()

getName(): undefined | string

Returns the name assigned to the node.

Returns

undefined | string

Inherited from

ModelNode.getName


setName()

setName(name: string): this

Assigns a name to the node.

Parameters

ParameterTypeDescription
namestringNamed to be assigned.

Returns

this

The node itself so it can be used in chained expression.

Remarks

Assigning a name is optional. However is useful for debugging because variable names appear in the development traces. It is also useful for exporting the model to a file (see problem2json).

Example

let model = new CP.Model();
let x = model.intervalVar({ length: 10 }).setName("x");
// The line above is equivalent to:
// let x = model.intervalVar({ length: 10, name:"x" });
let endOfX = model.endOf(x).setName("endOfX");
let result = await CP.solve(model);

Inherited from

ModelNode.setName