forum.alglib.net
http://forum.alglib.net/

Integer programing for non-smooth nonlinear functions
http://forum.alglib.net/viewtopic.php?f=2&t=4477
Page 1 of 1

Author:  mmetwalli [ Mon Nov 21, 2022 6:17 pm ]
Post subject:  Integer programing for non-smooth nonlinear functions

How can I apply integer programming to minns?

I have variables that are integers and not real numbers.

Code:
    FILE *fostate = freopen("../logs/optimization/execution.log", "w", stdout);
    FILE *festate = freopen("../logs/optimization/error.log", "w", stderr);

    alglib::real_1d_array x = "[1, 1, 1]";
    alglib::real_1d_array s = "[1, 1, 1]";
    alglib::real_1d_array bndl = "[+0.1, 1, 0.1]";
    alglib::real_1d_array bndu = "[18, 3, 5]";
    alglib::ae_int_t maxits = 0;
    double epsx = 0.001;
    double diffstep = 0.01;
    double radius = 0.1;
    double rho = 0.0;

    alglib::minnsstate state;
    alglib::minnsreport rep;

    alglib::minnscreatef(3, x, diffstep, state);
    std::cout << "successfully created objective variables\n";

    alglib::minnssetalgoags(state, radius, rho);
    std::cout << "successfully sat goals\n";

    minnssetbc(state, bndl, bndu);
    std::cout << "successfully created cinstraints boudries\n";

    alglib::minnssetcond(state, epsx, maxits);
    std::cout << "successfully sat algorithm conditions\n";

    alglib::minnssetscale(state, s);
    std::cout << "successfully sat scale\n";

    try
    {
        std::cout << "optimization is starting ..............\n";
        std::cout << "-----------------------------------------------\n";
        alglib::minnsoptimize(state, nnetwork);

        alglib::minnsresults(state, x, rep);
        std::cout << "solved the optimization problem\n";
    }
    catch (alglib::ap_error e)
    {
        std::cerr << "error msg: %s\n" << e.msg.c_str();
    }

    std::cout << "x = " << x.tostring(3) << std::endl;

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/