/** * Regular constructor. The domain is cloned or instanciated if null. * The domain iterator is assigned to the index of value in Domain, * or to -42 if the Domain has not been initialized. * @see Domain.IsInitialized() */ protected Variable( string name, string fullName, Domain domain, int value ) { Name = name; FullName = fullName; Domain = domain == null ? new Domain() : (Domain)domain.Clone(); // if value is not in domain, domain.IndexOf( value ) returns -1 ProjectedCost = 0.0; IndexDomain = Domain.IsInitialized() ? Domain.IndexOf( value ) : -42; }
public VariableWrapper( string name, string fullName, Domain domain, int value ) : base(name, fullName, domain, value) { }
public object Clone() { if( !IsInitialized() ) return new Domain( OutsideScope ); else { var d = new Domain( InitialDomain.ConvertAll( v => v ), OutsideScope ); d.CurrentDomain = CurrentDomain.ConvertAll( v => v ); return d; } }