public static void Main() { LpSolve.Init(); SolveA(); SolveB(); }
public static void Main() { LpSolve.Init(); //Test(); FormulateSample.Main2(); }
public LpSolveMilpSolver(int integerWidth, double epsilon = 0.000000001) : base(integerWidth, epsilon) { var dllFolderPath = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), Environment.Is64BitProcess ? @"NativeBinaries\win64\" : @"NativeBinaries\win32\"); LpSolve.Init(dllFolderPath); LpSolvePointer = LpSolve.make_lp(0, 0); }
protected override void InternalLoadModelFromFile(string modelPath) { LpSolvePointer.delete_lp(); LpSolve.Init(); var IMPORTANT = 3; var MPS_FREE = 8; LpSolvePointer = Path.GetExtension(modelPath)?.Trim('.').ToLower() == "lp" ? LpSolve.read_LP(modelPath, IMPORTANT, null) : LpSolve.read_MPS(modelPath, IMPORTANT | MPS_FREE); }
public static void Main() { Debug.WriteLine(Environment.CurrentDirectory); LpSolve.Init(); Test(); //TestMultiThreads(); }
public static void Main() { LpSolve.Init(); Demo(); }
public static ISet <Donor> FindOptimalDonors(ISet <Donor> donors, CofinanceInfo bounds) { var result = new HashSet <Donor>(); if (donors.Count == 0) { return(result); } LpSolve.Init(); using (var lp = LpSolve.make_lp(0, donors.Count)) { lp.set_verbose(3); var boundRow = new double[donors.Count]; var boundColno = new int[donors.Count]; var targetRow = new double[donors.Count]; var targetColno = new int[donors.Count]; var i = 0; foreach (var donor in donors) { lp.set_col_name(i + 1, donor.Channel.Id.ToString()); lp.set_binary(i + 1, true); boundColno[i] = targetColno[i] = i + 1; boundRow[i] = bounds.ChannelsPrices[donor.Channel]; targetRow[i] = donor.Effect; i++; } lp.set_add_rowmode(true); lp.add_constraintex(donors.Count, boundRow, boundColno, lpsolve_constr_types.LE, bounds.R); lp.set_add_rowmode(false); lp.set_obj_fnex(donors.Count, targetRow, targetColno); lp.set_maxim(); var lpResult = lp.solve(); if (lpResult != lpsolve_return.OPTIMAL) { throw new Exception($"Optimization failed! LP result code: {lpResult}"); } var variableValues = new double[donors.Count]; lp.get_variables(variableValues); i = 0; foreach (var donor in donors) { if (Math.Abs(variableValues[i] - 1) < 1e-10) { result.Add(donor); } i++; } } return(result); }
public static void Main() { LpSolve.Init(); zadanie8(); }
public MixedStrategy(int[,] matrix) { _matrix = matrix; LpSolve.Init(); }