MathProgExtensionsHasElementsUntil Method

Finalizes the set builder and returns the resulting set.

The set generates elements in [0, getUntil(i)); where i is the value of the dependent set.

For instance, consider the following sets.

C#
Set t2 = Set("t2").Represents("time periods").HasElementsUntil(4);
Set t1 = Set("t1").Represents("time periods until t2").DependsOn(t2).HasElementsUntil(t1 => t1 + 1);

Set t2 has elements { 0, 1, 2, 3 }.

Set t1 depends on t2; hence, generates different indices for different values of t2:

  • when t1 = 0; t2 has elements { 0 },
  • when t1 = 1; t2 has elements { 0, 1 },
  • when t1 = 2; t2 has elements { 0, 1, 2 },
  • when t1 = 3; t2 has elements { 0, 1, 2, 3 }.

Definition

Namespace: Orx.MathProg
Assembly: Orx.MathProg (in Orx.MathProg.dll) Version: 1.0.0
C#
public static Set HasElementsUntil(
	this SetBuilderDepends<Dimension1> state,
	Func<int, int> getUntil,
	string expression = ""
)

Parameters

state  SetBuilderDependsDimension1
Current state of the set builder.
getUntil  FuncInt32, Int32
Function of the dependent set that returns the last element (exclusive) of the set.
expression  String  (Optional)
Element generator expression.

Return Value

Set

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type SetBuilderDependsDimension1. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also