Ipopt
3.11.9
contrib
JavaInterface
org
coinor
examples
scalable
SolveProblem.java
Go to the documentation of this file.
1
9
package
org.coinor.examples.scalable;
10
11
import
java.util.HashMap;
12
import
org
.
coinor
.
Ipopt
;
13
19
public
class
SolveProblem
20
{
21
public
static
void
main
(String[] args)
22
{
23
HashMap<String, Scalable> list =
new
HashMap<String, Scalable>();
24
25
// adding all problems here
26
list.put(
"LukVlE1"
,
new
LuksanVlcek1
(
"LukVlE1"
, 0.0, 0.0));
//E means equal
27
list.put(
"LukVlI1"
,
new
LuksanVlcek1
(
"LukVlI1"
, -1.0, 0.0));
//I means inequal
28
29
if
( args.length < 2 )
30
{
31
System.out.println(
"Usage: ProblemName N\n"
);
32
System.out.println(
" - N is a positive parameter determining problem size"
);
33
System.out.println(
" - ProblemName is one of:"
);
34
// list all problems
35
for
(
Scalable
s : list.values() )
36
System.out.println(
" "
+ s);
37
38
return
;
39
}
40
41
String problem = args[0];
42
int
n = Integer.parseInt(args[1]);
43
44
System.out.println(
"Solving problem "
+ problem +
" for N="
+ n);
45
46
Scalable
p = list.get(problem);
47
if
( p ==
null
)
48
{
49
System.out.println(
"Problem not found!"
);
50
return
;
51
}
52
53
if
( !p.
initialize
(n) )
54
return
;
55
56
p.
create
();
57
58
p.
OptimizeNLP
();
59
60
switch
( p.
getStatus
() )
61
{
62
case
Ipopt
.SOLVE_SUCCEEDED:
63
case
Ipopt
.ACCEPTABLE_LEVEL:
64
System.out.println(
"Solution found."
);
65
break
;
66
default
:
67
System.out.println(
"** Could not solve problem "
+ problem +
" for N="
+ n +
", status: "
+ p.
getStatus
());
68
}
69
}
70
}
org.coinor.examples.scalable.SolveProblem
Class for running several different Scalable problems.
Definition:
SolveProblem.java:20
Ipopt
Definition:
matlabjournal.hpp:14
org.coinor.examples.scalable.Scalable
Abstract class for the scalable problems.
Definition:
Scalable.java:24
org.coinor.examples.scalable.Scalable.initialize
abstract boolean initialize(int n)
In this function all problem sizes, bounds and initial guess should be initialized.
org.coinor.Ipopt.getStatus
int getStatus()
Gives Ipopt status of last OptimizeNLP call.
Definition:
Ipopt.java:320
org.coinor
Copyright (C) 2007 VRTech Industrial Technologies - www.vrtech.com.br.
org
org.coinor.examples.scalable.LuksanVlcek1
Implementation of Example 5.1 from "Sparse and Parially Separable Test Problems for Unconstrained and...
Definition:
LuksanVlcek1.java:18
org.coinor.Ipopt.OptimizeNLP
int OptimizeNLP()
This function actually solve the problem.
Definition:
Ipopt.java:290
org.coinor.examples.scalable.Scalable.create
void create()
Creates the problem based on the already computed problem sizes and bounds.
Definition:
Scalable.java:76
org.coinor.Ipopt
A Java Native Interface for the Ipopt optimization solver.
Definition:
Ipopt.java:48
org.coinor.examples.scalable.SolveProblem.main
static void main(String[] args)
Definition:
SolveProblem.java:21
Generated by
1.8.18