⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmbranch.frm

📁  本程序是在原来的单纯形法基础上改进的,主要用于分枝界定法求解的整数规划。  修正的地方:   1.运用勃兰特原则   2.人机互动
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "Msflxgrd.ocx"
Begin VB.Form FrmBranch 
   Caption         =   "Form1"
   ClientHeight    =   7110
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9090
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   ScaleHeight     =   7110
   ScaleWidth      =   9090
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton Cmd_exit 
      Caption         =   "退出"
      Height          =   495
      Left            =   4680
      TabIndex        =   14
      Top             =   6360
      Width           =   1575
   End
   Begin VB.CommandButton Cmd_Cal 
      Caption         =   "计算"
      Height          =   495
      Left            =   2400
      TabIndex        =   13
      Top             =   6360
      Width           =   1575
   End
   Begin MSFlexGridLib.MSFlexGrid MSGrid 
      Height          =   2415
      Left            =   360
      TabIndex        =   12
      Top             =   3720
      Width           =   8175
      _ExtentX        =   14420
      _ExtentY        =   4260
      _Version        =   393216
      Rows            =   11
      Cols            =   8
   End
   Begin VB.Frame Frame3 
      Caption         =   "X2"
      ForeColor       =   &H000000FF&
      Height          =   2655
      Left            =   4560
      TabIndex        =   6
      Top             =   480
      Width           =   3735
      Begin VB.Frame Frame4 
         Height          =   975
         Left            =   360
         TabIndex        =   9
         Top             =   1200
         Width           =   3255
         Begin VB.OptionButton OptY2 
            Caption         =   "<="
            Height          =   375
            Left            =   1800
            TabIndex        =   11
            Top             =   360
            Value           =   -1  'True
            Width           =   1215
         End
         Begin VB.OptionButton OptY1 
            Caption         =   ">="
            Height          =   495
            Left            =   240
            TabIndex        =   10
            Top             =   240
            Width           =   975
         End
      End
      Begin VB.TextBox TxtY 
         Height          =   495
         Left            =   2040
         TabIndex        =   8
         Text            =   "99999"
         Top             =   480
         Width           =   1455
      End
      Begin VB.Label Label2 
         Caption         =   "X2的分枝界"
         Height          =   375
         Left            =   600
         TabIndex        =   7
         Top             =   600
         Width           =   975
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "X1"
      ForeColor       =   &H000000FF&
      Height          =   2655
      Left            =   360
      TabIndex        =   0
      Top             =   480
      Width           =   3735
      Begin VB.TextBox TxtX 
         Height          =   495
         Left            =   1800
         TabIndex        =   5
         Text            =   "99999"
         Top             =   360
         Width           =   1455
      End
      Begin VB.Frame Frame2 
         Height          =   1095
         Left            =   240
         TabIndex        =   1
         Top             =   1200
         Width           =   3255
         Begin VB.OptionButton OptX2 
            Caption         =   "<="
            Height          =   375
            Left            =   1920
            TabIndex        =   3
            Top             =   360
            Value           =   -1  'True
            Width           =   1095
         End
         Begin VB.OptionButton OptX1 
            Caption         =   ">="
            Height          =   375
            Left            =   240
            TabIndex        =   2
            Top             =   360
            Width           =   975
         End
      End
      Begin VB.Label Label1 
         Caption         =   "X1的分枝限"
         Height          =   495
         Left            =   480
         TabIndex        =   4
         Top             =   480
         Width           =   1215
      End
   End
End
Attribute VB_Name = "FrmBranch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Cmd_Cal_Click()
  Dim i%, j%
  For i = 1 To m
    C(i) = CA(i)
  Next i
  For j = 1 To n
   ibs(j) = ibsA(j)
  Next j
  For j = 1 To n
     For i = 1 To m
      A(j, i) = AA(j, i)
     Next i
     b(j) = bA(j)
  Next j

  If OptX1.Value = True Then
     A(n - 1, 1) = -1
     b(n - 1) = -Val(TxtX)
  Else
     A(n - 1, 1) = 1
     b(n - 1) = Val(TxtX)
  End If
  
  If OptY1.Value = True Then
     A(n, 2) = -1
     b(n) = -Val(TxtY)
  Else
     A(n, 2) = 1
     b(n) = Val(TxtY)
  End If
  

  
  lineprog A, b, C, ibs, m, n
  MSGrid.TextMatrix(1, 1) = XX(1)
  MSGrid.TextMatrix(2, 1) = XX(2)
  MSGrid.TextMatrix(6, 1) = XX(3)
  
End Sub

Private Sub Cmd_exit_Click()
  Unload Me
End Sub

Private Sub Form_Load()
  MSGrid.TextMatrix(0, 0) = "约束变量值"
  MSGrid.TextMatrix(1, 0) = "    x1   "
  MSGrid.TextMatrix(2, 0) = "    x2   "
  MSGrid.TextMatrix(6, 0) = " 目标值 "
  MSGrid.TextMatrix(0, 1) = "   结果  "
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -