コード例 #1
0
ファイル: lgo.py プロジェクト: ampl/global-optimization
 def set(nl_file, args):
   header = util.read_nl_header(nl_file.name)
   maxfct = k * 50 * (header.num_vars + header.num_cons + 2)**2
   solver_options = args['solver_options']
   solver_options['g_maxfct'] = maxfct
   solver_options['l_maxfct'] = maxfct
   solver_options['maxnosuc'] = maxfct
コード例 #2
0
 def set(nl_file, args):
     header = util.read_nl_header(nl_file.name)
     maxfct = k * 50 * (header.num_vars + header.num_cons + 2)**2
     solver_options = args['solver_options']
     solver_options['g_maxfct'] = maxfct
     solver_options['l_maxfct'] = maxfct
     solver_options['maxnosuc'] = maxfct
コード例 #3
0
def test_read_nl_header():
    with tempfile.NamedTemporaryFile() as nl_file:
        nl_file.write('''g3 1 1 0       # problem bqp1var
          11 22 1 0 0     # vars, constraints, objectives, ranges, eqns
      ''')
        nl_file.flush()
        header = util.read_nl_header(nl_file.name)
        assert header.num_vars == 11
        assert header.num_cons == 22
コード例 #4
0
ファイル: util-test.py プロジェクト: ampl/global-optimization
def test_read_nl_header():
  with tempfile.NamedTemporaryFile() as nl_file:
    nl_file.write(
      '''g3 1 1 0       # problem bqp1var
          11 22 1 0 0     # vars, constraints, objectives, ranges, eqns
      ''')
    nl_file.flush()
    header = util.read_nl_header(nl_file.name)
    assert header.num_vars == 11
    assert header.num_cons == 22