Exemplo n.º 1
0
        private IVariable MultiplyIntegers(IMilpManager baseMilpManager, Domain domain, IVariable[] arguments)
        {
            var binaries = arguments.Where(a => a.IsBinary()).ToArray();
            var nonBinaries = arguments.Where(a => !a.IsBinary()).ToArray();

            if (binaries.Any())
            {
                IVariable conjucted = baseMilpManager.Operation(OperationType.Multiplication, binaries);
                return MultipleByBinaryDigit(baseMilpManager, nonBinaries[0], conjucted).ChangeDomain(domain)
                    .Operation(OperationType.Multiplication, nonBinaries.Skip(1).ToArray());
            }

            return MultiplyNonBinaryIntegers(baseMilpManager, nonBinaries, domain);
        }