I just picked up Symphony 5.4.0 and started to use the C interface. I copied the milp2.c program and changed it to do multi-objective optimization. The code and output is attached, including the AMPL description I started with. The problem I coded is a variant of the Knapsack problem, in which we try to optimize the value of boxes put into a knapsack. The original problem has boxes with weights and values, and we try to maximize value within a weight constraint. This works fine as a single-objective problem in Symphony. I modified the program to add volume to the boxes, now I try to maximize value and weight within a volume constraint. When I look at the output I see three answers before the program fails, as follows:<br>
<br><span style="font-family:courier new,monospace">DATA BOX WEIGHT VALUE VOLUME</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> Green 8 4 3</span><br style="font-family:courier new,monospace" clear="all">
<span style="font-family:courier new,monospace"> Gray 1 1 4</span><br style="font-family:courier new,monospace" clear="all"><span style="font-family:courier new,monospace"> Yellow 4 10 5</span><br style="font-family:courier new,monospace" clear="all">
<span style="font-family:courier new,monospace"> Orange 3 2 1</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> Blue 1 2 1 </span><br style="font-family:courier new,monospace" clear="all">
<span style="font-family:courier new,monospace">
</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">CONSTRAINT: Sum of volumes < 15</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">MAXIMIZE: Sum of values</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">MAXIMIZE: Sum of weights</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">SOLUTIONS:</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">3 Yellow + 3 Orange: Value = 36, Weight = 21, Volume = 15</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">15 Orange: Value = 30, Weight = 45, Volume = 15</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">1 Yellow + 11 Orange: Value = 32, Weight = 37, Volume = 15</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace">Here are my questions:<br>
<br>1) The above solutions only show up in the output, how do I retrieve them? With sym_get_col_solution()?<br>2) How many solutions should I expect?<br>3) How does the weighting function sym_set_obj2_coeff affect the result? Is the first objective more important?<br>
4) Can I write this same program in C++? Is there an example similar to milp2.c in C++?<br>5) Why is my program crashing with a malloc error? Do I need to ask for more resources on the command line?<br><br>-Chris-<br><br>
<a href="mailto:cgwilcox@gmail.com" target="_blank">cgwilcox@gmail.com</a><br><a href="mailto:wilcox@cs.colostate.edu" target="_blank">wilcox@cs.colostate.edu</a><br>
<br>