Ejemplo n.º 1
0
        /// <summary>
        /// Check if an inequality constaint can be applied on current algorithm.
        /// In NLopt, api/options.c has a function inequality_ok() which do the same verification.
        /// </summary>
        protected void CheckInequalityConstraintAvailability()
        {
            NLoptAlgorithm algorithm = Algorithm;

            switch (algorithm)
            {
            case NLoptAlgorithm.LD_MMA:
            case NLoptAlgorithm.LD_CCSAQ:
            case NLoptAlgorithm.LD_SLSQP:
            case NLoptAlgorithm.LN_COBYLA:
            case NLoptAlgorithm.GN_ISRES:
            case NLoptAlgorithm.GN_ORIG_DIRECT:
            case NLoptAlgorithm.GN_ORIG_DIRECT_L:
            case NLoptAlgorithm.AUGLAG:
            case NLoptAlgorithm.AUGLAG_EQ:
            case NLoptAlgorithm.LN_AUGLAG:
            case NLoptAlgorithm.LN_AUGLAG_EQ:
            case NLoptAlgorithm.LD_AUGLAG:
            case NLoptAlgorithm.LD_AUGLAG_EQ:
                break;

            default:
                throw new ArgumentException("Algorithm " + algorithm.ToString() + " does not support inequality constraint.");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Check if an equality constaint can be applied on current algorithm.
        /// In NLopt, api/options.c has a function equality_ok() which do the same verification.
        /// </summary>
        protected void CheckEqualityConstraintAvailability()
        {
            NLoptAlgorithm algorithm = Algorithm;

            switch (algorithm)
            {
            case NLoptAlgorithm.LD_SLSQP:
            case NLoptAlgorithm.GN_ISRES:
            case NLoptAlgorithm.LN_COBYLA:
                break;

            default:
                throw new ArgumentException("Algorithm " + algorithm.ToString() + " does not support equality constraint.");
            }
        }