forum.alglib.net

ALGLIB forum
It is currently Thu Nov 14, 2024 5:46 am

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Integer programing for non-smooth nonlinear functions
PostPosted: Mon Nov 21, 2022 6:17 pm 
Offline

Joined: Mon Nov 21, 2022 4:40 pm
Posts: 1
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;


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group