Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
1 reply Latest Post - ‏2012-08-30T19:44:00Z by SystemAdmin
SystemAdmin
SystemAdmin
378 Posts
ACCEPTED ANSWER

Pinned topic How to increment a model parameter as long as the problem is infeasible?

‏2012-08-22T21:37:34Z |
I am using IBM ILOG Script. Where can I find the documentation of the methods and datamembers of the OPL classes? I have found that for C++, Java and .Net. I tried calling the analogues methods in the script but it failed.

I have a parameter d in my CSP that should be incremented if there is no feasible solution, starting with 0 and going up to at most 5 (d=0..5). What is the most intelligent way to do that?

One way is to turn the parameter into an integer dvar and minimize its value. If I could tell the CP solver to try its values in the 0..5 order then I would be happy.

Another way is to increment the model parameter on failure and re-run the solver. Unfortunately it's rather tricky, I am following the example at IloOplModel in the help. My parameters are coming from a file and I ended up copying manually the parameters... It works but messy. In C++ I would just call a copy constructor to copy the data. Is there a way to make a copy of data coming from a file but changing some of the values?

The mulprod example does something similar but I failed to same, I got an error message.

Any help is greatly appreciated.
Updated on 2012-08-30T19:44:00Z at 2012-08-30T19:44:00Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    378 Posts
    ACCEPTED ANSWER

    Re: How to increment a model parameter as long as the problem is infeasible?

    ‏2012-08-30T19:44:00Z  in response to SystemAdmin
    Hi,

    the ILOG Script reference manual can be found here: http://pic.dhe.ibm.com/infocenter/cosinfoc/v12r4/index.jsp?topic=%2Filog.odms.ide.help%2Frefjsopl%2Fhtml%2Fintro.html

    About modifying data and solving iteratively, I would invite you to look at one of the distributed sample: multiperiod production planning, in particular the script in mulprod_main.mod.
    The section of the script that updates the data "flour's capacity" is:
    
    produce = 
    
    new IloOplModel(def,cplex); capFlour++; data.Capacity[
    "flour"] = capFlour; produce.addDataSource(data); produce.generate();
    


    Could you post your code and the error you're getting?
    To be able to update your data "d", make sure it has "external initialization":
    
    
    
    int d=...;