Ejemplo n.º 1
0
        /// <summary> Constructs a solution from the given network.</summary>
        /// <param name="network">the constraint network
        /// </param>
        public Solution(Network network)
        {
            _network = network;
            _objectiveDomain = null;
            if (network.Objective != null)
            {
                _objectiveDomain = network.Objective.Domain;
            }
            System.Collections.IList variables = network.Variables;
            _bindings = new Domain[variables.Count];
            System.Collections.IEnumerator vs = variables.GetEnumerator();
            while (vs.MoveNext())
            {
                var v = (Variable) vs.Current;
                _bindings[v.Index] = v.Domain;
            }
            // Do th efollowing for Soft constraints only
            //SwapValuesToPreferences();

            _code = new Code(network);
        }
Ejemplo n.º 2
0
 public virtual Object Clone()
 {
     var code = new Code {conditions = new Condition[conditions.Length]};
     conditions.CopyTo(code.conditions, 0);
     return code;
 }