I am solving a same mixed integer problem several times (I am using different scenarios for each mixed integer program so that the optimal values of each mixed integer program are different) and trying to store optimal values of each mixed integer program in an array.

The following is the code that I wrote and I checked it is working properly:

parameters f=1 and u=10 are defined.

while ((f le u),
    Solve scheduling using mip maximizing objvalue;
    display objvalue.l;

    *** NEED some sentence(s) to store the objective values in an array ****.

    f = f+1;

Is there any way to store each optimal value in an array?

Thank you very much in advance.

asked 13 Feb '14, 15:58

Mike390's gravatar image

accept rate: 0%

edited 14 Feb '14, 04:14

fbahr's gravatar image

fbahr ♦

Define a parameter with its size equal to the number of scenarios (in your case 10) outside a loop.
Then, set its values within the loop accordingly.

The general template would as follows:

//outside the loop 
set f scenarios/f1*f10/;
parameter log(f);
//the loop
  //Solve the problem
  log(f) = z.l;

answered 13 Feb '14, 16:13

Ehsan's gravatar image

Ehsan ♦
accept rate: 16%

edited 14 Feb '14, 04:13

fbahr's gravatar image

fbahr ♦

Ehsan, Thank you very much. It's working well now

(13 Feb '14, 16:36) Mike390
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 13 Feb '14, 15:58

Seen: 2,229 times

Last updated: 14 Feb '14, 04:14

OR-Exchange! Your site for questions, answers, and announcements about operations research.