Beispiel #1
0
        /// <summary>
        /// Détecte les contraintes inactives
        /// </summary>
        /// <param name="tree">Arbre de recherche</param>
        /// <param name="list">Liste de retour</param>
        /// <returns>Nombre de contraintes à éliminer</returns>
        private int inactive(glp_tree tree, SWIGTYPE_p_int list)
        {
            glp_attr attr = new glp_attr();
            int      p = GLPK.glp_ios_curr_node(tree);                                          //Indice du noeud courant
            int      lev = GLPK.glp_ios_node_level(tree, p);                                    //Niveau dans l'arbre
            int      i, cnt = 0;

            //On parcours les lignes et on les ajoutes à la liste si elles sont inactives
            for (i = GLPK.glp_get_num_rows(problem); i >= 1; i--)
            {
                GLPK.glp_ios_row_attr(tree, i, attr);
                if (attr.level < lev)
                {
                    break;
                }
                if (attr.origin != GLPK.GLP_RF_REG)
                {
                    if (GLPK.glp_get_row_stat(problem, i) == GLPK.GLP_BS)
                    {
                        cnt++;
                        if (list != null)
                        {
                            GLPK.intArray_setitem(list, cnt, i);
                        }
                    }
                }
            }
            logger.log(cnt + " inactive constraints removed", Message.Level.Normal);
            return(cnt);
        }
Beispiel #2
0
    /**
     * Identifies inactive constraints.
     *
     * @param tree branch and bound tree
     * @param list indices of inactive constraints
     * @return number of inactive constraints
     */
    private int inactive(glp_tree tree, SWIGTYPE_p_int list)
    {
        glp_attr attr = new glp_attr();
        int      p = GLPK.glp_ios_curr_node(tree);
        int      lev = GLPK.glp_ios_node_level(tree, p);
        int      i, cnt = 0;

        for (i = GLPK.glp_get_num_rows(prob); i >= 1; i--)
        {
            GLPK.glp_ios_row_attr(tree, i, attr);
            if (attr.level < lev)
            {
                break;
            }
            if (attr.origin != GLPK.GLP_RF_REG)
            {
                if (GLPK.glp_get_row_stat(prob, i) == GLPK.GLP_BS)
                {
                    cnt++;
                    if (list != null)
                    {
                        GLPK.intArray_setitem(list, cnt, i);
                    }
                }
            }
        }
        Console.WriteLine(cnt + " inactive constraints removed");
        return(cnt);
    }
Beispiel #3
0
        /// <summary>
        /// Détecte les contraintes inactives
        /// </summary>
        /// <param name="tree">Arbre de recherche</param>
        /// <param name="list">Liste de retour</param>
        /// <returns>Nombre de contraintes à éliminer</returns>
        private int inactive(glp_tree tree, SWIGTYPE_p_int list)
        {
            glp_attr attr = new glp_attr();
            int      p = GLPK.glp_ios_curr_node(tree);
            int      lev = GLPK.glp_ios_node_level(tree, p);
            int      i, cnt = 0;

            //On parcours les lignes et on les ajoutes à la liste si elles sont inactives
            for (i = GLPK.glp_get_num_rows(problem); i >= 1; i--)
            {
                GLPK.glp_ios_row_attr(tree, i, attr);
                if (attr.level < lev)
                {
                    break;
                }
                if (attr.origin != GLPK.GLP_RF_REG)
                {
                    if (GLPK.glp_get_row_stat(problem, i) == GLPK.GLP_BS)
                    {
                        cnt++;
                        if (list != null)
                        {
                            GLPK.intArray_setitem(list, cnt, i);
                        }
                    }
                }
            }
            return(cnt);
        }