Skip to content

Commit a4f9974

Browse files
committed
Merge branch 'release/1.0.1'
2 parents 5b7aaa0 + 36dc4b4 commit a4f9974

File tree

7 files changed

+53
-15
lines changed

7 files changed

+53
-15
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@ A scala library for IBM ILOG CPLEX.
22

33
This library combines functional programming, mathematical programming and constraint programming allowing to
44
model optimization problems with a syntax that is close to the standard presentation of these problems in textbooks and
5-
scientific papers. For instance, an expression such as:
5+
scientific papers. For instance, a constraint such as:
66

77

8-
![](equation.jpg)
8+
![](equation.gif)
99

1010
can be written as:
1111

1212
```
1313
#!scala
14-
sum (for (i <- 1 until n) yield a(i) * x(i)
14+
model.add(sum (for (i <- 1 to n) yield a(i) * x(i)) <= c(j))
1515
```
1616

1717
To get up to speed, the easiest way to start with this library is to study the examples:
1818

1919
* src/examples/mp: examples of optimization models based on mathematical programming
2020
* src/examples/cp: examples of optimization models based on constraint programming
2121

22-
This library has been tested using IBM ILOG CPLEX 12.6.3 and scala 2.11.8.
22+
This library has been tested using IBM ILOG CPLEX 12.6.1, 12.6.2, 12.6.3, 12.7.0 and scala 2.11.8.
2323

2424
To build the library install gradle 2.10 and set the environment variable `CPLEX_STUDIO_HOME` (e.g.
2525
on windows `C:\IBM\ILOG\CPLEX_Studio1263`).

build.gradle

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,40 @@
11
group 'com.decisionbrain'
2-
version '1.0.0'
2+
version '1.0.1'
33

44
apply plugin: 'java'
55
apply plugin: 'scala'
66
apply plugin: 'maven'
77
apply plugin: 'idea'
88
apply plugin: 'eclipse'
99

10+
//
11+
// Maven repository configuration
12+
//
13+
14+
def mavenFilename = 'maven.gradle'
15+
def gradleHome = System.getProperty("user.home") + '/.gradle/'
16+
17+
if (file(gradleHome + mavenFilename).exists()) {
18+
def filename = gradleHome + mavenFilename
19+
println("Importing gradle file $filename")
20+
apply from: filename
21+
}
22+
else if (file(mavenFilename).exists()) {
23+
def filename = mavenFilename
24+
println("Importing gradle file $filename")
25+
apply from: filename
26+
}
27+
else {
28+
println("Warning: File $mavenFilename not found")
29+
}
30+
31+
32+
//
33+
// CPLEX Home
34+
//
35+
1036
if (!hasProperty('cplexStudioHome')) {
11-
def cplexStudioHome = System.getenv()["CPLEX_STUDIO_DIR1263"]
12-
if (!cplexStudioHome) {
13-
cplexStudioHome = System.getenv()["CPLEX_STUDIO_HOME"]
14-
}
37+
def cplexStudioHome = System.getenv()["CPLEX_STUDIO_HOME"]
1538
project.ext.set("cplexStudioHome", cplexStudioHome)
1639
}
1740

equation.gif

1.15 KB
Loading

equation.jpg

-3.99 KB
Binary file not shown.

src/main/scala/com/decisionbrain/cplex/cp/Objective.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ class Objective(o: IloObjective)(implicit model: CpModel) extends Addable {
8686

8787
/**
8888
* Convert the objective to a character string.
89-
* @return
89+
*
90+
* @return a character string
9091
*/
9192
override def toString: String = o.toString
9293
}

src/main/scala/com/decisionbrain/cplex/cp/RangeConstraint.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import ilog.concert.IloRange
1010
import ilog.cp.IloCP
1111

1212
/**
13-
* Created by dgodard on 09/02/2017.
13+
* Constructor of class RangeConstraint.
14+
*
15+
* @param r is a CPLEX range constraint
16+
* @param model is the constraint programming model
1417
*/
1518
class RangeConstraint(r: IloRange)(implicit model: CpModel) extends Constraint(r) {
1619

src/main/scala/com/decisionbrain/cplex/cp/SearchPhase.scala

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,38 @@ package com.decisionbrain.cplex.cp
99
import ilog.cp.IloSearchPhase
1010

1111
/**
12-
* Constructor of class Objective.
12+
* Constructor of class SearchPhase.
1313
*
1414
* @param s is the CPO search phase
1515
* @param model is the constraint programming model
1616
*/
1717
class SearchPhase(s: IloSearchPhase)(implicit model: CpModel) {
1818

1919
/**
20-
* Returns the CPLEX objective.
20+
* Returns the CPLEX search phase.
2121
*
22-
* @return the CPLEX objective
22+
* @return the CPLEX search phase
2323
*/
2424
def getIloSearchPhase(): IloSearchPhase = s
2525

2626
/**
27-
* Convert the objective to a character string.
27+
* Convert the search phase to a character string.
2828
* @return
2929
*/
3030
override def toString: String = s.toString
3131
}
3232

33+
/**
34+
* Companion object for class SearchPhase
35+
*/
3336
object SearchPhase {
37+
38+
/**
39+
* Creates and returns a new search phase.
40+
*
41+
* @param s is the CPLEX search phase
42+
* @param model is the constraint programming model
43+
* @return a new search phase
44+
*/
3445
def apply(s: IloSearchPhase)(implicit model: CpModel) = new SearchPhase(s)
3546
}

0 commit comments

Comments
 (0)