示例#1
0
 protected override IVariable InternalFromConstant(string name, double value, Domain domain)
 {
     var variable = new MsfMilpVariable(this, name, domain) { Term = 1 * value };
     return variable;
 }
示例#2
0
        protected override IVariable InternalCreate(string name, Domain domain)
        {
            var variable = new MsfMilpVariable(this, name, domain);
            var msfDomain = (domain == Domain.BinaryConstantInteger ||
                             domain == Domain.BinaryInteger)
                ? Microsoft.SolverFoundation.Services.Domain.Boolean
                : (domain == Domain.PositiveOrZeroConstantInteger || domain == Domain.PositiveOrZeroInteger)
                    ? Microsoft.SolverFoundation.Services.Domain.IntegerRange(0, Int64.MaxValue)
                    : (domain == Domain.PositiveOrZeroConstantReal || domain == Domain.PositiveOrZeroReal)
                        ? Microsoft.SolverFoundation.Services.Domain.RealNonnegative
                        : (domain == Domain.AnyConstantInteger || domain == Domain.AnyInteger)
                            ? Microsoft.SolverFoundation.Services.Domain.IntegerRange(Int64.MinValue, Int64.MaxValue)
                            : Microsoft.SolverFoundation.Services.Domain.Real;
            variable.Decision = new Decision(msfDomain, name);
            Solver.AddDecision(variable.Decision);
            variable.Term = 1*variable.Decision;

            return variable;
        }