source: branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Views/LinearProgrammingProblemDefinitionScriptView.cs @ 16172

Last change on this file since 16172 was 16172, checked in by ddorfmei, 9 months ago

#2931:

  • created LinearProgrammingAlgorithm
    • created definitions for all LP/MIP solvers supported by OR-Tools
  • created LinearProgrammingProblem
    • created classes required for scripting: LinearProgrammingProblemDefinition, LinearProgrammingProblemDefinitionScript, CompiledLinearProgrammingProblemDefinition
    • created views: LinearProgrammingProblemView, LinearProgrammingProblemDefinitionScriptView
  • updated OR-Tools version in ExtLibs to 6.9
File size: 2.4 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Drawing;
24using HeuristicLab.MainForm;
25using HeuristicLab.MathematicalOptimization.LinearProgramming.Problems;
26using HeuristicLab.PluginInfrastructure;
27using HeuristicLab.Scripting.Views;
28
29namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Views {
30  [View("LinearProgrammingProblemDefinitionScriptView")]
31  [Content(typeof(LinearProgrammingProblemDefinitionScript), IsDefaultView = true)]
32  public partial class LinearProgrammingProblemDefinitionScriptView : ScriptView {
33
34    public new LinearProgrammingProblemDefinitionScript Content {
35      get => (LinearProgrammingProblemDefinitionScript)base.Content;
36      set => base.Content = value;
37    }
38
39    public LinearProgrammingProblemDefinitionScriptView() {
40      InitializeComponent();
41    }
42
43    protected override void OnContentChanged() {
44      base.OnContentChanged();
45      variableStoreView.Content = Content?.VariableStore;
46    }
47
48    protected override void SetEnabledStateOfControls() {
49      base.SetEnabledStateOfControls();
50      variableStoreView.Enabled = Content != null && !Locked && !ReadOnly;
51    }
52
53    public override bool Compile() {
54      try {
55        base.Compile();
56      } catch (ProblemDefinitionScriptException e) {
57        ErrorHandling.ShowErrorDialog(e);
58        return false;
59      }
60      return true;
61    }
62
63    protected override void Content_CodeChanged(object sender, EventArgs e) {
64      base.Content_CodeChanged(sender, e);
65      UpdateInfoTextLabel("Code changed, compilation necessary!", Color.Red);
66    }
67  }
68}
Note: See TracBrowser for help on using the repository browser.