2using System.Collections.Generic;
18 static void Main(
string[] args)
21 if (Environment.GetCommandLineArgs().Length > 1)
22 ws =
new GAMSWorkspace(systemDirectory: Environment.GetCommandLineArgs()[1]);
28 Dictionary<string, double> d =
29 new Dictionary<string, double>() { {
"i1", 97 }, {
"i2", 610 }, {
"i3", 395 }, {
"i4", 211 } };
30 Dictionary<string, double> w =
31 new Dictionary<string, double>() { {
"i1", 47 }, {
"i2", 36 }, {
"i3", 31 }, {
"i4", 14 } };
34 cs.RawWidth.AddRecord().Value = r;
35 foreach (
string i
in d.Keys)
36 cs.Widths.AddRecord(i);
37 foreach (KeyValuePair<string, double> t
in d)
38 cs.Demand.AddRecord(t.Key).Value = t.Value;
39 foreach (KeyValuePair<string, double> t
in w)
40 cs.Width.AddRecord(t.Key).Value = t.Value;
42 cs.Opt.AllModelTypes =
"cplex";
49 Console.WriteLine(rep.
Key(0) +
", pattern " + rep.
Key(1) +
": " + rep.
Value);
54 Console.WriteLine(
"Problem in GAMS: " + e.Message);
59 Console.WriteLine(
"System Error: " + e.Message);
This example implements a column generation approach to solve the cutting stock problem....