Topic
  • 3 replies
  • Latest Post - ‏2013-04-02T19:25:25Z by SystemAdmin
SystemAdmin
SystemAdmin
1883 Posts

Pinned topic Using settings ops file in main block

‏2013-04-02T08:48:44Z |
Hi,

I have an OPL main block running my model, like the following

code
main {
var operSource = new IloOplModelSource("MyModel.mod");
var operDef = new IloOplModelDefinition(operSource);
var operCplex = new IloCplex();
var operOpl = new IloOplModel(operDef,operCplex);
operOpl.addDataSource(thisOplModel.dataElements);
operOpl.generate();
operCplex.solve();
}
[/code]

How do I attach an existing settings ops file to that cplex run?

Thanks,
Zahar
Updated on 2013-04-02T19:25:25Z at 2013-04-02T19:25:25Z by SystemAdmin
  • AlexFleischer
    AlexFleischer
    1248 Posts

    Re: Using settings ops file in main block

    ‏2013-04-02T10:15:13Z  
    Hi,

    instead you should use an IloOplProject and use a run configuration that contains the .ops

    regards
  • AlexFleischer
    AlexFleischer
    1248 Posts

    Re: Using settings ops file in main block

    ‏2013-04-02T10:26:09Z  
    Hi,

    instead you should use an IloOplProject and use a run configuration that contains the .ops

    regards
    Hi,

    let me an example.
    If you have in the volsay example a run configuration, run configuration, then you can call the .ops that in in this run configuration with:

    main { 
      var prj = new IloOplProject("../volsay");
      var rc=prj.makeRunConfiguration("Basic Configuration");
      rc.oplModel.generate();
      rc.cplex.solve();
      rc.oplModel.postProcess();
      
    }
    
    Updated on 2014-03-26T05:49:48Z at 2014-03-26T05:49:48Z by AlexFleischer
  • SystemAdmin
    SystemAdmin
    1883 Posts

    Re: Using settings ops file in main block

    ‏2013-04-02T19:25:25Z  
    Hi,

    let me an example.
    If you have in the volsay example a run configuration, run configuration, then you can call the .ops that in in this run configuration with:

    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">main { var prj = new IloOplProject("../volsay"); var rc=prj.makeRunConfiguration("Basic Configuration"); rc.oplModel.generate(); rc.cplex.solve(); rc.oplModel.postProcess(); } </pre>
    Thanks, Alex!